12.07.2015 Views

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

PGI Fortran - Servidor WWW del Cluster Ladon-Hidra

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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

By default, there is an implicit barrier after the end of the parallel loop; the first thread tocomplete its portion of the work will wait until the other threads have finished their portion ofwork. If NOWAIT is specified, the threads will not synchronize at the end of the parallel loop.Other items to note about !$OMP DO loops:• The DO loop index variable is always private.• !$OMP DO loops must be executed by all threads participating in the parallel region ornone at all.• The END DO directive is optional, but if it is present it must appear immediately after theend of the enclosed DO loop.PROGRAM DO_USEREAL A(1000), B(1000)DO I=1,1000B(I) = FLOAT(I)END DO!$OMP PARALLEL!$OMP DODO I=1,1000A(I) = SQRT(B(I));END DO...!$OMP END PARALLEL...ENDThe SCHEDULE clause specifies how iterations of the DO loop are divided up between processors.Given a SCHEDULE (type [, chunk]) clause, type can be STATIC, DYNAMIC, GUIDED,or RUNTIME.These are defined as follows:• When SCHEDULE (STATIC, chunk) is specified, iterations are allocated incontiguous blocks of size chunk. The blocks of iterations are statically assigned to threadsin a round-robin fashion in order of the thread ID numbers. The chunk must be a scalarinteger expression. If chunk is not specified, a default chunk size is chosen equal to:(number_of_iterations + omp_num_threads() - 1) / omp_num_threads()• When SCHEDULE (DYNAMIC, chunk) is specified, iterations are allocated incontiguous blocks of size chunk. As each thread finishes a piece of the iteration space, itdynamically obtains the next set of iterations. The chunk must be a scalar integerexpression. If no chunk is specified, a default chunk size is chosen equal to 1.OpenMP Directives for Fortran 295

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

Saved successfully!

Ooh no, something went wrong!