3 ms·
No, its not theoretical. However, do not assume the Haskell compiler automatically parallelises arbitrary non-parallel code. That's simply not possible to do we
by dons 18y ago
No, its not theoretical. However, do not assume the Haskell compiler automatically parallelises arbitrary non-parallel code. That's simply not possible to do well, and is really a dead end.
What GHC does do is semi-implicit multicore parallelism for particular subsets of the language.
The GHC runtime is a parallel runtime supporting a range of parallel abstractions from semi-implicit parallelism to explicit task parallelism, in a three level hierarchy of OS threads -> Haskell lightweight threads -> fine grained thread sparks.
The most automated mechanisms are:
* thread sparks - you hint which code to run in parallel with `par`, and the runtime uses that hint to parallelise your code, distributing it across cores.
* data parallel arrays - if your algorithm is expressible as an array program, use DPH and the array operations will be automatically parallelised (alpha!)
To more explicit paralelism with:
* threads
* transactional memory
* mvars
* message passing
An example of the semi-implicit multicore parallelism is given in the "Haskell in 5 minutes" tutorial here:
http://haskell.org/haskellwiki/Haskell_in_5_steps#Write_your_first_parallel_Haskell_program http://haskell.org/haskellwiki/Haskell_in_5_steps#Write_your...