Cilk Plus Installation Guide

From SuperTech Wiki

(Difference between revisions)
Jump to: navigation, search
(Added link to Intel Cilk Plus forum)
Line 3: Line 3:
* '''Online Resources'''
* '''Online Resources'''
# Open Source Cilk Plus Website: http://www.cilkplus.org/
# Open Source Cilk Plus Website: http://www.cilkplus.org/
 +
# Intel Cilk Plus Forum: http://software.intel.com/en-us/forums/intel-cilk-plus
* '''Installation'''
* '''Installation'''
Line 44: Line 45:
##: <code>$ export LIBRARY_PATH=path/to/gcc-cilk/lib </code>
##: <code>$ export LIBRARY_PATH=path/to/gcc-cilk/lib </code>
# '''Install Cilkview Cilkscreen:''' Get it from here: http://software.intel.com/en-us/articles/intel-cilk-plus-software-development-kit/.  The include bin directory in PATH.
# '''Install Cilkview Cilkscreen:''' Get it from here: http://software.intel.com/en-us/articles/intel-cilk-plus-software-development-kit/.  The include bin directory in PATH.
-
# '''Install Pintool:''' Download pintool from here: http://www.pintool.org/downloads.html. Install.  
+
# '''Install Pintool:''' Download Pin from here: http://www.pintool.org/downloads.html. Unpack the archive.
-
# '''Install Cilkprof:''' You need Pin revision 53271 in order to run Cilkprof.  These instructions include instructions on downloading and installing this version of Pin for Cilkprof.
+
# '''Install Cilkprof:''' These instructions include instructions on downloading and installing Pin for Cilkprof.  These instructions should work with the latest version of Pin, which is version 62141 at the time these instructions were last updated.  These instructions have not necessarily been tested on newer version of Pin, however.
-
## Change to the directory in which you would like to install Cilkprof.
+
## Change to the directory <code>cilkprof/install/dir</code> in which you would like to install Cilkprof.
-
## Create two new directories, <code>cilkutil</code> and <code>3rdparty</code>.
+
##: <code>$ cd cilkprof/install/dir</code>
 +
## Create a directory <code>3rdparty</code> inside of <code>cilkprof/install/dir</code>.
##: <code>$ mkdir cilkutil 3rdparty</code>
##: <code>$ mkdir cilkutil 3rdparty</code>
-
## Download Pin revision 53271 for Linux from http://www.pintool.org/downloads.html, and place the downloaded archive into <code>3rdparty</code>.
+
## Download Pin for Linux from http://www.pintool.org/downloads.html, and place the downloaded archive into <code>3rdparty</code>.
-
## Download libzca from http://cilkplus.org/download, and place the downloaded archive into <code>cilkutil</code>.
+
## Download libzca from http://cilkplus.org/download, and place the downloaded archive into the current directory, <code>cilkprof/install/dir</code>.
## Unpack the Pin archive inside of <code>3rdparty</code>.
## Unpack the Pin archive inside of <code>3rdparty</code>.
-
## Rename the folder created from unpacking the archive to <code>pintool</code>.
+
## Create a symbolic link called <code>pintool</code> to the directory created by unpacking the archive.
## If you do not have the necessary permissions to access the <code>intel64</code> subdirectory inside of <code>pintool</code>, run <code>$ chmod -R 755 intel64</code>.
## If you do not have the necessary permissions to access the <code>intel64</code> subdirectory inside of <code>pintool</code>, run <code>$ chmod -R 755 intel64</code>.
-
## Unpack the <code>libzca</code> archive inside of cilkutil.  This will produce a <code>zca</code> directory and a <code>cilkprof</code> directory.
+
## Unpack the <code>libzca</code> archive inside of <code>cilkprof/install/dir</code>.  Create a symbolic link called <code>cilkutil</code> to the directory created by unpacking this archive.
-
## Ensure you have the necessary permissions on the unpacked archive directories, using <code>chmod</code>.
+
## Build libzca and cilkprof.
-
##: <code>$ chmod -R 755 *</code>
+
##: <code>$ cd cilkutil</code>
-
## Build libzca.
+
-
##: <code>$ cd zca/src</code>
+
-
##: <code>$ make OUT=linux64</code>
+
-
## Build cilkprof.
+
-
##: <code>$ cd ../../cilkprof</code>
+
##: <code>$ make</code>
##: <code>$ make</code>
-
## Download the <code>cilkprof</code> script from http://web.mit.edu/neboat/www/code/cilkprof, and place it in a directory in your <code>PATH</code> environment variable.
+
## Download the <code>cilkprof</code> script from http://web.mit.edu/neboat/www/code/cilkprof, and place it in a directory in your <code>PATH</code> environment variable.  For example, place it within the same directory as <code>cilkview</code> and <code>cilkscreen</code>.
## Set the CILKUTIL environment variable to point to the <code>cilkutil</code> directory.  For example, if your shell is bash, add the line <code>export CILKUTIL=/path/to/cilkutil</code> to your <code>.bashrc</code>.
## Set the CILKUTIL environment variable to point to the <code>cilkutil</code> directory.  For example, if your shell is bash, add the line <code>export CILKUTIL=/path/to/cilkutil</code> to your <code>.bashrc</code>.
Line 71: Line 68:
** '''Check parallelism:''' <code>$ cilkview ./cilkprogram</code>
** '''Check parallelism:''' <code>$ cilkview ./cilkprogram</code>
** '''Check race condition:''' <code>$ cilkscreen ./cilkprogram</code>
** '''Check race condition:''' <code>$ cilkscreen ./cilkprogram</code>
-
** '''Pintool:''' TO BE COMPLETED
+
** '''Pintool:''' Please see the Pin manual, e.g. http://software.intel.com/sites/landingpage/pintool/docs/62141/Pin/html/.
** '''Linux perf tool:'''  
** '''Linux perf tool:'''  
*** Show list of counters:  <code>$ perf list</code>         
*** Show list of counters:  <code>$ perf list</code>         

Revision as of 13:26, 26 November 2013

Intel provides a suite of tools for programming Cilk-based programs. The tool set contains the Intel compiler ICC, the parallelism checker Cilkview, the race condition reporter Cilkscreen, the binary-level instrumentation gadget Pintool, the fine-level instrumentation tool Cilkprof. Here is a guide to install them on a 64-bit Linux.

  • Online Resources
  1. Open Source Cilk Plus Website: http://www.cilkplus.org/
  2. Intel Cilk Plus Forum: http://software.intel.com/en-us/forums/intel-cilk-plus
  • Installation
  1. Install ICC or GCC: You need a license from Intel® in order to install ICC. A free, open-source version is available in the cilkplus branch of GCC.
    • Installing ICC: These instructions assume your shell is bash.
    1. Go to http://software.intel.com/en-us/articles/intel-software-evaluation-center/.
    2. Select the Linux version of "Intel® C++ Composer XE" (or any Linux product suite listed as containing "Intel® C++ Composer XE") and download the 64-bit version.
    3. Unpack the downloaded file and run the installation script.
      $ /path/to/unpacked/file/install.sh.
      Note: To allow all users to access ICC on the system, run this install script as root.
    4. Follow the on-screen instructions to install ICC.
    5. Set up your environment variables to use ICC.
      $ source /path/to/intel/bin/compilervars.sh intel64.
    • Installing GCC: These instructions walk you through checking out and building the cilkplus branch of GCC. Complete instructions for building GCC from source can be found at http://gcc.gnu.org/install/index.html. These instructions will install GCC into a custom directory, gcc-cilk, so as not to overwrite the existing version of GCC on your system.
    Warning: This process takes a while and uses a couple gigabytes of space.
    1. Check out the latest version of the cilkplus branch of GCC.
      $ svn checkout svn://gcc.gnu.org/svn/gcc/branches/cilkplus gcc-cilk-src
      Note: I encountered problems with my connection timing out when I tried to check out the repository from http://gcc.gnu.org/svn/gcc/branches/cilkplus instead of svn://gcc.gnu.org/svn/gcc/branches/cilkplus. If you encounter similar problems, make sure you are using the "svn" protocol, instead of the "http" protocol. If you have previously checked out the gcc cilkplus source using "http," you can switch your checkout to use "svn" by running the following in the directory containing your checkout.
      $ svn switch --relocate http://gcc.gnu.org/svn/gcc/branches/cilkplus svn://gcc.gnu.org/svn/gcc/branches/cilkplus
    2. Alternatively, you may check out the repository using git:
      $ git clone git://gcc.gnu.org/git/gcc.git gcc-cilk-src
      $ cd gcc-cilk-src
      $ git checkout -b my_cilkplus_branch origin/cilkplus
      $ cd ..
    3. Create two new directories, gcc-cilk-obj and gcc-cilk, in the directory containing gcc-cilk-src.
      $ mkdir gcc-cilk-obj gcc-cilk
    4. Install gmp, mpfr, and mpc on your system. Make sure you have also installed bison, flex, and isl. In general, check http://gcc.gnu.org/install/prerequisites.html for the list of necessary prerequisites.
    5. Configure GCC as follows:
      $ cd gcc-cilk-obj
      $ ../gcc-cilk-src/configure --prefix=../gcc-cilk --enable-languages=c,c++
      Note:: You may want to add --disable-multilib to the configuration options if multilib is not installed on your system. Otherwise, you may encounter errors such as:
      gnu/stubs-32.h: No such file or directory compilation terminated.
    6. Compile GCC:
      $ make
    7. Install GCC into gcc-cilk:
      $ make install
    8. The new GCC binary is /path/to/gcc-cilk/bin/gcc.
    9. Set up environment!
      $ export PATH=path/to/gcc-cilk/bin:$PATH
      $ export LD_LIBRARY_PATH=path/to/gcc-cilk/lib
      $ export LIBRARY_PATH=path/to/gcc-cilk/lib
  2. Install Cilkview Cilkscreen: Get it from here: http://software.intel.com/en-us/articles/intel-cilk-plus-software-development-kit/. The include bin directory in PATH.
  3. Install Pintool: Download Pin from here: http://www.pintool.org/downloads.html. Unpack the archive.
  4. Install Cilkprof: These instructions include instructions on downloading and installing Pin for Cilkprof. These instructions should work with the latest version of Pin, which is version 62141 at the time these instructions were last updated. These instructions have not necessarily been tested on newer version of Pin, however.
    1. Change to the directory cilkprof/install/dir in which you would like to install Cilkprof.
      $ cd cilkprof/install/dir
    2. Create a directory 3rdparty inside of cilkprof/install/dir.
      $ mkdir cilkutil 3rdparty
    3. Download Pin for Linux from http://www.pintool.org/downloads.html, and place the downloaded archive into 3rdparty.
    4. Download libzca from http://cilkplus.org/download, and place the downloaded archive into the current directory, cilkprof/install/dir.
    5. Unpack the Pin archive inside of 3rdparty.
    6. Create a symbolic link called pintool to the directory created by unpacking the archive.
    7. If you do not have the necessary permissions to access the intel64 subdirectory inside of pintool, run $ chmod -R 755 intel64.
    8. Unpack the libzca archive inside of cilkprof/install/dir. Create a symbolic link called cilkutil to the directory created by unpacking this archive.
    9. Build libzca and cilkprof.
      $ cd cilkutil
      $ make
    10. Download the cilkprof script from http://web.mit.edu/neboat/www/code/cilkprof, and place it in a directory in your PATH environment variable. For example, place it within the same directory as cilkview and cilkscreen.
    11. Set the CILKUTIL environment variable to point to the cilkutil directory. For example, if your shell is bash, add the line export CILKUTIL=/path/to/cilkutil to your .bashrc.
  • Usage
    • Compile with ICC: $ icc cilkprogram.cpp -o cilkprogram
    • Compile with GCC: $ g++ cilkprogram.cpp -o cilkprogram -lcilkrts -ldl
    • Check parallelism: $ cilkview ./cilkprogram
    • Check race condition: $ cilkscreen ./cilkprogram
    • Pintool: Please see the Pin manual, e.g. http://software.intel.com/sites/landingpage/pintool/docs/62141/Pin/html/.
    • Linux perf tool:
      • Show list of counters: $ perf list
      • check L1 data load miss: $ perf stat -c L1-dcache-load-misses ./cilkprogram
    • Cilkprof: $ cilkprof ./cilkprogram
      • This command generates two csv output files, cilkprogram.bb.csv and cilkprogram.cc.csv, containing work and span profiling data for your Cilk program. At this time, the data in these files are most easily perused using your favorite spreadsheet program. For more information on configuring the output of Cilkprof, run $ cilkprof -h.
Personal tools
Members Only
Off Topic