Experimenting with Intel Concurrent Collections for Haskell

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.

Mandelbrot Set

A Mandelbrot Set, yesterday.

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.

One Response

  1. [...] shows the workflow for creating a Fibonacci sequence generator in C++. As you might remember, Intel Concurrent Collections is also available for Haskell, and the tutorial provides some insight into the core concepts of Concurrent Collections for that [...]

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: