Re: [PATCH, libgomp, OpenMP 5.0] Implement omp_get_device_num

2021-08-02 Thread Chung-Lin Tang
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();   i

Re: [PATCH, libgomp, OpenMP 5.0] Implement omp_get_device_num

2021-07-23 Thread Tobias Burnus
On 23.07.21 12:21, Chung-Lin Tang wrote: Inside offloaded regions, the preferred way to should be that the device already has this information initialized (once) when the device is initialized. And the function merely returns the stored value. ... +++ b/libgomp/testsuite/libgomp.c-c++-common/ta

Re: [PATCH, libgomp, OpenMP 5.0] Implement omp_get_device_num

2021-07-23 Thread Jakub Jelinek via Gcc-patches
On Fri, Jul 23, 2021 at 06:21:41PM +0800, Chung-Lin Tang wrote: > --- a/libgomp/icv-device.c > +++ b/libgomp/icv-device.c > @@ -61,8 +61,17 @@ omp_is_initial_device (void) >return 1; > } > > +int > +omp_get_device_num (void) > +{ > + /* By specification, this is equivalent to omp_get_initia

[PATCH, libgomp, OpenMP 5.0] Implement omp_get_device_num

2021-07-23 Thread Chung-Lin Tang
Hi all, this patch implements the omp_get_device_num API function, which appears to be a missing piece in the library routines implementation. The host-side implementation is simple, which by specification is equivalent to omp_get_initial_device. Inside offloaded regions, the preferred way to sh