List of OpenMP* Runtime Library Routines

The following table specifies the interface to OpenMP* runtime library routines. The names for the routines are in user name space. The omp.h header file is provided in the include directory of your compiler installation. There are definitions for two different locks, omp_lock_t and omp_nest_lock_t, which are used by the functions in the table.

Function

Description

SUBROUTINE omp_set_num_threads(num_threads)

Dynamically set the number of threads to use for this region.

INTEGER FUNCTION omp_get_num_threads()

Determine what the current number of threads is that is permitted to execute a region.

INTEGER FUNCTION omp_get_max_threads()

Obtains the maximum number of threads ever permitted with this OpenMP implementation.

INTEGER FUNCTION omp_get_thread_num()

Determines the unique thread number of the thread currently executing this section of code.

INTEGER FUNCTION omp_get_num_procs()

Determines the number of processors on the current machine.

INTEGER FUNCTION omp_in_parallel()

Determines if the region of code the function is called in is running in parallel. Returns non-zero if inside a parallel region, zero otherwise.

SUBROUTINE omp_set_dynamic(dynamic_threads) INTEGER dynamic_threads

Enable or disable dynamic adjustment of the number of threads used to execute a parallel region. If dynamic_threads is non-zero, dynamic threads are enabled. If dynamic_threads is zero, dynamic threads are disabled.

INTEGER FUNCTION omp_get_dynamic()

Determine whether dynamic adjustment of the number of threads executing a region is supported. Returns non-zero if dynamic adjustment is supported, zero otherwise.

SUBROUTINE omp_set_nested(nested)
INTEGER nested

Enable or disable nested parallelism. If parameter is non-zero, enable. Default is disabled.

INTEGER FUNCTION omp_get_nested()

Determine whether nested parallelism is currently enabled or disabled. Function returns non-zero if nested parallelism is supported, zero otherwise.

SUBROUTINE omp_init_lock(lock) INTEGER lock

Initialize a unique lock and set lock to its value.

SUBROUTINE omp_destroy_lock(lock)
INTEGER lock

 Disassociate lock from any locks.

SUBROUTINE omp_set_lock(lock)
INTEGER lock

Force the executing thread to wait until the lock associated with lock is available. The thread is granted ownership of the lock when it becomes available.

SUBROUTINE omp_unset_lock(lock)
INTEGER lock

Release executing thread from ownership of lock associated with lock. The lock argument must be initialized via omp_init_lock(), and behavior undefined if executing thread does not own the lock associated with lock.

INTEGER omp_test_lock(lock)

Attempt to set lock associated with lock. If successful, return non-zero. lock must be initialized via omp_init_lock(lock).

SUBROUTINE omp_init_nest_lock(lock)
INTEGER lock

 Initialize a unique nested lock and set lock to its value.

SUBROUTINE omp_destroy_nest_lock(lock)
INTEGER lock

Disassociate the nested lock "lock" from any locks.

SUBROUTINE omp_set_nest_lock(lock)
INTEGER lock

Force the executing thread to wait until the lock associated with lock is available. The thread is granted ownership of the lock when it becomes available.

SUBROUTINE omp_unset_nest_lock(lock)
INTEGER lock

Release executing thread from ownership of lock associated with lock if count is zero. lock must be initialized via omp_init_nest_lock(). Behavior is undefined if executing thread does not own the lock associated with lock.

INTEGER omp_test_nest_lock(lock)

Attempt to set lock associated with lock. If successful, return nesting count, otherwise return zero. lock must be initialized via omp_init_lock().