================
@@ -93,7 +93,8 @@ EXTERN int omp_get_device_num(void) {
 EXTERN int omp_get_initial_device(void) {
   TIMESCOPE();
   OMPT_IF_BUILT(ReturnAddressSetterRAII RA(__builtin_return_address(0)));
-  int HostDevice = omp_get_num_devices();
+  int NumDevices = omp_get_num_devices();
+  int HostDevice = NumDevices == 0 ? -1 : NumDevices;
----------------
jprotze wrote:

The application will always see the value provided from libomp, which is 0 if 
no other device is present: 
https://github.com/llvm/llvm-project/blob/c05611f1917ca01371e7f7915f4c94055c5a19cf/openmp/runtime/src/kmp_ftn_entry.h#L1197

Only the get_num_devices call is deligated to libomptarget

https://github.com/llvm/llvm-project/pull/138294
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to