Parallel Haskell?

It seems functional languages like Haskell are easy to parallelize but it is still difficult to decide what and when to parallelize (too many generated threads are the problem).

Could it be possible to create an AI model to predict does it make sense to parallelize by using large number of test code that’s execution speed with different parallellizations is measured using CPU?

It has been over ten years since I coded minimal java compiler in a university course but with neural networks the problem probably is that parallellization data will not be continuous?

1 Like

Profile-guided optimization is a non-AI version of this. This hasn’t been implemented in GHC as far as I know, yet!

Another non-AI technique that is more general that might be useful is Bayesian optimization, which can be used to optimize expensive black-box functions (e.g. a Haskell program) (edit: also works on non-continuous domains)

6 Likes

Depending on what you exactly want to paralellize, Accelerate might be of use.

That library takes a DSL consisting of a (quite substantial) subset of Haskell, and can compile it to efficient data-parallel code that might even run on your GPU.

3 Likes

Thanks. I will take a look at these when I have time.