There was some buzz when I mentioned last year that Intel was working on bringing Concurrent Collections to Haskell. Intel Concurrent Collections (CnC) is already available for Java and C++ and aims to make it easier for domain experts to create parallel programs without having to become experts at parallel programming. Ryan Newton has been working on bringing CnC to Haskell as an experimental side project and in the last month, there have been two releases of it. The current version is 0.1.3.
Last month, Newton announced the first release of CnC for Haskell. CnC is used for graph-like computations that share immutable data in tables. Newton said that Haskell and CnC make a great match because CnC uses the concept of pure functions, which Haskell can enforce, and Haskell is the only major language that can leverage the fact that both steps and graph executions are pure. To see how it works, read Newton’s blog post which includes the Hello World program that ships with the software. If you already have the Haskell Platform installed, the post shows how you can get CnC with a single line.
There are four schedulers with CnC for Haskell: Scheduler 3 is based on IO threads; Schedulers 5 and 6 use a global task pool; and Scheduler 8 uses Cilk-style nested parallelism (pure functions with par annotations). Scheduler 8 was intended to be most efficient, but is suffering from unresolved problems in parallel performance. Schedulers 5 and 6 are performing better than expected, so Scheduler 6 (the better of the two) is the default for now.
Shortly after the first release, a minor upgrade was released that introduces parallel for loops. It enables you to expose a parallel for loop to the CnC scheduler, which helps to add structure when spawning work. There’s more detail on parallel for loops in CnC and some examples in Newton’s blog post here. Newton says that parallel for is a good example of how the Haskell version of CnC is good for experimentation and prototyping.
Once you’ve experimented with the basics of CnC, you might want to review Newton’s latest blog post. Using the example of a Mandelbrot Set (pictured above and explained here), Newton’s post looks at how CnC can help to achieve a speedup of nearly 3.75x. It also includes several graphs comparing the performance of the different schedulers at different stages of the program’s optimisation.
The feedback that Newton has received has been largely supportive, with one comment commending Intel for taking an interest in Haskell. I’m sure that the project team would welcome any feedback you have.