PRIVATE. STMicroelectronics PGI
जाहिरात
जाहिरात
Directive and Pragma Clauses
You use this clause in conjunction with a DO or SECTIONS construct to impose a serial order on the execution of a section of code. If ORDERED constructs are contained in the dynamic extent of the DO construct, the ordered clause must be present on the DO directive.
PRIVATE
The PRIVATE clause specifies that each thread should have its own instance of a variable. Therefore, variables specified in a PRIVATE list are private to each thread in a team. In effect, the compiler creates a separate copy of each of these variables for each thread in the team. When an assignment to a private variable occurs, each thread assigns to its local copy of the variable. When operations involving a private variable occur, each thread performs the operations using its local copy of the variable.
Tips about private variables:
• Variables declared private in a parallel region are undefined upon entry to the parallel region. If the first use of a private variable within the parallel region is in a right-hand-side expression, the results of the expression are undefined, indicating the probability of a coding error.
• Variables declared private in a parallel region are undefined when serial execution resumes at the end of the parallel region.
REDUCTION
The REDUCTION clause specifies that one or more variables that are private to each thread are the subject of a reduction operation at the end of the parallel region. It updates named variables declared on the clause within the directive construct.
• Intermediate values of REDUCTION variables are not used within the parallel construct, other than in the updates themselves.
• Variables that appear in the list of a REDUCTION clause must be SHARED.
• A private copy of each variable in list
is created for each thread as if the PRIVATE clause had been specified.
Each private copy is initialized according to the operator as specified in the following table:
For Directives
Operator /
Intrinsic
-
+
*
0
1
0
Table 17.1. Initialization of REDUCTION Variables
Initialization
-
For Pragmas
Operator Initialization
+
*
0
1
0
312
डाउनलोड
जाहिरात