HOME
| OPENMP API Specification: Version 5.0 November 2018

2.12.1  Device Initialization

Execution Model Events The device-initialize event occurs in a thread that encounters the first target, target data, or target enter data construct or a device memory routine that is associated with a particular target device after the thread initiates initialization of OpenMP on the device and the device’s OpenMP initialization, which may include device-side tool initialization, completes.

The device-load event for a code block for a target device occurs in some thread before any thread executes code from that code block on that target device.

The device-unload event for a target device occurs in some thread whenever a code block is unloaded from the device.

The device-finalize event for a target device that has been initialized occurs in some thread before an OpenMP implementation shuts down.

Tool Callbacks A thread dispatches a registered ompt_callback_device_initialize callback for each occurrence of a device-initialize event in that thread. This callback has type signature ompt_callback_device_initialize_t.

A thread dispatches a registered ompt_callback_device_load callback for each occurrence of a device-load event in that thread. This callback has type signature ompt_callback_device_load_t.

A thread dispatches a registered ompt_callback_device_unload callback for each occurrence of a device-unload event in that thread. This callback has type signature ompt_callback_device_unload_t.

A thread dispatches a registered ompt_callback_device_finalize callback for each occurrence of a device-finalize event in that thread. This callback has type signature ompt_callback_device_finalize_t.

RestrictionsNo thread may offload execution of an OpenMP construct to a device until a dispatched ompt_callback_device_initialize callback completes. No thread may offload execution of an OpenMP construct to a device after a dispatched ompt_callback_device_finalize callback occurs.

Cross References