HOME
| OPENMP API Specification: Version 5.1 November 2020

3.6.1  omp_pause_resource

Summary The omp_pause_resource routine allows the runtime to relinquish resources used by OpenMP on the specified device.

Format

SVG-Viewer needed.

 

 
int omp_pause_resource( 
  omp_pause_resource_t kind, 
  int device_num 
);  

SVG-Viewer needed.

SVG-Viewer needed.

 
integer function omp_pause_resource(kind, device_num) 
integer (kind=omp_pause_resource_kind) kind 
integer device_num  

SVG-Viewer needed.

Constraints on Arguments The first argument passed to this routine can be one of the valid OpenMP pause kind, or any implementation specific pause kind. The C/C++ header file (omp.h) and the Fortran include file (omp_lib.h) and/or Fortran module file (omp_lib) define the valid constants. The valid constants must include the following, which can be extended with implementation-specific values:

Format

SVG-Viewer needed.

 

 
typedef enum omp_pause_resource_t { 
  omp_pause_soft = 1, 
  omp_pause_hard = 2 
} omp_pause_resource_t;  

SVG-Viewer needed.

SVG-Viewer needed.

 

 
integer (kind=omp_pause_resource_kind), parameter :: & 
  omp_pause_soft = 1 
integer (kind=omp_pause_resource_kind), parameter :: & 
  omp_pause_hard = 2  

SVG-Viewer needed.

The second argument passed to this routine indicates the device that will be paused. The device_num parameter must be greater than or equal to zero and less than or equal to the result of omp_get_num_devices().

Binding The binding task set for an omp_pause_resource region is the whole program.

Effect The omp_pause_resource routine allows the runtime to relinquish resources used by OpenMP on the specified device.

If successful, the omp_pause_hard value results in a hard pause for which the OpenMP state is not guaranteed to persist across the omp_pause_resource call. A hard pause may relinquish any data allocated by OpenMP on a given device, including data allocated by memory routines for that device as well as data present on the device as a result of a declare target directive or target data construct. A hard pause may also relinquish any data associated with a threadprivate directive. When relinquished and when applicable, base language appropriate deallocation/finalization is performed. When relinquished and when applicable, mapped data on a device will not be copied back from the device to the host.

If successful, the omp_pause_soft value results in a soft pause for which the OpenMP state is guaranteed to persist across the call, with the exception of any data associated with a threadprivate directive, which may be relinquished across the call. When relinquished and when applicable, base language appropriate deallocation/finalization is performed.

SVG-Viewer needed.

Note – A hard pause may relinquish more resources, but may resume processing OpenMP regions more slowly. A soft pause allows OpenMP regions to restart more quickly, but may relinquish fewer resources. An OpenMP implementation will reclaim resources as needed for OpenMP regions encountered after the omp_pause_resource region. Since a hard pause may unmap data on the specified device, appropriate data mapping is required before using data on the specified device after the omp_pause_region region.

SVG-Viewer needed.

The routine returns zero in case of success, and non-zero otherwise.

Tool Callbacks If the tool is not allowed to interact with the specified device after encountering this call, then the runtime must call the tool finalizer for that device.

Restrictions Restrictions to the omp_pause_resource routine are as follows:

Cross References