Hi! On 2022-06-08T05:56:02+0200, Tobias Burnus wrote: > [...] On the libgomp side: The devices which do not fulfill the requirements are > now filtered out. [...] > --- a/libgomp/plugin/plugin-gcn.c > +++ b/libgomp/plugin/plugin-gcn.c > /* Return the number of GCN devices on the system. */ > > int > -GOMP_OFFLOAD_get_num_devices (void) > +GOMP_OFFLOAD_get_num_devices (unsigned int omp_requires_mask) > { > if (!init_hsa_context ()) > return 0; > + /* Return -1 if no omp_requires_mask cannot be fulfilled but > + devices were present. */ > + if (hsa_context.agent_count > 0 && omp_requires_mask != 0) > + return -1; > return hsa_context.agent_count; > } > --- a/libgomp/plugin/plugin-nvptx.c > +++ b/libgomp/plugin/plugin-nvptx.c > int > -GOMP_OFFLOAD_get_num_devices (void) > +GOMP_OFFLOAD_get_num_devices (unsigned int omp_requires_mask) > { > - return nvptx_get_num_devices (); > + int num_devices = nvptx_get_num_devices (); > + /* Return -1 if no omp_requires_mask cannot be fulfilled but > + devices were present. */ > + if (num_devices > 0 && omp_requires_mask != 0) > + return -1; > + return num_devices; > } > --- a/libgomp/target.c > +++ b/libgomp/target.c > @@ -4132,8 +4183,19 @@ gomp_target_init (void) > > if (gomp_load_plugin_for_device (¤t_device, plugin_name)) > { > - new_num_devs = current_device.get_num_devices_func (); > - if (new_num_devs >= 1) > + new_num_devs = current_device.get_num_devices_func (requires_mask); > + if (new_num_devs < 0) > + { > + [...] > + } > + else if (new_num_devs >= 1) > { > /* Augment DEVICES and NUM_DEVICES. */ OK to push the attached "nvptx: 'cuDeviceGetCount' failure is fatal"? Grüße Thomas