Updated 2021-05-17

Use TBB on the Cluster

Summary

  • Use module avail tbb and module avail intel to see all the versions of intel compilers and TBB available on the cluster
  • Load the version of the intel compilers you want in your PBS script with module load intel/<version number>. module load intel loads the default version.
  • Load the version of the TBB you want in your PBS script with module load tbb/<version number>. module load tbb loads the default version.
  • In your PBS script, after the lines for loading the correct modules, compile your C++ program with icc
  • Then below that line, execute the C++ program
  • Submit the job with qsub <.pbs filename> and collect results

Walkthrough: Use TBB on the Cluster

  • This walkthrough will use a simple C++ program that imports a header file from the TBB library and prints a string
  • Example C program: tbb_example.cpp
  • PBS Script: tbb.pbs
  • To follow along, manually copy these files into the same directory in your account on the cluster, or transfer them to your account (again put them in the same folder).

Part 1: The PBS Script

#PBS -N tbbTest
#PBS -A [Account]
#PBS -l nodes=1:ppn=2
#PBS -l walltime=1:00
#PBS -q inferno
#PBS -j oe
#PBS -o tbb.out

cd $PBS_O_WORKDIR
module load intel
module load tbb
icc tbb_example.cpp -o example
./example
  • The #PBS directives are standard, requesting just 1 minute of walltime and 1 node with 2 cores. More on #PBS directives can be found in the PBS guide
  • $PBS_O_WORKDIR is simply a variable that represents the directory you submit the PBS script from. Make sure the .cpp file you want to run is in the same directory you put the PBS script. Otherwise, the C++ program wont be found when the job is run.

Important

Output Files, such as the resulting executable, will also show up in the same directory as the PBS script

  • The module load lines load gcc (compiler) and gsl.
  • The icc line compiles the C++ program into an executable called example .
  • ./example runs the program

Part 2: Submit Job and Check Status

  • Make sure you're in the directory that contains the PBS script and the .cpp file
  • Submit as normal, with qsub <pbs script name>. In this case qsub tbb.pbs
  • Check job status with qstat -u username3 -n, replacing "username3" with your gtusername
  • You can delete the job with qdel 22182721, replacing the number with the jobid returned after running qsub

Part 3: Collecting Results

  • In the directory where you submitted the PBS script, you should see a couple of newly generated files, including example and tbb.out
  • example is the executable file created
  • tbb.out contains the results of the job
  • Open tbb.out with vim tbb.out (you can use any text editor).
  • The output should contain the result of the computation:
Job name:   tbbTest
Queue:      inferno
End PBS Prologue Fri Nov 30 10:07:38 EST 2018
---------------------------------------
Simple test importing tbb
---------------------------------------
Begin PBS Epilogue Fri Nov 30 10:07:39 EST 2018
Job ID:     23019307.shared-sched.pace.gatech.edu
  • After the result files are produced, you can move the out file as well as any other files off the cluster. Refer to the file transfer guide for help.
  • Congratulations! You successfully used TBB on the cluster.