-

hey viewer, we're moving!

We are currently transitioning to a new web system, so we are not updating this wikisite anymore.

The public part of the new web system is available at http://www.ira.disco.unimib.it


TBB

From Irawiki

Jump to: navigation, search

IntelĀ® Threading Building Blocks Howto

IntelĀ® Threading Building Blocks (Intel TBB) offers a rich and complete approach to expressing parallelism in a C++ program. It is a library that helps you take advantage of multi-core processor performance without having to be a threading expert. Intel TBB is not just a threads-replacement library. It represents a higher-level, task-based parallelism that abstracts platform details and threading mechanisms for scalability and performance. For more info http://threadingbuildingblocks.org/

Download and setup on a typical Iralab machine

  • Download the latest stable release of TBB form http://threadingbuildingblocks.org/download.php (in this tutorial i'll use TBB 4.0 update 2, tbb40_20111130oss_lin.tgz)
  • decompress the archive in /opt/tbb40_20111130oss
  • mode into and set eXec flag on tbbvars.sh /opt/tbb40_20111130oss/bin
ballardini@epicicloidale:/opt/tbb40_20111130oss/bin$ sudo chmod +x tbbvars.sh 
  • open that script
ballardini@epicicloidale:/opt/tbb40_20111130oss/bin$ vim tbbvars.sh
  • goto line 42 (or similar, search for SUBSTITUTE_INSTALL_DIR_HERE) and update this string
...
export TBBROOT=/opt/tbb40_20111130oss
...

change ia32 here

get_ia32(){
        echo SUBSTITUTE_IA32_ARCH_HERE
}

in

get_ia32(){
        echo cc4.1.0_libc2.4_kernel2.6.16.21
}

get the string <cc4.1.0_libc2.4_kernel2.6.16.21> from /opt/tbb40_20111130oss/lib/ia32 

save and close

  • goto home and open bashrc.sh, then append at the end of the file the following line
source /opt/tbb40_20111130oss/bin/tbbvars.sh ia32
  • change directory to
/opt/tbb40_20111130oss/examples/GettingStarted/sub_string_finder

and try to compile with make, if it's all ok you'll see something like this

ballardini@epicicloidale:/opt/tbb40_20111130oss/examples/GettingStarted/sub_string_finder$ make
g++ -O2 -DNDEBUG  -o sub_string_finder sub_string_finder.cpp -ltbb -lrt 
g++ -O2 -DNDEBUG  -o sub_string_finder_extended sub_string_finder_extended.cpp -ltbb -lrt 
g++ -O2 -DNDEBUG  -o sub_string_finder_pretty sub_string_finder_pretty.cpp -ltbb -lrt 
./sub_string_finder_extended 
 Done building string.
 Done with serial version.
 Done with parallel version.
 Done validating results.
Serial version ran in 8.22307 seconds
Parallel version ran in 7.58046 seconds
Resulting in a speedup of 1.08477
ballardini@epicicloidale:/opt/tbb40_20111130oss/examples/GettingStarted/sub_string_finder$
Personal tools