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>REDUCTION({operator | intrinsic} : list)Usage:<strong>The</strong> real purpose of supporting parallel execution is the distribution of work across the availablethreads. <strong>The</strong> DO... END DO directive pair provides a convenient mechanism for the distributionof loop iterations across the available threads in a parallel region.While you can explicitly manage work distribution with constructs such as the following one,these constructs are not in the form of directives.Examples:TipsIF (omp_get_thread_num() .EQ. 0)THEN...ELSE IF (omp_get_thread_num() .EQ. 1)THEN...ENDIFRemember these items about clauses in the DO...END DO directives:‣ Variables declared in a PRIVATE list are treated as private to each thread participating inparallel execution of the loop, meaning that a separate copy of the variable exists with eachthread.‣ Variables declared in a FIRSTPRIVATE list are PRIVATE, and are initialized from theoriginal object existing before the construct.‣ Variables declared in a LASTPRIVATE list are PRIVATE, and the thread that executes thesequentially last iteration updates the version of the object that existed before the construct.‣ <strong>The</strong> REDUCTION clause for the directive is described in REDUCTION.‣ <strong>The</strong> SCHEDULE clause specifies how iterations of the DO loop are divided up betweenthreads. For more information on this clause, refer to SCHEDULE.‣ If ORDERED code blocks are contained in the dynamic extent of the DO directive, theORDERED clause must be present. For more information on ORDERED code blocks, referto ORDERED.‣ <strong>The</strong> DO... END DO directive pair directs the compiler to distribute the iterative DO loopimmediately following the !$OMP DO directive across the threads available to the program.<strong>The</strong> DO loop is executed in parallel by the team that was started by an enclosing parallelregion. If the !$OMP END DO directive is not specified, the !$OMP DO is assumed to endwith the enclosed DO loop. DO... END DO directive pairs may not be nested. Branching intoor out of a !$OMP DO loop is not supported.‣ By default, there is an implicit barrier after the end of the parallel loop; the first thread tocomplete its portion of the work waits until the other threads have finished their portion ofwork. If NOWAIT is specified, the threads will not synchronize at the end of the parallelloop.<strong>PGI</strong> <strong>Fortran</strong> <strong>Reference</strong> Guide 168

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

Saved successfully!

Ooh no, something went wrong!