Intel® Fortran Compiler 16.0 User and Reference Guide

OpenMP* Fortran Routines Overview

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.

Options that use OpenMP* are available for both Intel® microprocessors and non-Intel microprocessors, but these options may perform additional optimizations on Intel® microprocessors than they perform on non-Intel microprocessors. The list of major, user-visible OpenMP constructs and features that may perform differently on Intel® microprocessors vs. non-Intel microprocessors includes: locks (internal and user visible), the SINGLE construct, barriers (explicit and implicit), parallel loop scheduling, reductions, memory allocation, thread affinity, and binding.

Summary of OpenMP Fortran Parallel Routines

Name

Description

OMP_GET_DEFAULT_DEVICE

Gets the value of the internal control variable (ICV) named default-device-var, which determines the default device number.

OMP_GET_DEVICE_NUM

Gets the value of the internal control variable (ICV) named device-num-var, which determines the default device number.

OMP_GET_NUM_DEVICES

Gets the number of target devices.

OMP_GET_NUM_TEAMS

Gets the number of teams in the current parallel region.

OMP_GET_TEAM_NUM

Gets the team number of the calling thread.

OMP_SET_DEFAULT_DEVICE

Sets the value of the internal control variable (ICV) named default-device-var, which determines the default device number.

OMP_SET_DEVICE_NUM

Sets the value of the internal control variable (ICV) named device-num-var, which determines the default device number.

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 the current region is an active region (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, or if the thread already owns the lock, increments its nesting count.

OMP_UNSET_NEST_LOCK

Decrements the nesting count for the lock variable and releases the executing thread from ownership 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_PLACE_THREADS

Simplifies the specification of the number of cores and threads per core used by an OpenMP application, as an alternative to writing explicit affinity settings or a process affinity mask.

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