Tutorial

  • 03/26/2021
  • Public Content

Building the Intel® Threading Building Blocks Version

To build the Intel® Threading Building Blocks (Intel® TBB) version, you will modify the sample application to use Intel® TBB and then compile the modified code. You will then run the application and then compare the time with the baseline performance time.
  1. Remove all of the files that were created when you build the serial version by running the following command:
    %make clean
  2. Open the source file
    src/build_with_tbb/build_with_tbb.cpp
    in your favorite code editor.
  3. Remove the comment marks for the Intel® TBB headers to declare the Intel® TBB functions that will be used in the sample application.
    #include "tbb/tbb.h"
  4. Remove the comment marks from the
    parallel_thread()
    function related to Intel® TBB implementation.
    • It calls the Intel® TBB
      parallel_for
      function. This function is where the parallelization call happens. The first two arguments in this function define the iteration space the loop executes along from
      starty
      to
      stopy
      . The third parameter is a C++11 lambda expression that lets the compiler do the tedious work of creating a function object.
  5. Add comment marks to the
    serial parallel_thread()
    function call since Intel® TBB version of
    parallel_for()
    function replaces this function.
  6. Build the sample by running the following command:
    %make tbb
The makefile automatically runs the sample after it is built.
Compare the time to render the image to the baseline performance time.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.