wiki:cypress/Programming/OpenMp

Version 1 (modified by fuji, 9 years ago) ( diff )

OpenMP

  • What is OpenMP?
    • The OpenMP is an Application Program Interface (API) that supports shared-memory parallel programming.
  • What is the shared-memory?
    • The memory space that is accessible from multiple CPUs without an operating system call involvement.
  • Limitation
    • The number of CPUs on a single compute node bounds the number of threads. (←>Distributed Memory Cluster)

A Programmer’s View of OpenMP

  • OpenMP is a portable, threaded, shared-memory programming specification with “light” syntax
    • Exact behavior depends on OpenMP implementation!
    • Requires compiler support (C or Fortran)
  • OpenMP will:
    • Allow a programmer to separate a program into serial regions and parallel regions.
  • OpenMP will not:
    • Parallelize automatically
    • Guarantee speedup

OpenMP's Execution Model

  • OpenMP is built around a shared memory space and generates concurrent threads – this is how the parallelism is facilitated.
  • CPUs that share memory are called “symmetric multi-processors”, or SMP for short.
  • 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”.
  • 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.
  • These days, most major compilers do support OpenMP directives for most platforms (IBM's XL suite, Intel, even GCC ≥ 4.2).
  • A fork is when a single thread is made into multiple, concurrently executing threads.
  • A join is when the concurrently executing threads synchronize back into a single thread.
  • During the overall execution, threads may communicate with one another through shared variables.
  • OpenMP programs essentially consist of a series of forks and joins.

Brief Tutorials for Programming Languages

Attachments (2)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.