| 1 | = OpenMP = |
| 2 | |
| 3 | * What is OpenMP? |
| 4 | * The OpenMP is an Application Program Interface (API) that supports shared-memory parallel programming. |
| 5 | * What is the shared-memory? |
| 6 | * The memory space that is accessible from multiple CPUs without an operating system call involvement. |
| 7 | * Limitation |
| 8 | * The number of CPUs on a single compute node bounds the number of threads. (<->Distributed Memory Cluster) |
| 9 | |
| 10 | |
| 11 | == A Programmer’s View of OpenMP == |
| 12 | * OpenMP is a portable, threaded, shared-memory programming specification with “light” syntax |
| 13 | * Exact behavior depends on OpenMP implementation! |
| 14 | * Requires compiler support (C or Fortran) |
| 15 | * OpenMP will: |
| 16 | * Allow a programmer to separate a program into serial regions and parallel regions. |
| 17 | * OpenMP will not: |
| 18 | * Parallelize automatically |
| 19 | * Guarantee speedup |
| 20 | |
| 21 | == OpenMP's Execution Model == |
| 22 | * OpenMP is built around a shared memory space and generates concurrent threads – this is how the parallelism is facilitated. |
| 23 | * CPUs that share memory are called “symmetric multi-processors”, or SMP for short. |
| 24 | * Each thread is typically run on its own processor, though it is becoming common for each CPU or “core” to handle more than one thread “simultaneously”; this is called “hyper-threading”. |
| 25 | * Thread (process) communication is implicit, and uses variables pointing to shared memory locations; this is in contrast with MPI, which uses explicit messages passed among processes. |
| 26 | * These days, most major compilers do support OpenMP directives for most platforms (IBM's XL suite, Intel, even GCC ≥ 4.2). |
| 27 | * A fork is when a single thread is made into multiple, concurrently executing threads. |
| 28 | * A join is when the concurrently executing threads synchronize back into a single thread. |
| 29 | * During the overall execution, threads may communicate with one another through shared variables. |
| 30 | * OpenMP programs essentially consist of a series of forks and joins. |
| 31 | |
| 32 | |
| 33 | == Brief Tutorials for Programming Languages == |
| 34 | * [[cypress/Programming/Cexamples/OpenMp|C]] |
| 35 | * [[cypress/Programming/CppExamples/OpenMpCpp|C++]] |
| 36 | * [[cypress/Programming/FortranExamples/OpenMpFortran|Fortran]] |