Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

OpenMP and POSIX threads on Linux*

pbkenned1
Employee
782 Views
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
0 Kudos
1 Reply
Henry_G_Intel
Employee
782 Views
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
0 Kudos
Reply