Mixing OpenMP with other threading paradigms #4332
-
Regarding the compilation options, does it make sense to enable both In the file #if (defined(SMP) || defined(USE_LOCKING)) && !defined(USE_OPENMP)
...
#endif is often used. Will this cause any issues? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes this can/should both be enabled and USE_THREAD is on by default when you have more than one core in the build system. On many/most platforms, OpenMP is implemented on top of pthreads anyway. |
Beta Was this translation helpful? Give feedback.
Yes this can/should both be enabled and USE_THREAD is on by default when you have more than one core in the build system. On many/most platforms, OpenMP is implemented on top of pthreads anyway.
Only use USE_THREAD=0 (on its own) when you want an OpenBLAS that does not use any form of multithreading at all (which can make sense if you have a big multithreaded program that makes many parallel calls to BLAS functions).
The directive you quoted is basically "if we are using multithreading, or expect to be called by multiple threads from outside, and we do not have OpenMP manage the locking for thread-safe concurrent accesses"