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 start the application and then compare the time with the baseline performance time.
- Set thebuild_with_tbbproject as the startup project.
- For projectbuild_with_tbb, change the compiler to the Intel® C++ Compiler (Project > Intel Compiler > Use Intel C++).
- For the projectbuild_with_tbbclickProject > Properties > Intel Performance Libraries > Intel® Threading Building Blocks > Use Intel® TBB (Yes)to set the Intel® TBB environment variables. The environment variables that are set is defined in Notes section.
- Open the source filetachyon.tbb.cppin the projectbuild_with_tbb.
- Remove the comment marks for the Intel® TBB headers to declare the Intel® TBB functions that will be used in the sample application as given below.#include <tbb/tbb.h>
- Make the following changes in theparallel_threadfunction.
- Convert the serial function with a loop that is to be parallelized to a function object that Intel® TBB algorithms (in this caseparallel forwill use. The function body needs to be moved into a C++11 lambda function passed to the Intel® TBBparallel for.
- Move the iteration-independent value ofmboxsizeout of the loop.
- Remove the validity check ofvideo->next_frame.
- Exiting a loop in the middle of a parallelized loop is not permitted.
- Check against the complete change shown intachyon.tbb_solution.cpp.
- Buildbuild_with_tbbin release configuration.
The makefile automatically runs the sample after it is built.
Compare the time to render the image to the baseline performance time.
- If Microsoft* Visual Studio cannot find the Intel® TBB header files, clickProject > Properties > Configuration Properties > C/C++ > General > Additional Include Directoriesand add a path to the.<install-dir>\tbb\include
- If Microsoft* Visual Studio cannot find the Intel® TBB libraries at link time, clickProject > Properties > Configuration Properties > Linker > General > Additional Library Directoriesand add a path to the<install-dir>\redist\tbb\vc_mt