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>Usage<strong>The</strong> ATOMIC directive is semantically equivalent to enclosing the following single statement ina CRITICAL / END CRITICAL directive pair.<strong>The</strong> statements must be one of the following forms:x = x operator exprx = expr operator xx = intrinsic (x, expr)x = intrinsic (expr, x)where x is a scalar variable of intrinsic type, expr is a scalar expression that does not referencex, intrinsic is one of MAX, MIN, IAND, IOR, or IEOR, and operator is one of +, *,-, /, .AND., .OR., .EQV., or .NEQV..8.7.2. BARRIER<strong>The</strong> OpenMP BARRIER directive defines a point in a program where each thread waits for allother threads to arrive before continuing with program execution.Syntax!$OMP BARRIERUsage<strong>The</strong>re may be occasions in a parallel region when it is necessary that all threads complete workto that point before any thread is allowed to continue. <strong>The</strong> BARRIER directive synchronizes allthreads at such a point in a program. Multiple barrier points are allowed within a parallel region.<strong>The</strong> BARRIER directive must either be executed by all threads executing the parallel region or bynone of them.8.7.3. CRITICAL ... END CRITICAL<strong>The</strong> CRITICAL...END CRITICAL directive requires a thread to wait until no other thread isexecuting within a critical section.Syntax!$OMP CRITICAL [(name)]< <strong>Fortran</strong> code executed in body of critical section >!$OMP END CRITICAL [(name)]UsageWithin a parallel region, there may exist subregions of code that will not execute properly whenexecuted by multiple threads simultaneously. This issue is often due to a shared variable that iswritten and then read again.<strong>PGI</strong> <strong>Fortran</strong> <strong>Reference</strong> Guide 165

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

Saved successfully!

Ooh no, something went wrong!