Steve Lewin-Berlin, VP of Engineering and Operations for CilkArts, has written an interesting introspective post on why using serial semantics in a natively parallel programming construct is the cat’s pajamas. The Cilk++ programming semantics are essentially extensions to what look like standard, serial C++ constructs. One can simply add ‘cilk_spawn’, ‘cilk_sync’, and replace standard ‘for’ loops with ‘cilk_for’. So what! Cilk can devolve from parallel to purely serial, what gives!? According to Lewin-Berlin, this gives you four advantages over programming models without serial semantic.
1. The equivalent serial C++ program can easily be debugged and analyzed using existing development tools
2. The serial semantics of Cilk++ programs allows CilkArts to build better tools that analyze the performance and correctness of Cilk++ programs, and these tools offer strong guarantees about the program.
3. The serial semantics of Cilk++ provides a real advantage to program testing and quality assurance.
4. Serial semantics provides high performance while allowing you to design your program without specifying the number of processors on which the program with execute.
So what’s the catch Steve!? As with other parallel programming constructs, it doesn’t do everything.
For one, since there are some kinds of parallelism that actually don’t have serial semantics, you can’t write programs using these parallelization strategies in Cilk++. For example, Cilk++ doesn’t support producer/consumer, software pipelining, or message passing. Nevertheless, although we’re giving something up to have to serial semantics, our experience is that less is more.
Its my personal belief that Cilk++ is, at the least, an interesting attack at parallel programming. Keep in mind, with the growing core density in upcoming chip platforms, one can easily build fairly powerful SMP systems that fit on a desktop. This makes language constructs such as Cilk++ incredibly attractive to those who want to almost immediately take advantage on their newfound parallelism without extensive development pipelines.
For more info on the serial semantics in Cilk, read Steve’s full writeup here.