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.

directive. When a common block that is initialized using DATA statements appears in aTHREADPRIVATE directive, each thread’s copy is initialized once prior to its first use.The following restrictions apply to the THREADPRIVATE directive:• The THREADPRIVATE directive must appear after every declaration of a thread privatecommon block.• Only named common blocks can be made thread private.• It is illegal for a THREADPRIVATE common block or its constituent variables to appearin any clause other than a COPYIN clause.8.16 Run-time Library RoutinesUser-callable functions are available to the Fortran programmer to query and alter the parallelexecution environment.integer omp_get_num_threads()returns the number of threads in the team executing the parallel region from which it is called.When called from a serial region, this function returns 1. A nested parallel region is the same as asingle parallel region. By default, the value returned by this function is equal to the value of theenvironment variable OMP_NUM_THREADS or to the value set by the last previous call to theomp_set_num_threads() subroutine defined in the following section.subroutine omp_set_num_threads(scalar_integer_exp)sets the number of threads to use for the next parallel region. This subroutine can only be calledfrom a serial region of code. If it is called from within a parallel region, or within a subroutine orfunction that is called from within a parallel region, the results are undefined. This subroutine hasprecedence over the OMP_NUM_THREADS environment variable.integer omp_get_thread_num()returns the thread number within the team. The thread number lies between 0 andomp_get_num_threads()-1. When called from a serial region, this function returns 0. Anested parallel region is the same as a single parallel region.integer function omp_get_max_threads()returns the maximum value that can be returned by calls to omp_get_num_threads(). Ifomp_set_num_threads() is used to change the number of processors, subsequent calls toomp_get_max_threads() will return the new value. This function returns the maximumvalue whether executing from a parallel or serial region of code.OpenMP Directives for Fortran 301

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

Saved successfully!

Ooh no, something went wrong!