How to use and/or install Cilk

This page will show you how to use Cilk, and perhaps install it on your own system.

The Cilk Programmer's Guide is available here.

The first thing to be aware of is that Cilk will only run on Linux or Windows. If you're using anything else, you should do your development on a Linux system. Both CSIL and Triton will suffice for this.

Installing (Linux - Windows) - Setting up the environment


Installing Cilk on Linux

If you're running anything that's not Linux on x86 or x86_64, give up now. Cilk is only available in binary form, so you're not going to have good luck getting it to run.

Assuming you have a reasonably modern distribution, you should already have the necessary libraries installed. You can get the Cilk SDK from here. Download this somewhere.

Now, you can choose where you want to install your copy of Cilk. I would recommend putting it in its own folder so you can remove it with ease at some point in the future. Here's how I installed it:

varad@orion:~$ ls -l cilk_8503-i686.release.tar.gz 
-rw-r--r-- 1 varad varad 51683394 2012-04-29 01:18 cilk_8503-i686.release.tar.gz
varad@orion:~$ tar xzf cilk_8503-i686.release.tar.gz 
varad@orion:~$ ls -l cilk/
total 52
drwxr-xr-x  2 varad varad 4096 2009-10-22 09:07 bin
drwxr-xr-x  2 varad varad 4096 2009-10-22 09:07 doc
drwxr-xr-x 16 varad varad 4096 2009-10-22 08:38 examples
drwxr-xr-x  4 varad varad 4096 2009-10-22 09:06 include
drwxr-xr-x  2 varad varad 4096 2009-10-22 09:06 info
drwxr-xr-x  3 varad varad 4096 2009-10-22 09:06 lib
drwxr-xr-x  2 varad varad 4096 2009-10-22 09:07 lib32
drwxr-xr-x  2 varad varad 4096 2009-10-22 09:07 lib64
drwxr-xr-x  3 varad varad 4096 2009-10-22 09:06 libexec
-rw-r--r--  1 varad varad 4918 2009-10-16 08:07 LICENSE
drwxr-xr-x  4 varad varad 4096 2009-10-22 09:06 man
drwxr-xr-x  4 varad varad 4096 2009-10-22 09:07 share
varad@orion:~$
varad@orion:~$ export PATH=$PATH:~/cilk/bin/
varad@orion:~$ cilk++
cilk++: no input files
varad@orion:~$

The archive will extract into a directory named cilk. So, I've installed my copy to ~/cilk. This is the path you need when setting up your environment so you can compile Cilk programs.

Installing Cilk on Windows

You can actually install Cilk on Windows. The SDK is available here. I haven't tried it, and I don't particularly recommend it, but you can attempt to use it at your own risk. If it does work, let me now.


Setting up your environment to use Cilk

The first thing you need to do is know where the Cilk binaries are installed. If you're using your own system, you should already know.

The next thing we need to do is to add the Cilk binaries into our path. If you're using bash, you can set the path in your current shell by running export PATH=/path/to/cilk/bin:$PATH

You can also add the Cilk binary path to your bash profile, but I don't recommend it because it will replace your normal gcc with their own.

At this point, you should be able to try out a test program to make sure everything is working. There is an example available here.

Compile and run like so:

vrd@csil:~$ cilk++ cilkexample.c -o cilkexample
vrd@csil:~$ ./cilkexample 
Got 10 5, expecting 10 5
vrd@csil:~$

You also have cilkscreen available for debugging. Details on how to use this are forthcoming.