[PATCH, libgomp, OpenMP 5.0] Implement omp_get_device_num

Chung-Lin Tang cltang@codesourcery.com
Mon Aug 2 13:09:25 GMT 2021

On 2021/7/23 7:01 PM, Tobias Burnus wrote:
> I personally prefer having:
>     int initial_dev;
> and inside 'omp target' (with 'map(from:initial_dev)'):
>     initial_device = omp_is_initial_device();
> Then the check would be:
>    if (initial_device && host_device_num != device_num)
>      abort();
>    if (!initial_device && host_device_num == device_num)
>      abort();
> (Likewise for Fortran.)

Thanks, I've adjusted the new testcases to use this style.

> And instead of restricting the target to nvptx/gcn, we could just add
> dg-xfail-run-if for *-intelmic-* and *-intelmicemul-*.

I've added a 'offload_target_intelmic' to use on the new testcases.

> Additionally, offload_target_nvptx/...amdgcn only check whether
> compilation support is available not whether a device exists
> at run time.
> (The device availability is checked by target_offload_device,
> using omp_is_initial_device().)

I guess there is value in testing compilation as long as the compiler
is properly configured, and leaving the execution as an independent test.
OTOH, I think the OpenMP execution tests are not properly forcing offload
(or not) using the environment variables, unlike what we have for OpenACC.


More information about the Gcc-patches mailing list