The parallel_loop pragma explicitly instructs the compiler to parallelize the chosen loop.
Syntax
#pragma ibm parallel_loop [if (exp)] [schedule (sched-type)] <countable for/while/do loop>
where exp represents a scalar expression, and sched-type represents any scheduling algorithm as valid for the schedule directive. When the if argument is specified, the loop executes in parallel only if exp evaluates to TRUE at run-time. Otherwise the loop executes sequentially. The loop will also run sequentially if it is in a critical section.
Notes
This pragma can be applied to a wide variety of C loops, and the compiler will try to
determine if a loop is countable or not.
Program sections using the parallel_loop pragma must be able to produce a correct result in both sequential and parallel mode. For example, loop iterations must be independent before the loop can be parallelized. Explicit parallel programming techniques involving condition synchronization are not permitted.
This pragma can be combined with the schedule pragma to select a specific parallel process scheduling algorithm. For more information, see the description for the schedule pragma.
A warning is generated if this pragma is not followed by a countable loop.
Program Parallelization
Shared and Private Variables in a Parallel Environment
Countable Loops
Control Parallel Processing with Pragmas
#pragma Preprocessor Directives for Parallel Processing
smp=nested_par Compiler Option