I have a C++ program which is working quite well using OpenMP to parallelize loops.
However, there are some pieces of code—those which employ queues and priority queues and the like—which would only work in parallel if I declared access to them critical.
An alternative option would be to use TBB data objects, such as concurrent_queue. But can I use these data objects with OpenMP and without any of the rest of the TBB?
Sources and links appreciated.
Thanks!
Update
For instance, is the following kind of mix of TBB and OpenMP allowed?
concurrent_queue<int> queue;
#pragma omp parallel for
for( int i=0; i<1000; i++ )
queue.push(i);
To complement others’ answers, the info you are looking for can also be found in the TBB Tutorial (see latest TBB documentation). A couple of excerpts:
–