10.07.2015 Views

PGI Fortran Reference manual - The Portland Group

PGI Fortran Reference manual - The Portland Group

PGI Fortran Reference manual - The Portland Group

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

OpenMP Directives for <strong>Fortran</strong>In the presence of an IF clause, the parallel region is executed in parallel only if thecorresponding scalar_logical_expression evaluates to .TRUE.. Otherwise, the codewithin the region is executed by a single processor, regardless of the value of the environmentvariable OMP_NUM_THREADS.8.6.7. LASTPRIVATE(list)<strong>The</strong> LASTPRIVATE(list) clause specifies that the enclosing context's version of the variableis set equal to the private version of whichever thread executes the final iteration (for-loopconstruct).8.6.8. NOWAIT<strong>The</strong> NOWAIT clause overrides the barrier implicit in a directive. When you specify NOWAIT, itremoves the implicit barrier synchronization at the end of a for or sections construct.8.6.9. NUM_THREADS<strong>The</strong> NUM_THREADS clause sets the number of threads in a thread team. <strong>The</strong> num_threadsclause allows a user to request a specific number of threads for a parallel construct. If thenum_threads clause is present, then8.6.10. ORDERED<strong>The</strong> ORDERED clause specifies that a loop is executed in the order of the loop iterations. Thisclause is required on a parallel FOR statement when an ordered directive is used in the loop.You use this clause in conjunction with a DO or SECTIONS construct to impose a serial order onthe execution of a section of code. If ORDERED constructs are contained in the dynamic extentof the DO construct, the ordered clause must be present on the DO directive.8.6.11. PRIVATE<strong>The</strong> PRIVATE clause specifies that each thread should have its own instance of a variable.<strong>The</strong>refore, 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. Whenan 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 itslocal copy of the variable.Tips about private variables:‣ Variables declared private in a parallel region are undefined upon entry to the parallelregion. If the first use of a private variable within the parallel region is in a right-hand-sideexpression, the results of the expression will be undefined, indicating the probability of acoding error.<strong>PGI</strong> <strong>Fortran</strong> <strong>Reference</strong> Guide 161

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!