1. Page Index
  2. 1. Introduction
  3. 2. Execution Environment Routines
  4. 2.1. omp_set_num_threads
  5. 2.2. omp_get_num_threads
  6. 2.3. omp_get_max_threads
  7. 2.4. omp_get_thread_num
  8. 2.5. omp_get_num_procs
  9. 2.6. omp_in_parallel
  10. 2.7. omp_set_dynamic
  11. 2.8. omp_get_dynamic
  12. 2.9. omp_set_nested
  13. 2.10. omp_get_nested
  14. 2.11. omp_set_schedule
  15. 2.12. omp_get_schedule
  16. 2.13. omp_get_thread_limit
  17. 2.14. omp_set_max_active_levels
  18. 2.15. omp_get_max_active_levels
  19. 2.16. omp_get_level
  20. 2.17. omp_get_ancestor_thread_num
  21. 2.18. omp_get_team_size
  22. 2.19. omp_get_active_level
  23. 3. Lock Routines
  24. 3.1. omp_init_[nest]_lock
  25. 3.2. omp_destroy_[nest]_lock
  26. 3.3. omp_set_[nest]_lock
  27. 3.4. omp_unset_[nest]_lock
  28. 3.5. omp_test_[nest]_lock
  29. 4. Timing Routines
  30. 4.1. omp_get_wtime
  31. 4.2. omp_get_wtick

Runtime OpenMP

Introduction

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".

Execution Environment Routines

omp_set_num_threads

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.

omp_get_num_threads

Returns the number of threads in the current team.

omp_get_max_threads

Returns maximum number of threads that could be used to form a new team using a "parallel" construct without a "num_threads" clause.

omp_get_thread_num

Returns the ID of the encountering thread where ID ranges from zero to the size of the team minus 1.

omp_get_num_procs

Returns the number of processors available to the program.

omp_in_parallel

int omp_in_parallel(void);

Returns true if the call to the routine is enclosed by an active parallel region; otherwise, it returns false.

omp_set_dynamic

void omp_set_dynamic(int dynamic_threads);

Enables or disables dynamic adjustment of the number of threads available.

omp_get_dynamic

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.

omp_set_nested

void omp_set_nested(int nested);

Enables or disables nested parallelism, by setting the nest-var ICV.

omp_get_nested

int omp_get_nested(void);

Returns the value of the nest-var ICV, which determines if nested parallelism is enabled or disabled.

omp_set_schedule

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.

omp_get_schedule

void omp_get_schedule(omp_sched_t *kind,int *modifier);

Returns the schedule applied when runtime schedule is used.

omp_get_thread_limit

Returns the maximum number of OpenMP threads available to the program.

omp_set_max_active_levels

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.

omp_get_max_active_levels

Returns the value of the max-activelevels-var ICV, which determines the maximum number of nested active parallel regions.

omp_get_level

int omp_get_level(void);

Returns the number of nested parallel regions enclosing the task that contains the call.

omp_get_ancestor_thread_num

Returns, for a given nested level of the current thread, the thread number of the ancestor or the current thread.

omp_get_team_size

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.

omp_get_active_level

Returns the number of nested, active parallel regions enclosing the task that contains the call.

Lock Routines

omp_init_[nest]_lock

void omp_init_lock(omp_lock_t *lock);
void omp_init_nest_lock(omp_nest_lock_t *lock);

These routines initialize an OpenMP lock.

omp_destroy_[nest]_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.

omp_set_[nest]_lock

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.

omp_unset_[nest]_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.

omp_test_[nest]_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.

Timing Routines

omp_get_wtime

double omp_get_wtime(void);

Returns elapsed wall clock time in seconds.

omp_get_wtick

double omp_get_wtick(void);

Returns the precision of the timer used by omp_get_wtime.

Created by: Daniel Guerrero Martínez y Sergio Rodríguez Lumley 2010

Valid HTML 4.01 Transitional