omp_get_initial_device (GNU libgomp)

#### 3.7.9 `omp_get_initial_device` – Return device number of initial device ¶

Description:

  This function returns a device number that represents the host device. Since OpenMP 5.1, this is equal to the value returned by the `omp_get_num_devices` function; since OpenMP 6.0 it may also return the value of `omp_initial_device`.

  The effect of running this routine in a `target` region is unspecified.

  Note that GCC inlines this function unless you compile with `-fno-builtin-omp_get_initial_device`. If GCC was not configured to support offloading, it expands to constant zero; in non-host code it expands to `omp_initial_device`; and otherwise it is replaced with a call to `omp_get_num_devices`.

C/C++

  Prototype: | `int omp_get_initial_device(void);`

Fortran:

  Interface: | `integer function omp_get_initial_device()`

See also:

  `omp_get_num_devices` – Number of target devices

Reference:

  OpenMP specification v4.5, Section 3.2.35.