Skip to content
Stephanie edited this page Jan 21, 2014 · 7 revisions

Download

http://parallelbook.com/instructor OR http://parallelbook.com/student have the same links.
*This page is built upon version 3 of the code time stamped on November 13, 2013.


Prerequisites

This section lists prerequisite software required to build and run the examples.

Compiler

To compile all of the examples requires a compiler supporting:

  • Cilk Plus
  • OpenMP 3.0 or later
  • C++11 lambda expressions

Currently supported compilers are:

Compiler Comment
Intel C++ compiler, version 13.0 or later Version 13.0 or later can compile all of the examples.
g++ 4.5.1 or later Cannot compile Cilk Plus examples.
gcc 4.7 branch with Cilk Plus Should be able to compile all of the examples.
Visual Studio 2010 or later Can compile only the TBB examples.

Conditional compilation directives will automatically omit code that these compilers cannot handle.

Libraries

You need Intel Threading Building Blocks (TBB), because the examples use TBB's portable tbb::tick_count to do timing. TBB is distributed with the Intel compiler, and or open-source version can be downloaded. The makefiles assume your environment is set up so that your compiler can find the TBB include files and run-time library. On Linux and MacOS, you can do this setup by running the script tbb/bin/tbbvars.sh or sourcing the script tbb/bin/tbbvars.csh, depending on which shell you are using. Those scripts are part of TBB and not part of this package.
The Cholesky Factorization example requires a Basic Linear Algebra Subroutines (BLAS) library.

Other Tools

Linux and Mac OS systems typically have the other prerequisites. Windows users may have to acquire a few extra tools:

GNU make GNU make is required to build the examples.
Python Required to run the top-level Makefile that builds all the examples. Python is not required for building individual examples.

Building and Running

Using Makefiles

Makefiles are provided. They should work on Linux, Mac OS, or Windows. They include config/config.inc, which describes the compiler options to be used. Near the top of this file is a choice of lines that set CPLUS. Uncomment the one that matches your compiler.
The top level Makefile in this directory does the same action for all examples. The supported actions are:

Command Effect
make run Run all examples. Builds any examples that are not yet built.
make build Build all examples
make clean Remove all binaries and object files

These commands can be applied to a single example, say foo, by:

  1. cd to src/foo/*/build/
  2. Run make there.

Files and Subdirectories

src/ Source files
tools/ Python script for running all of the Makefiles
config/config.inc Configuration file inherited by Makefiles

Index

The Listing numbers match those in the book.

Listings Summary
5.16 Scan implemented in OpenMP
8.9-8.13 Quicksort
8.17-8.20 Scan and pack patterns implemented using fork-join
9.1-9.4 Pipeline examples
10.1,10.3,10.42 Forward Seismic Simulation
11.1-11.8 K-Means Clustering
13.1-13.4 Merge Sort
14.1-14.4 Sample Sort
15.1-15.3 Cholesky Factorization
Clone this wiki locally