OpenMP tutorial learning notes (2) OpenMP Programming Model

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.