-
Notifications
You must be signed in to change notification settings - Fork 0
TBB: Thread Building Blocks
The suggested way to practice TBB in this class is trying to use the HPCLinux OVA image on VirtualBox. This is a ready to use environment. To show that, you can try to compile and run some TBB examples:
$ cp -r /opt/intel/composer_xe_2013_sp1.0.080/tbb/examples/ .
$ make -C examples/parallel_do/parallel_preorder/
If you prefer to install and run TBB on the real machine and you are running Linux, most likely TBB is already in the software repository of your Linux distribution. For example, on Debian Sid, simply run following commands:
$ apt-get install libtbb2 libtbb2-dev
This will install TBB headers and library binaries into standard directory, which means you don't need "-I" or "-L" when invoke g++.
Next option is to download and unzip the pre-compiled binary package from TBB Website. As TBB is just a library, to use it you just need to let the compiler know where to find the TBB header files and library binaries. For gcc, you need to use "-I", "-L" and "-l" options.
TBB comes with a script which helps you setup some environment variables so you don't need to use those compiler options explicitly. In other words, instead of
$ g++ -I<TBB_header_dir> -L<TBB_lib_dir> <your_tbb_program.cpp> -ltbb
You can simply do this:
$ source <TBB_ROOTDIR>/bin/tbbvars.sh
$ g++ <your_tbb_program.cpp> -ltbb
tbbvars.sh is a very simple script. You may want to read it to understand how it works.
The official TBB tutorial is a very good reference for the student as it covers mostly every aspect of TBB. It's well organized and rich with examples.