Page 1 of 1

openmp interoperability with std::thread, posix_threads, QThread, etc.

Posted: Tue Feb 02, 2021 6:59 am
by sena_at_s73
Hello OpenMP people,

What is the current state of interoperability of OpenMP with other threading frameworks? Can not find that in manuals. I searched also the OpenMP forum and found only that statement from 2009:
Neither OpenMP nor pthreads has defined the behavior when you use one
under the other. The OpenMP committee has on its long-term goals to
define the interaction of OpenMP threads with other threading models,
in particular Posix threads, but we haven't done that yet.
viewtopic.php?p=2556&sid=7825407ea75c54 ... 70a1#p2556

Is it still true or something was improved since that time?

Can I safely start, for example, two parallel std::thread/pthread and use OpenMP inside both of them? What about std::atomic usage? QThread?

Environment is: linux, x86, g++, c++17 at the moment.

Background:

We start using openmp for the relatively big project. First experience was quite positive except for some problems with threading. We want to extend the usage to other project parts, which incudes GUI apps with Qt QThread, networking with posix_threads etc. Another candidate is Intel's TBB, which I believe must not have any interoperability problems with std::thread.