The latest version of the Cilk system consists of the Tapir/LLVM compiler and the Intel Cilk Plus runtime library. This version has been tested on x86-64 systems running recent distributions of Linux, including Ubuntu 16.04 and Fedora 24.
The Tapir/LLVM compiler is the newest compiler that supports Cilk. Tapir/LLVM extends LLVM and Clang with support for the Cilk keywords, Cilk reducer hyperobjects, and a version of the
grainsize pragma for
cilk_for loops. The Tapir/LLVM compiler implements the Tapir extension of LLVM’s intermediate representation (Schardl, Moses, & Leiserson, 2017) to compile task-parallel programs more efficiently than previous compilers. Tapir/LLVM also includes the Cilksan determinacy-race detector, which is guaranteed to find a race if one exists or certify the absence of races in a program execution.
The current release of the Tapir/LLVM compiler is version 1.0-3. This release is based on version 5 of LLVM and Clang. The source for an experimental version of Tapir/LLVM, based on version 6.0 of LLVM and Clang, is available on GitHub.
For x86-64 systems running Debian or Ubuntu, binaries for Tapir/LLVM and associated tools are available via a PPA. You can install the Tapir/LLVM toolchain as follows:
$ sudo apt-add-repository ppa:wsmoses/tapir-toolchain $ sudo apt-get update $ sudo apt-get install tapirclang-5.0 libcilkrts5
These commands will install the executables
clang++-5.0. You can then set
clang++ to use these executables by default as follows:
$ sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-5.0 10 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-5.0 $ sudo update-alternatives --config clang
You will be able to install updates to Tapir/LLVM in the same way as other Debian or Ubuntu packages:
$ sudo apt-get update $ sudo apt-get upgrade
You can install Tapir/LLVM on Mac OS X using Homebrew.
|This installation process is currently under development. Your mileage might vary.|
$ brew install wsmoses/tools/cilkrts $ brew install wsmoses/tools/tapir --HEAD
You can download the Tapir/LLVM source code Plus runtime system separately.
Building Tapir/LLVM involves building the LLVM and Clang systems that they extend. To build Tapir/LLVM from source, you will need a C/C++ compiler and a recent version of Cmake. See http://llvm.org/docs/CMake.html for more information on building LLVM and Clang.
|Building the LLVM and Clang systems considers significant computing resources. We have found that building a Debug build of LLVM and Clang requires approximately 40 GB of disk space and 12 GB of main memory to compile. A fresh build can take substantial time to complete as well, e.g., approximately an hour on one processor of an AWS c4.8xlarge instance.|
The Tapir-Meta repository on GitHub provides a simple means for downloading and building Tapir/LLVM compiler and its companion repositories, via the following commands:
$ git clone --recursive https://github.com/wsmoses/Tapir-Meta.git $ cd Tapir-Meta/ $ ./build.sh release $ source ./setup-env.sh
The build script will attempt to use parallel processors to speed up compilation.
The source code for the Tapir/LLVM compiler consists of several integrated repositories. The repository structure reflects that of LLVM itself.
The Tapir-LLVM repository houses the Tapir fork of LLVM. This fork implements the Tapir extensions to LLVM’s intermediate representation. This fork also implements support for the CSI tool framework.
The Tapir-Clang repository houses the Tapir fork of LLVM’s Clang front-end. This fork implements support for Cilk and generates LLVM IR with Tapir from Cilk’s parallel language constructs.
The Tapir-compiler-rt repository houses the fork of LLVM’s compiler-rt repository. This fork includes the source code of the Cilksan and Cilkscale tools. This fork also includes the runtime for the CSI framework.
The Tapir-Polly repository houses the fork of LLVM’s Polly repository. This fork implements extensions to Polly to generate Tapir intermediate representation for parallel loops.
For LLVM repositories that do not have a custom fork, Tapir/LLVM should be able to work with the existing LLVM repository natively.
The following instructions will check out this collection of repositories appropriately in the current directory:
$ git clone https://github.com/wsmoses/Tapir-LLVM.git src $ git clone https://github.com/wsmoses/Tapir-Clang.git src/tools/clang $ git clone https://github.com/wsmoses/Tapir-compiler-rt.git src/projects/compiler-rt $ git clone https://github.com/wsmoses/Tapir-Polly.git src/tools/polly
To build Tapir/LLVM, you will need the following executables and libraries:
CMake, version 3.4.3 or newer, and a C++ compiler that supports C++11, are needed to build Tapir/LLVM.
The Snappy compression/decompression library is needed to build and run Cilksan. Many platforms provide a package for installing Snappy, e.g.,
snappy-develon Fedora, or
brew install snappyon Mac OS X.
Binutils is needed to use link-time optimization (LTO). Many platforms provide a package for to install binutils, e.g.,
binutils-devon Ubuntu, or
After checking out these repositories, you can build Tapir/LLVM from source using the following command.
$ mkdir src/build $ cd src/build $ cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=host -DLLVM_BINUTILS_INCDIR=/usr/include .. $ cmake --build .
Additional build-configuration options are available. Please see http://llvm.org/docs/CMake.html for more information.
The Intel Cilk Plus runtime is available in a package on many Linux distributions. For example, the Cilk Plus runtime is available via the
libcilkrt5 package on Debian or Ubuntu, and via the
libcilkrts package on Fedora.
For systems that do not provide a package for the Intel Cilk Plus runtime system, you can build the runtime system from source using a compiler that supports Cilk, such as Tapir/LLVM. Assuming that Tapir/LLVM has been installed as
clang on the system, the Cilk Plus runtime-system library can be obtained by downloading the source from
https://github.com/CilkHub/cilkrts/archive/v0.1.2.tar.gz, unpacking the archive, and running the following commands:
$ mkdir -p cilkrts-0.1.2/build $ cd cilkrts-0.1.2/build $ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_INSTALL_PREFIX=../install .. $ cmake --build . --target install
These commands will install the Cilk header files in
cilkrts-0.1.2/install/include and the Cilk Plus runtime in
cilkrts-0.1.2/install/lib. You can adjust the installation directory by providing a different argument to the