What Intel® Cilk™ Plus solves for C and C++ programmers

C and C++, like most programming languages in use today, were not designed as parallel programming languages.

The most widely used higher-level parallel programming language for C has been OpenMP*, which was introduced in 1996. All major compilers support OpenMP to one extent or another, and Intel compilers offer one of the best implementations of the latest version of OpenMP in the C/C++ and Fortran compilers. OpenMP is an open specification that is used across the industry and is not limited to a single operating system or processor.

C++ had a number of shortcomings for parallel programming. Intel® Threading Building Blocks (TBB) addressed a number of these in 2006 by introducing parallel algorithms for task-based programming, concurrent containers, portable mutual exclusion capabilities and efficient concurrent memory allocation capabilities.  According to Evans Data Corp, TBB has grown to become the most widely used abstract programming method for C/C++ developers, having surpassed OpenMP a few years ago. The open source project for Intel TBB has had broad participation leading to numerous ports to many operating systems and many processors. TBB is an open source project used across the industry – it is not limited to a single operating system or processor.

With Intel TBB, there remain two very important gaps for C and C++ support of parallelism. One is compiler assistance and the other is data parallelism.  Cilk Plus is a project to address both of these gaps. It provides opportunities to greatly simplify parallel programming for the masses while making it easy to harness multiple cores and vector units present in contemporary processors for great performance, which in turn enables new capabilities.

Intel® Cilk™ Plus is an open specification and is fully compatible with Intel TBB. Cilk Plus can be used by itself, or as an extension to Intel TBB. The Intel compilers support Cilk Plus on Intel and compatible processors on Windows and Linux. Support for operating systems and processors is expected to grow as others adopt the specification.

The Cilk Plus ABI enables other compilers to target the Intel runtime. Having a single runtime on a platform is an important step in ensuring proper application behavior in multi-programmed environments and Intel's intention by publishing this ABI is to allow a single runtime on a platform.  Intel views the ABI as in important part of the language specification – something that other parallel language specifications have avoided and regretted.

Cilk started as a research project at M.I.T. in the mid-1990s. Out of it was born a start-up, Cilk Arts, that introduced Cilk as a product with the very important innovation of hyper-objects. Cilk Arts engineers joined Intel in 2009 and have worked to add the capabilities to Intel compilers and publish a full specification. The addition of data-parallelism features address needs expressed by Cilk Arts and Intel customers, and is the essence of the “Plus” part of Cilk Plus.

Addressing both compiler assistance and data-parallelism directly has proven to be very effective while being easy to learn and use. Three very simple keywords added to the C++ language give programmers simplicity in expressing & understanding their parallelism while giving compilers a chance to shine. Compiler implementations are more efficient, giving programmers an incredibly simple way to do simple and highly efficient parallelism in C and C++. Hyper-objects represent a breakthrough in handling reductions in an elegant, easy to learn and effective manner. Finally, vector and array syntax extensions unlock use of vectorization by the compiler to directly give the programmer a say in using SIMD instructions to give best performance to code that reads as simple C code.

The specification of Cilk Plus details these features quite well. An introduction, including sample code, is available separately, also at cilk.com in particular I recommend starting with the evaluator's guide for Cilk Plus.

I think you will find Cilk Plus to be a powerful complement to Intel TBB. The direct support for data-parallelism to unlock vectorization, and the efficiency of compiler implementations of task-parallelism, speaks strongly to the benefits of adding these capabilities to compilers.

James Reinders

*OpenMP is a trademark of the OpenMP Architecture Review Board.
*Cilk is a trademark of Intel Corporation. Intel plans to make it available for use by compilers that implement the Cilk Plus specification.