OpenMP* Fortran Routines

The following table summarizes the OpenMP Fortran API run-time library routines you can use for directed parallel decomposition. These routines are all external procedures.

To use these routines, you must add a USE OMP_LIB statement to the program unit containing the routine.

Summary of OpenMP Fortran Parallel Routines

Name

Description

OMP_SET_NUM_THREADS

Sets the number of threads to use for the next parallel region.

OMP_GET_NUM_THREADS

Gets the number of threads currently in the team executing the parallel region from which the routine is called.

OMP_GET_MAX_THREADS

Gets the maximum value that can be returned by calls to the OMP_GET_NUM_THREADS function.

OMP_GET_THREAD_NUM

Gets the thread number, within the team, in the range from zero to OMP_GET_NUM_THREADS minus one.

OMP_GET_NUM_PROCS

Gets the number of processors that are available to the program.

OMP_IN_PARALLEL

Informs whether or not a region is executing in parallel.

OMP_SET_DYNAMIC

Enables or disables dynamic adjustment of the number of threads available for execution of parallel regions.

OMP_GET_DYNAMIC

Informs whether or not dynamic thread adjustment is enabled.

OMP_SET_NESTED

Enables or disables nested parallelism.

OMP_GET_NESTED

Informs whether or not nested parallelism is enabled.

OMP_INIT_LOCK

Initializes a lock to be used in subsequent calls.

OMP_DESTROY_LOCK

Disassociates a lock variable from any locks.

OMP_SET_LOCK

Makes the executing thread wait until the specified lock is available.

OMP_UNSET_LOCK

Releases the executing thread from ownership of a lock.

OMP_TEST_LOCK

Tries to set the lock associated with a lock variable.

OMP_INIT_NEST_LOCK

Initializes a nested lock for use in subsequent calls.

OMP_DESTROY_NEST_LOCK

Disassociates a lock variable from a nested lock.

OMP_SET_NEST_LOCK

Makes the executing thread wait until the specified nested lock is available.

OMP_UNSET_NEST_LOCK

Releases the executing thread from ownership of a nested lock if the nesting count is zero.

OMP_TEST_NEST_LOCK

Tries to set the nested lock associated with a lock variable.

OMP_GET_WTIME

Returns a double-precision value equal to the elapsed wallclock time (in seconds) relative to an arbitrary reference time.

OMP_GETWTICK

Returns a double-precision value equal to the number of seconds between successive clock ticks.

Intel® Fortran Extensions:

KMP_GET_STACKSIZE_S1

Returns the number of bytes that will be allocated for each parallel thread to use as its private stack.

KMP_SET_STACKSIZE_S2

Sets the number of bytes that will be allocated for each parallel thread to use as its private stack.

KMP_GET_BLOCKTIME

Returns the number of milliseconds that a thread should wait, after completing the execution of a parallel region, before sleeping.

KMP_SET_BLOCKTIME

Sets the number of milliseconds that a thread should wait, after completing the execution of a parallel region, before sleeping.

KMP_MALLOC

Allocates a memory block of a specified size (in bytes) from the thread-local heap.

KMP_CALLOC

Allocates an array of a specified number of elements and size from the thread-local heap.

KMP_REALLOC

Reallocates a memory block at a specified address and of a specified size from the thread-local heap.

KMP_FREE

Frees a memory block at a specified address from the thread-local heap.

1 For backwards compatibility, this can also be specified as KMP_GET_STACKSIZE.

2 For backwards compatibility, this can also be specified as KMP_SET_STACKSIZE.

For more information on a specific routine, see the appropriate reference page; for example, for more information on OMP_SET_LOCK, see omp_set_lock(3f).

See Also