Parallel Programming Guide for HP-UX Systems

Data privatization
Privatizing region variables
Chapter 6120
Privatizing region variables
Regional privatization is manually speciļ¬ed using the
parallel_private directive or pragma. parallel_private is provided
to declare a list of variables and/or arrays private to the immediately
following parallel region. It serves the same purpose for parallel regions
as task_private does for tasks, and loop_private does for loops.
parallel_private
The parallel_private directive must immediately precede, or appear
on the same line as, its corresponding parallel directive. Using
parallel_private asserts that there are no dependences in the parallel
region.
Do not use parallel_private if there are dependences.
Each parallel thread of execution receives a private copy of the
parallel_private data object for the duration of the region. No starting
or ending values are assumed for the data. If a parallel_private data
object is referenced within a region, it must have been previously
assigned a value in the region.
The form of this directive and pragma is shown in Table 6-5.
where
namelist is a comma-separated list of variables and/or arrays
that are to be private to the immediately following
parallel region. namelist cannot contain dynamic,
allocatable, or automatic arrays.
Example 6-10 parallel_private
The following Fortran code shows how
Table 6-5 Form of parallel_private directive and pragma
Language Form
Fortran C$DIR PARALLEL_PRIVATE(namelist)
C #pragma _CNX parallel_private(namelist)