12.07.2015 Views

PGI User's Guide

PGI User's Guide

PGI User's Guide

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.

Run-time Library RoutinesRun-time Library Routines with Examplesomp_set_num_threadsSets the number of threads to use for the next parallel region.This subroutine or function can only be called from a serial region of code. If it is called fromwithin a parallel region, or from within a subroutine or function that is called from within a parallelregion, the results are undefined. Further, this subroutine or function has precedence over theOMP_NUM_THREADS environment variable.FortranC/C++omp_get_thread_numsubroutine omp_set_num_threads(scalar_integer_exp)void omp_set_num_threads(int num_threads);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. A nestedparallel region is the same as a single parallel region.FortranC/C++integer function omp_get_thread_num()int omp_get_thread_num(void);omp_get_ancestor_thread_numReturns, for a given nested level of the current thread, the thread number of the ancestor.FortranC/C++omp_get_active_levelinteger function omp_get_ancestor_thread_num(level)integer levelint omp_get_ancestor_thread_num(int level);Returns the number of enclosing active parallel regions enclosing the task that contains the call. <strong>PGI</strong>currently supports only one level of active parallel regions, so the return value currently is 1.FortranC/C++omp_get_levelinteger function omp_get_active_level()int omp_get_active_level(void);Returns the number of parallel regions enclosing the task that contains the call.FortranC/C++omp_get_max_threadsinteger function omp_get_level()int omp_get_level(void);Returns the maximum value that can be returned by calls to omp_get_num_threads().If omp_set_num_threads() is used to change the number of processors, subsequent calls toomp_get_max_threads() return the new value. Further, this function returns the maximum valuewhether executing from a parallel or serial region of code.FortranC/C++integer function omp_get_max_threads()void omp_get_max_threads(void);66

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

Saved successfully!

Ooh no, something went wrong!