View on GitHub

Cilk Plus/LLVM

An implementation of the Intel® Cilk™ Plus C/C++ language extensions in LLVM

Intel® Cilk™ Plus is an extension to the C and C++ languages to support data and task parallelism. It is one of the easiest, quickest way to harness the power of both multicore and vector processing. Visit for details.

This project implements the Intel® Cilk™ Plus language extensions in the Clang frontend for LLVM. There are two other implementations available. A commercial version of Cilk Plus is available as part of the Intel® C++ Composer XE compiler. There is also an open source version available in the "cilkplus" branch of the GCC C/C++ compiler. More information is available on


September 17, 2014 - Binary images of the compiler added for both Linux and Mac.
September 05, 2014 - CilkPlus runtime is building directly from CilkPlus runtime site.
June 26, 2014 - re-base to Clang 3.4 done;
Extended Array Notation is fully supported now;
Some bugs fixed.
October 9, 2013 - #pragma simd and SIMD-enabled functions are now supported.
June 7, 2013 - All known exception handling issues have been resolved.
May 7, 2013 - cilk_for is now supported, including #pragma grainsize. The runtime was updated to the latest version.

Try Cilk Plus/LLVM

Note: Cilk Plus/LLVM does not yet support all of the Intel® Cilk™ Plus extensions. See Status.


Most software and hardware requirements are the same as for LLVM. However, support is currently limited to 64 bit Linux and Mac OS X - see status for details on supported configurations and known issues.

CMake version 2.8.8 or greater is required to compile compiler-rt when using the recommended build process. Alternatively, it is also possible to use configure/make by following the directions at

Getting the source code

$ cd where-you-want-llvm-to-live
$ git clone -b cilkplus
$ git clone -b cilkplus llvm/tools/clang
$ git clone -b cilkplus llvm/projects/compiler-rt

The source code structure follows Clang/LLVM:


The recommended way to build Cilk Plus/LLVM is using CMake. Detailed instructions on how to build Clang/LLVM/Compiler-rt with CMake can be found in the following page: In the following command, make sure to replace /install/prefix with the location where you would like to install the binaries.

$ cd llvm
$ mkdir build && cd build
$ cmake -DCMAKE_INSTALL_PREFIX=/install/prefix -DCMAKE_BUILD_TYPE=Release \
$ make && make install

Attention: To run (rather than just compile) code you need to get and build an Intel Cilk Runtime.
Alternatively you can use new scripts where-you-want-llvm-to-live/llvm/build-[linux|mac].sh. These scripts intend to help you to configure and build the whole stuff related to the compiler on your OS.

Mac OS X

The basic steps are the same as above. However, on Mac OS X it is recommended to build with the Clang compiler shipped with the OS. Add the following definitions to the cmake command above.



Instead of building from sources you're able simply to download the precompiled image of our compiler related to your OS: Linux or Mac.


To use the newly installed compiler, add the following to your environment. On Mac OS X, replace LD_LIBRARY_PATH with DYLD_LIBRARY_PATH.

export PATH=/install/prefix/bin:$PATH
export C_INCLUDE_PATH=/install/prefix/include:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/install/prefix/include:$CPLUS_INCLUDE_PATH
export LIBRARY_PATH=/install/prefix/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=/install/prefix/lib:$LD_LIBRARY_PATH

When you build a program that uses Intel® Cilk™ Plus extensions, add the following option to enable Cilk Plus support and link to the runtime library.


A simple program

#include <cilk/cilk.h>
#include <assert.h>

int fib(int n) {
  if (n < 2)
    return n;
  int a = cilk_spawn fib(n-1);
  int b = fib(n-2);
  return a + b;

int main() {
  int result = fib(30);
  assert(result == 832040);
  return 0;

Confirm that the compiler is working correctly by saving the above code code to a file.

$ clang -fcilkplus test.c -o test
$ ./test

You can check that the code is executing in parallel by using the time command and CILK_NWORKERS environment variable to control the number of workers.

$ CILK_NWORKERS=1 time ./test
$ CILK_NWORKERS=2 time ./test
$ CILK_NWORKERS=4 time ./test


What works right now

Feature Supported?
cilk_spawn, cilk_sync check
cilk_for check
hyperobjects check
#pragma simd check
simd-enabled functions check
array notation check

Known issues

Supported platforms

OS: Linux or Mac OS X
Architecture: x86-64


LLVM, Clang, and Compiler-rt are distributed under LLVM's "UIUC" BSD-Style license. For details, including information about third-party components, see LICENSE.txt in the code repositories.

The Intel® Cilk™ Plus runtime library is distributed under a BSD 3-Clause license.


If you would like to report a bug, or make a feature request, you can submit an issue in Github here.