Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6956 Discussions

Include MKL header file with oneapi/DPL, TBB error

Qigeng
Employee
822 Views

Hi,

I try to use MKL and DPL, when I include both header file in the same cpp file like this:

#include <oneapi/mkl.hpp>
#include <oneapi/dpl/execution>
#include <oneapi/dpl/algorithm>

There will be an error:

In file included from /opt/intel/oneapi/dpl/2021.5.0/linux/include/oneapi/dpl/execution:23:
In file included from /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/execution:32:
In file included from /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/pstl/glue_execution_defs.h:50:
In file included from /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/pstl/algorithm_impl.h:22:
In file included from /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/pstl/parallel_backend.h:16:
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/pstl/parallel_backend_tbb.h:70:10: error: no member named 'task' in namespace 'tbb'
tbb::task::self().group()->cancel_group_execution();

 

However, if i change the order:

#include <oneapi/dpl/execution>
#include <oneapi/dpl/algorithm>
#include <oneapi/mkl.hpp>

it can be built successfully.

Is it a bug? please confirm.

 

The attachment is my sample. You can run it by:

mkdir build && cd build
cmake ..
make

For my computer, the oneapi version is: 2021.4.0.3422

and system is: Linux tigerlake-i5-1135G7-qwerty 5.11.0-38-generic #42~20.04.1-Ubuntu

 

Thanks

0 Kudos
1 Solution
VidyalathaB_Intel
Moderator
799 Views

Hi,


Thanks for reaching out to us.


>> if i change the order...it can be built successfully.Is it a bug? please confirm.


Yes it is a known issue and it is already mentioned in oneTBB release notes


An application using Parallel STL algorithms in libstdc++ versions 9 and 10 may fail to compile due to incompatible interface changes between earlier versions of Threading Building Blocks (TBB) and oneAPI Threading Building Blocks (oneTBB).


Reordering of the header files is one way to avoid errors as you have mentioned  

and another way is to set the following macros PSTL_USE_PARALLEL_POLICIES (in libstdc++ 9) or _GLIBCXX_USE_TBB_PAR_BACKEND (in libstdc++ 10) to zero.


You can set these macros even during compilation as shown below

eg: dpcpp <filename> -DPSTL_USE_PARALLEL_POLICIES=0  # for libstdc++ 9

   dpcpp <filename> -D_GLIBCXX_USE_TBB_PAR_BACKEND=0 # for libstdc++ 10


Please refer to the below link for more details

https://www.intel.com/content/www/us/en/developer/articles/release-notes/intel-oneapi-threading-building-blocks-release-notes.html


Hope the provided information helps.


Regards,

Vidya.


View solution in original post

3 Replies
VidyalathaB_Intel
Moderator
800 Views

Hi,


Thanks for reaching out to us.


>> if i change the order...it can be built successfully.Is it a bug? please confirm.


Yes it is a known issue and it is already mentioned in oneTBB release notes


An application using Parallel STL algorithms in libstdc++ versions 9 and 10 may fail to compile due to incompatible interface changes between earlier versions of Threading Building Blocks (TBB) and oneAPI Threading Building Blocks (oneTBB).


Reordering of the header files is one way to avoid errors as you have mentioned  

and another way is to set the following macros PSTL_USE_PARALLEL_POLICIES (in libstdc++ 9) or _GLIBCXX_USE_TBB_PAR_BACKEND (in libstdc++ 10) to zero.


You can set these macros even during compilation as shown below

eg: dpcpp <filename> -DPSTL_USE_PARALLEL_POLICIES=0  # for libstdc++ 9

   dpcpp <filename> -D_GLIBCXX_USE_TBB_PAR_BACKEND=0 # for libstdc++ 10


Please refer to the below link for more details

https://www.intel.com/content/www/us/en/developer/articles/release-notes/intel-oneapi-threading-building-blocks-release-notes.html


Hope the provided information helps.


Regards,

Vidya.


Qigeng
Employee
787 Views

It can work now with -D_GLIBCXX_USE_TBB_PAR_BACKEND=0

Thanks for your support! 

0 Kudos
VidyalathaB_Intel
Moderator
783 Views

Hi,


Thanks for accepting our solution.


As the issue is resolved we are closing this thread. If you need any additional assistance from Intel, please post a new question as this thread will no longer be monitored.


Have a Nice Day!


Regards,

Vidya.


0 Kudos
Reply