This is a simple OpenMP implementation parallelizing the outer loop of multiple nested loops.
The following pseudo-code shows the structure of the nested loops. An outer and two nested loops
with different sizes (
Ni) compute work on a three-dimensional array.
DO K = 1, Nk DO J = 1, Nj DO I = 1, Ni !! work to do END DO END DO END DO
The loop iterations can be divided among threads by using the following one-level OpenMP parallelization construct on the outer loop:
!$OMP PARALLEL DO DEFAULT(NONE) SHARED(...) DO K = 1, Nk DO J = 1, Nj DO I = 1, Ni !! work to do END DO END DO END DO !$OMP END PARALLEL DO