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>ClausesUsagePRIVATE(list)FIRSTPRIVATE(list)COPYPRIVATE(list)In a parallel region of code, there may be a sub-region of code that only executes correctly on asingle thread. Instead of ending the parallel region before this subregion and then starting it upagain after this subregion, the SINGLE...END SINGLE directive pair or the omp single pragmalets you conveniently designate code that executes on a single thread and is skipped by the otherthreads.<strong>The</strong> following restrictions apply to the SINGLE...END SINGLE directive:‣ <strong>The</strong>re is an implied barrier on exit from a SINGLE...END SINGLE section of code unlessthe optional NOWAIT clause is specified.‣ Nested single process sections are ignored.‣ Branching into or out of a single process section is not supported.ExamplesPROGRAM SINGLE_USEINTEGER A(0:1)INTEGER omp_get_thread_num()!$OMP PARALLELA(omp_get_thread_num()) = omp_get_thread_num()!$OMP SINGLEPRINT *, "YOU SHOULD ONLY SEE THIS ONCE"!$OMP END SINGLE!$OMP END PARALLELPRINT *, "A(0)=",A(0), " A(1)=", A(1)END8.7.15. TASK<strong>The</strong> OpenMP TASK directive defines an explicit task.Syntax!$OMP TASK [Clauses]< <strong>Fortran</strong> code executed as task >!$OMP END TASKClausesIF(scalar_logical_expression)UNTIEDDEFAULT(private | firstprivate | shared | none)PRIVATE(list)FIRSTPRIVATE(list)SHARED(list)<strong>PGI</strong> <strong>Fortran</strong> <strong>Reference</strong> Guide 176

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

Saved successfully!

Ooh no, something went wrong!