The PARALLEL REGION and END PARALLEL REGION directives delineate where parallelism exists in the program. The following example shows the PARALLEL REGION directive syntax:
C*KAP* PARALLEL REGION C*KAP*& [ IF(logical expression) ] C*KAP*& [ SHARED(shared_name,...) ] C*KAP*& [ LOCAL(local_name,...) ] C*KAP* END PARALLEL REGION
In the syntax example, local_name
and shared_
name
are references to a variable or an array. If the IF
clause logical expression evaluates to .FALSE., all of the code
between PARALLEL REGION and END PARALLEL REGION executes on a single
processor. If the logical expression evaluates to .TRUE., the code
between the PARALLEL REGION and the corresponding END PARALLEL
REGION may execute on multiple processors.
The SHARED and LOCAL lists on the PARALLEL REGION directive state the explicit forms of data sharing among the processors that execute the code inside the parallel region. When distinct processors reference the same variable or array from the SHARED list, the processors reference the same storage location. When distinct processors reference the same variable or array from the LOCAL list, the processors reference distinct storage locations.