Execution environment routines affect and monitor threads, processors, and the parallel environment.
Lock routines support synchronization with OpenMP locks. Timing routines support a portable wall clock timer.
Prototypes for the runtime library routines are defined in the file "omp.h".
void omp_set_num_threads(int num_threads);
Affects the number of threads used for subsequent parallel regions that do not specify a num_threads clause.
int omp_get_num_threads(void);
Returns the number of threads in the current team.
int omp_get_max_threads(void);
Returns maximum number of threads that could be used to form a new team using a "parallel" construct without a "num_threads" clause.
int omp_get_thread_num(void);
Returns the ID of the encountering thread where ID ranges from zero to the size of the team minus 1.
int omp_get_num_procs(void);
Returns the number of processors available to the program.
int omp_in_parallel(void);
Returns true if the call to the routine is enclosed by an active parallel region; otherwise, it returns false.
void omp_set_dynamic(int dynamic_threads);
Enables or disables dynamic adjustment of the number of threads available.
int omp_get_dynamic(void);
Returns the value of the dyn-var internal control variable (ICV), determining whether dynamic adjustment of the number of threads is enabled or disabled.
void omp_set_nested(int nested);
Enables or disables nested parallelism, by setting the nest-var ICV.
int omp_get_nested(void);
Returns the value of the nest-var ICV, which determines if nested parallelism is enabled or disabled.
void omp_set_schedule(omp_sched_t kind, int modifier);
Affects the schedule that is applied when runtime is used as schedule kind, by setting the value of the run-sched-var ICV.
void omp_get_schedule(omp_sched_t *kind,int *modifier);
Returns the schedule applied when runtime schedule is used.
int omp_get_thread_limit(void)
Returns the maximum number of OpenMP threads available to the program.
void omp_set_max_active_levels(int max_levels);
Limits the number of nested active parallel regions, by setting the max-active-levels-var ICV.
int omp_get_max_active_levels(void);
Returns the value of the max-activelevels-var ICV, which determines the maximum number of nested active parallel regions.
int omp_get_level(void);
Returns the number of nested parallel regions enclosing the task that contains the call.
int omp_get_ancestor_thread_num(int level);
Returns, for a given nested level of the current thread, the thread number of the ancestor or the current thread.
int omp_get_team_size(int level);
Returns, for a given nested level of the current thread, the size of the thread team to which the ancestor or the current thread belongs.
int omp_get_active_level(void);
Returns the number of nested, active parallel regions enclosing the task that contains the call.
void omp_init_lock(omp_lock_t *lock); void omp_init_nest_lock(omp_nest_lock_t *lock);
These routines initialize an OpenMP lock.
void omp_destroy_lock(omp_lock_t *lock); void omp_destroy_nest_lock(omp_nest_lock_t *lock);
These routines ensure that the OpenMP lock is uninitialized.
void omp_set_lock(omp_lock_t *lock); void omp_set_nest_lock(omp_nest_lock_t *lock);
These routines provide a means of setting an OpenMP lock.
void omp_unset_lock(omp_lock_t *lock); void omp_unset_nest_lock(omp_nest_lock_t *lock);
These routines provide a means of setting an OpenMP lock.
int omp_test_lock(omp_lock_t *lock); int omp_test_nest_lock(omp_nest_lock_t *lock);
These routines attempt to set an OpenMP lock but do not suspend execution of the task executing the routine.
double omp_get_wtime(void);
Returns elapsed wall clock time in seconds.
double omp_get_wtick(void);
Returns the precision of the timer used by omp_get_wtime.