omp_target_free (GNU libgomp)

#### 3.8.2 `omp_target_free` – Free device memory ¶

Description:

  This routine frees memory allocated by the `omp_target_alloc` routine. The device_ptr argument must be either a null pointer or a device pointer returned by `omp_target_alloc` for the specified `device_num`. The device number device_num must be a conforming device number.

  Running this routine in a `target` region except on the initial device is not supported.

C/C++

  Prototype: | `void omp_target_free(void *device_ptr, int device_num)`

Fortran:

  Interface: | `subroutine omp_target_free(device_ptr, device_num) bind(C)`
  | `use, intrinsic :: iso_c_binding, only: c_ptr, c_int`
  | `type(c_ptr), value :: device_ptr`
  | `integer(c_int), value :: device_num`

See also:

  `omp_target_alloc` – Allocate device memory, `omp_target_disassociate_ptr` – Remove device–host pointer association

Reference:

  OpenMP specification v5.1, Section 3.8.2