What's a high-level description of OpenMP?
The Wikipedia article states that "OpenMP (Open Multi-Processing) is an application programming interface (API) that supports multi-platform shared memory multiprocessing programming in C, C++ and Fortran on many architectures, including Unix and Microsoft Windows platforms. It consists of a set of compiler directives, library routines, and environment variables that influence run-time behavior." What?
How does it compare to other approaches to concurrency, like threads, thread-pools, and work-stealing?
It's a set of extensions to provide C/C++ with the ability to run certain parts of the code in parallel, without explicitly managing (creating, destroying, assigning) threads.
It basically abstract you from the complexity of managing threads your self by allowing you to declaratively run certain portions of your code in parallel. A code sample always help:
# pragma omp parallel \
shared ( n, x, y ) \
private ( i ) \
reduction ( + : xdoty )
# pragma omp for
for ( i = 0; i < n; i++ )
{
xdoty = xdoty + x[i] * y[i];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With