Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2424 Discussions

Predefined macro from compiler to detect if TBB is on?

Sergey_K_Intel
Employee
140 Views

Hi,

Is there some definition from compiler or TBB include files to use in source code conditional compilation statements for TBB/non-TBB variants?

For example,

#if defined(TBB_<some_macro>)
... TBB-based code
#else
... non TBB-based code
#endif

This is not to add own definitions.

0 Kudos
2 Replies
Vladimir_P_Intel2
140 Views
Sergey_K_Intel
Employee
140 Views

This works only after any of TBB include files got to preprocessor.

I probably formulated my question wrong, sorry, but I wanted to determine if user turned "Intel Performance Libraries\TBB" option in IDE to "Yes", or no.

For example, how it is in general compiler, #ifdef _WIN32 use Windows source code, if not - use Linux.

I.e.
#if defined(TBB_IS_ON) // This is for example, not a real macro ))
#include <tbb/parallel_for.h>
... other TBB stuff...
#else
...use my own multi-threading...
#endif
 

Reply