Parallel Programming in OpenMP

Aimed at the working researcher or scientific C/C++ or Fortran programmer, this text introduces the competent research programmer to a new vocabulary of idioms and techniques for parallelizing software using OpenMP.
| Fortran | C/C++ |
|---|---|
| Syntax | |
<b class="bold">sentinel directive-name [clause] ... Fixed form Free formSentinel !$omp c$omp *$omp !$ompContinuation !$omp+ Trailing &Conditional !$ c$ *$ !$ compilation</b> | <b class="bold">#pragma omp directive-name [clause] ...Continuation Trailing \Conditional</b> #ifdef _OPENMP compilation ... #endif |
| Parallel region construct | |
<b class="bold">!$omp parallel [clause] ...</b> structured-block<b class="bold">!$omp end parallel</b> | <b class="bold">#pragma omp parallel [clause] ...</b> structured-block |
| Work-sharing constructs | |
<b class="bold">!$omp do [clause] ...</b> do-loop<b class="bold">!$omp enddo [nowait]</b> | <b class="bold">#pragma omp for [clause] ...</b> for-loop |
<b class="bold">!$omp sections [clause] ...</b>[<b class="bold">!$omp section</b> structured-block] ...<b class="bold">!$omp end sections [nowait]</b> | <b class="bold">#pragma omp sections [clause] ...{[ #pragma omp section</b> structured-block] ...} |
<b class="bold">!$omp single [clause] ...</b> structured-block<b class="bold">!$omp end single [nowait]</b> | <b class="bold">#pragma omp single [clause] ...</b> structured-block |