OpenMP and POSIX threads on Linux*

OpenMP and POSIX threads on Linux*

Ritratto di pbkenned

To what extent is Intel's implementation of OpenMP on Linux* based on Pthreads? When I look at the code generated by Intel C++ or Fortran with -openmp, I see a lot of __kmpc* calls such as:
call __kmpc_fork_call

I know these are implemented in the compiler OpenMP lib:
/opt/intel/compiler70/ia32/lib/libguide.a

But there is a lot of functionality added by the compiler, over and above what is provided by Pthreads. For example, the Fork-Join model with parallel region master and slave threads -- there is no such concept in Phreads. With Pthreads, all threads are peers.

Are the __kmpc* calls implemented on top of Pthreads, or are they essentially a unique, low-level threading API?

thanks,
patrick

2 post / 0 new
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione
Ritratto di Henry Gabb (Intel)

Hi Patrick,
The Intel OpenMP implementation for Linux is based on Pthreads. In general, the kmpc_* calls wrap Pthreads functions. The compiler turns OpenMP directives into theaded code but it really doesn't add any functionality that isn't available in the Pthreads library.

It's true that with Pthreads all threads are peers. There's no master-worker relationship between threads unless the programmer chooses to code that way. Thread libraries (e.g., Pthreads) are designed to be flexible and general. OpenMP, which is designed to express data parallelism, is explicitly master-worker.

Henry

Accedere per lasciare un commento.