#pragma ibm parallel_loop

C only

Description

The parallel_loop pragma explicitly instructs the compiler to parallelize the chosen loop.

Syntax

Read syntax diagramSkip visual syntax diagram>>-#--pragma--ibm parallel_loop--+--------+--+------------------------+-><
                                 '-if exp-'  '-schedule\n(sched-type)-'

where exp represents a scalar expression, and sched-type represents any scheduling algorithm as valid for the schedule directive.

Notes

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.

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.

The compiler will not automatically detect reductions on loops marked with this pragma. To properly parallelize loops with reductions, use:

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 #pragma ibm schedule pragma.

A warning is generated if this pragma is not followed by a countable loop.