omp_target_disassociate_ptr (GNU libgomp)

#### 3.8.12 `omp_target_disassociate_ptr` – Remove device–host pointer association ¶

Description:

  This routine removes the storage association established by calling `omp_target_associate_ptr` and sets the reference count to zero, even if `omp_target_associate_ptr` was invoked multiple times for for host pointer `ptr`. If applicable, the device memory needs to be freed by the user.

  If an associated device storage location for the device_num was found and has infinite reference count, the association is removed and zero is returned. In all other cases, nonzero (`EINVAL`) is returned and no other action is taken.

  Note that passing a host pointer where the association to the device pointer was established with the `declare target` directive yields undefined behavior.

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

C/C++

  Prototype: | `int omp_target_disassociate_ptr(const void *ptr,`
  | `int device_num)`

Fortran:

  Interface: | `integer(c_int) function omp_target_disassociate_ptr(ptr, &`
  | `device_num) bind(C)`
  | `use, intrinsic :: iso_c_binding, only: c_ptr, c_int`
  | `type(c_ptr), value :: ptr`
  | `integer(c_int), value :: device_num`

See also:

  `omp_target_associate_ptr` – Associate a device pointer with a host pointer

Reference:

  OpenMP specification v5.1, Section 3.8.10