HOME
| OPENMP API Specification: Version 5.0 November 2018

3.6.2  omp_target_free

SummaryThe omp_target_free routine frees the device memory allocated by the omp_target_alloc routine.

Format  

 
void omp_target_free(void *device_ptr, int device_num);  

Constraints on Arguments A program that calls omp_target_free with a non-null pointer that does not have a value returned from omp_target_alloc is non-conforming. The device_num must be greater than or equal to zero and less than the result of omp_get_num_devices() or the result of a call to omp_get_initial_device().

Effect The omp_target_free routine frees the memory in the device data environment associated with device_ptr. If device_ptr is NULL, the operation is ignored.

Synchronization must be inserted to ensure that all accesses to device_ptr are completed before the call to omp_target_free.

When called from within a target region the effect of this routine is unspecified.

Execution Model EventsThe target-data-free event occurs when a thread frees data on a target device.

Tool CallbacksA thread invokes a registered ompt_callback_target_data_op callback for each occurrence of a target-data-free event in that thread. The callback occurs in the context of the target task and has type signature ompt_callback_target_data_op_t.

Cross References