c++parallel-processingexecutionstdtbb

does including <execution> require linking against tbb?


In my project on a Ubuntu 20 platform (with g++ 9.3.0), I use the following line

#include <execution>

to support parallel processing via standard library functions. I don't include anything from TBB, the parallel execution library from Intel. But then when I build the program I get the message:

/usr/bin/ld: CMakeFiles/probis.dir/src/probis.cpp.o: in function `tbb::interface7::task_arena::current_thread_index()':
/usr/include/tbb/task_arena.h:449: undefined reference to `tbb::interface7::internal::task_arena_base::internal_current_slot()'

This is easy enough to solve (as in: make the message go away) by adding -ltbb to the linker line. But then I have a dependency on libtbb that I did not count on.

Is this dependency expected? Is it possible to use parallel execution without installing tbb (but that tbb overrides the default setting when it is installed)?


Solution

  • As @[n. 'pronouns' m.] rightly said, you may need libtbb in order to make your code work. You can download the Intel® oneAPI Base Toolkit which contains TBB as one of the components. Link to download Intel® oneAPI Base Toolkit: https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit/download.html