0

In oneTBB, the number of tasks running in parallel are taken care of by the library to ensure the number of activated threads not exceeding hardware limit. And it also states that the nested parallelism introduced by nested calls to built-in functions like parallel_for,parallel_reduce is also properly managed.

I am to working on a project in which legacy parallel code based on OpenMP shall be reused, will oneTBB trace the threads spawned by omp calls too? If so, how is it achived?

If we switch from LIBBLAS and fftw to oneMKL, will this issue be addressed?

I cannot find documentation on this specific topic, you can simply post some urls, I will conclude and add an answer when I finish reading them.

Scriabin
  • 21
  • 6
  • 1
    I do not think TBB are doing anything special with threads and certainly not any "tracing". TBB just care to avoid over-subscribtion. BLAS libraries like OpenBLAS or the MKL are parallel by default so you should not call level 3 functions (eg. matrix multiplications) in a parallel code. If you need to, then please configure the BLAS implementation so to use 1 thread. OpenMP can also be tuned so to do so (`OMP_NUM_THREADS=1`). Nesting can also be controlled (but TBB and OpenMP thread do not see each other AFAIK). – Jérôme Richard Jul 09 '22 at 14:52
  • @JérômeRichard "MKL are parallel by default" depends on whether you link the `lp64` or `ilp64` library, not? – Victor Eijkhout Jul 15 '22 at 13:03
  • @VictorEijkhout the LP64 vs ILP64 version looks related to the 32-bit vs 64-bit ABI/architecture and not related to the use of multiple threads (see [here](https://www.intel.com/content/www/us/en/develop/documentation/onemkl-windows-developer-guide/top/linking-your-application-with-onemkl/linking-in-detail/linking-with-interface-libraries/using-the-ilp64-interface-vs-lp64-interface.html)). There is a sequential version (see the "Linking with Threading Libraries" section -- Intel links are too long...) but it is clearly indicated as `_sequential_` and it should not be used by default AFAIK. – Jérôme Richard Jul 15 '22 at 13:19

1 Answers1

0

oneTBB task scheduler will be automatically initialized and on runtime take care of the number of threads to use. It's not easy to find out how many worker threads exist or are executing tasks at any given time.

We can merge bothh OpenMP and oneTBB code but oneTBB cannot trace openMP threads.

Please refer to the below link:

https://oneapi-src.github.io/oneTBB/main/tbb_userguide/appendix_B.html

oneMKL uses any one of the threading layers either OpenMP or oneTBB. By default oneMKL uses sequential way. Refer to below links for threading layers in oneMKL:

https://www.intel.com/content/www/us/en/develop/documentation/onemkl-linux-developer-guide/top/linking-your-application-with-onemkl/linking-in-detail/linking-with-threading-libraries.html

https://www.intel.com/content/www/us/en/develop/documentation/onemkl-linux-developer-guide/top/linking-your-application-with-onemkl/linking-in-detail/dynamic-select-the-interface-and-threading-layer.html

  • Many thanks, so I'd better use oneMKL to do multithreading as long as it supports, and not to mix different tools. – Scriabin Aug 04 '22 at 09:33