Parallel Programming in OpenMP

Figure 3.1 shows a high-level view of the syntax of the parallel do directive in Fortran, while Figure 3.2 shows the corresponding syntax of the parallel for directive in C and C++. The square bracket notation ([ ]) is used to identify information that is optional, such as the clauses or the end parallel do directive. Details about the contents of the clauses are presented in subsequent sections in this chapter.
<b class="bold">!$omp parallel do [clause [,] [clause ...]]</b> do index = first, last [, stride] body of the loop enddo [<b class="bold">!$omp end parallel do</b>]
<b class="bold">#pragma omp parallel for [clause [clause ...]]</b> for (index = first ; test_expr ; increment_expr) { body of the loop }In Fortran, the parallel do directive parallelizes the loop that immediately follows it, which means there must be a statement following the directive, and that statement must be a do loop. Similarly, in C and...