- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#include <iostream>
#include <vector>
#include <pstl/execution>
#include <pstl/algorithm>
int main() {
std::vector<std::string> v = {" Hello ", " Parallel STL!"};
std::for_each(pstl::execution::par, v.begin(), v.end(),
[](std::st))
}
#include <iostream>
#include <vector>
#include <oneapi/dpl/algorithm>
#include <oneapi/dpl/execution>
int main() {
std::vector<std::string> v = { " Hello ", " Parallel STL! " };
std::for_each(dpl::execution::par, v.begin(), v.end(),
[](std::string& s) { std::cout << s << std::endl; }
);
return 0;
}
g++ -std=c++2a fig_1_05.cpp -ltbb
In file included from /usr/local/include/c++/10.2.0/pstl/parallel_backend.h:16,
from /usr/local/include/c++/10.2.0/pstl/algorithm_impl.h:22,
from /usr/local/include/c++/10.2.0/pstl/glue_execution_defs.h:50,
from /usr/local/include/c++/10.2.0/execution:32,
from /opt/intel/oneapi/dpl/2021.1.2/linux/include/oneapi/dpl/execution:32,
from fig_1_05.cpp:28:
/usr/local/include/c++/10.2.0/pstl/parallel_backend_tbb.h: In function 'void __pstl::__par_backend::__cancel_execution()':
/usr/local/include/c++/10.2.0/pstl/parallel_backend_tbb.h:70:10: error: 'tbb::task' has not been declared
70 | tbb::task::self().group()->cancel_group_execution();
|
// Wrapper for tbb::task
inline void
__cancel_execution()
{
tbb::task::self().group()->cancel_group_execution();
}
// Wrapper for tbb::task
inline void
__cancel_execution()
{
#if TBB_INTERFACE_VERSION <= 12000
tbb::task::self().group()->cancel_group_execution();
#else
tbb::task::current_context()->cancel_group_execution();
#endif
}
$ g++ -std=c++11 fig_1_05.cpp -ltbb
In file included from /opt/intel/oneapi/dpl/2021.1.2/linux/include/oneapi/dpl/internal/exclusive_scan_by_segment_impl.h:22,
from /opt/intel/oneapi/dpl/2021.1.2/linux/include/oneapi/dpl/execution:44,
from fig_1_05.cpp:28:
/opt/intel/oneapi/dpl/2021.1.2/linux/include/oneapi/dpl/internal/function.h:62:20: error: 'oneapi::dpl::__par_backend' has not been declared
62 | using oneapi::dpl::__par_backend::__buffer;
| ^~~~~~~~~~~~~
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us!
We are escalating this thread to the Subject Matter Expert (SME) who will guide you further.
Have a Good day!
Thanks & Regards
Goutham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the Pro TBB book was published before new TBB revamp effort finalized -- incidentally at the same time as oneTBB project was underway. Many examples from the book do not compile anymore. You can see revamp document describing old TBB API and new TBB API at https://software.intel.com/content/www/us/en/develop/articles/tbb-revamp.html -- look for pdf doc link there. In particular tbb:: task API got deprecated which maybe a reason for the errors you see. However, PSTL code you use still should compile in my view -- so it is worth further investigation on our side -- I emailed your question internally.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
corrected version below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a known oneTBB issue because 2021.1.1 is not compatible with older TBB interfaces that GCC 10.2 relies on -- “New in 2021.1-beta10 Release” at https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-threading-building-blocks-release-notes.html:
Known Limitations
· An application using Parallel STL algorithms in GCC 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). Disable support for Parallel STL algorithms by defining PSTL_USE_PARALLEL_POLICIES (in GCC 9) or _GLIBCXX_USE_TBB_PAR_BACKEND (in GCC 10) macro to zero before inclusion of the first standard header file in each translation unit.
One option is to revert to an older TBB before trying to use PSTL in GCC.
you can also try the following workaround -- try to reorder the included headers:
include the oneDPL headers first,
and other STL headers second.
it was know to help in similar situation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After defining _GLIBCXX_USE_TBB_PAR_BACKEND to zero and reordering the included headers:
#define _GLIBCXX_USE_TBB_PAR_BACKEND 0
#include <oneapi/dpl/algorithm>
#include <oneapi/dpl/execution>
#include <iostream>
#include <vector>
int main() {
std::vector<std::string> v = { " Hello ", " Parallel STL! " };
std::for_each(dpl::execution::par, v.begin(), v.end(),
[](std::string& s) { std::cout << s << std::endl; }
);
return 0;
}
I got another error I have mentioned before:
$ g++ -std=c++2a fig_1_05.cpp -ltbb
In file included from /opt/intel/oneapi/dpl/2021.1.2/linux/include/oneapi/dpl/internal/exclusive_scan_by_segment_impl.h:22,
from /opt/intel/oneapi/dpl/2021.1.2/linux/include/oneapi/dpl/execution:44,
from fig_1_05.cpp:29:
/opt/intel/oneapi/dpl/2021.1.2/linux/include/oneapi/dpl/internal/function.h:62:20: error: 'oneapi::dpl::__par_backend' has not been declared
62 | using oneapi::dpl::__par_backend::__buffer;
|
......
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found the solution to fix "'oneapi::dpl::__par_backend' has not been declared" error:
#include <oneapi/dpl/execution>
#include <oneapi/dpl/algorithm>
#include <iostream>
#include <vector>
int main() {
std::vector<std::string> v = { " Hello ", " Parallel STL! " };
std::for_each(dpl::execution::par, v.begin(), v.end(),
[](std::string& s) { std::cout << s << std::endl; }
);
return 0;
}
After exchanging <oneapi/dpl/execution> and <oneapi/dpl/algorithm>, everything is ok.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page