OpenMP Tutorial: https://computing.llnl.gov/tutorials/openMP/#ProgrammingModel
Understanding the OpenMP programming model is the first step in learning OpenMP.
(1) shared memory, thread based Parallelism:
OpenMP is a parallel model based on shared memory and threads.
(2) Explain It Parallelism:
OpenMP is clear about parallelism rather than automatic parallelism. Provide parallelFull Control.
(3) fork-join model:
OpenMP uses the classic fork-join model, as shown in:
Therefore, all OpenMPProgramIt starts from a main thread, and creates a group of tasks in parallel through the main thread, and then performs synchronization.
PS: It seems that common thread models are fork/join models?
(4) compiler directive based:
OpenMP is based on compiler instructions. By inserting compiler instructions in the source code, the compiler is told how to perform parallelization. Therefore, OpenMP depends on the implementation of the compiler.
(5) nested parallelism support:
Nested parallelization is supported. However, whether or not nested parallelization is supported depends on the compiler.
(6) dynamic threads
Dynamically modify the number of threads. The number of threads in the parallel zone can be dynamically modified. Depends on the compiler implementation.
(7) I/O
OpenMP is not responsible for Io parallelization, so developers must ensure their own Io contention. For example, when multiple threads read the same file at the same time.
(8) Memory Model: flush often?
Memory Model, whether to refresh frequently. OpenMP is a "relaxed-consistency" and "temporary" View Mode for thread memory, that is, the thread can cache its own data and does not necessarily need to ensure real-time consistency with the actual memory. Therefore, if shared data requires real-time consistency, developers must refresh the data on their own to ensure data consistency of each thread.