Open Multi-Processing (OpenMP)

Open multi-processing (OpenMP) is a standard, shared-memory, multi-processing application program interface (API) for shared-memory parallelism. OpenMP is an add-on in a compiler. It provides a set of compiler directives, environment variables, and runtime library routines for threads creation, management, and synchronization. When a parallel region executes, the program creates a number of threads running concurrently. With OpenMP, forked threads have access to shared memory. For more details, visit the OpenMP home page.

openMP.png

MPI Versus OpenMP

The following is a list of the most common differences between MPI and OpenMP.

MPI OpenMP

Available from different vendors and gets compiled on Windows, macOS, and Linux operating systems..

An add-on in a compiler such as a GNU compiler and Intel compiler.

Supports parallel computation for distributed-memory and shared-memory systems.

Supports parallel computation for shared-memory systems only.

A process-based parallelism.

A thread-based parallelism.

With MPI, each process has its own memory space and executes independently from the other processes.

With OpenMP, threads share the same resources and access shared memory.

Processes exchange data by passing messages to each other.

There is no notion of message-passing. Threads access shared memory.

Process creation overhead occurs one time.

It depends on the implementation. More overhead can occur when creating threads to join a task.