OpenMP - Pros and Cons

Pros and Cons

Pros

  • Portable multithreading code (in C/C++ and other languages, one typically has to call platform-specific primitives in order to get multithreading)
  • Simple: need not deal with message passing as MPI does
  • Data layout and decomposition is handled automatically by directives.
  • Incremental parallelism: can work on one part of the program at one time, no dramatic change to code is needed.
  • Unified code for both serial and parallel applications: OpenMP constructs are treated as comments when sequential compilers are used.
  • Original (serial) code statements need not, in general, be modified when parallelized with OpenMP. This reduces the chance of inadvertently introducing bugs.
  • Both coarse-grained and fine-grained parallelism are possible
  • In irregular multi-physics applications which do not adhere solely to the SPMD mode of computation, as encountered in tightly coupled fluid-particulate systems, the flexibility of OpenMP can have a big performance advantage over MPI.

Cons

  • Risk of introducing difficult to debug synchronization bugs and race conditions.
  • Currently only runs efficiently in shared-memory multiprocessor platforms (see however Intel's Cluster OpenMP and other distributed shared memory platforms).
  • Requires a compiler that supports OpenMP.
  • Scalability is limited by memory architecture.
  • no support for compare-and-swap
  • Reliable error handling is missing.
  • Lacks fine-grained mechanisms to control thread-processor mapping.
  • Can't be used on GPU
  • High chance of accidentally writing false sharing code
  • Multithreaded Executables often incur longer startup times so, they can actually run much slower than if compiled single-threaded, so, there needs to be a benefit to being multithreaded.
  • Often multithreading is used when there is no benefit yet the downsides still exist.

Read more about this topic:  OpenMP

Famous quotes related to pros and cons:

    Quite generally, the familiar, just because it is familiar, is not cognitively understood. The commonest way in which we deceive either ourselves or others about understanding is by assuming something as familiar, and accepting it on that account; with all its pros and cons, such knowing never gets anywhere, and it knows not why.... The analysis of an idea, as it used to be carried out, was, in fact, nothing else than ridding it of the form in which it had become familiar.
    Georg Wilhelm Friedrich Hegel (1770–1831)