Without this patch, when the offload device is set to
omp_get_initial_device(), the runtime fails with an error diagnostic
when entering target regions or target data regions.
However, OpenMP 5.1, sec. 2.14.5 "target Construct", "Restrictions",
p. 203, L3-5 states:
The device clause expression must evaluate to a non-negative integer
value that is less than or equal to the value of
omp_get_num_devices().
Sec. 3.7.7 "omp_get_initial_device", p. 412, L2-3 states:
The value of the device number is the value returned by the
omp_get_num_devices routine.
Similarly, OpenMP 5.0, sec. 2.12.5 "target Construct", "Restrictions",
p. 174 L30-32 states:
The device clause expression must evaluate to a non-negative integer
value less than the value of omp_get_num_devices() or to the value
of omp_get_initial_device().
This patch fixes this behavior by changing the runtime to behave as if
offloading is disabled whenever it finds the offload device (either
from a device clause or the default device) is set to the host
device. In the case of mandatory offloading when
omp_get_num_devices() == 0, it incorporates the behavior proposed
for OpenMP 5.2 in OpenMP spec github issue 2669.