What should `omp_get_num_devices()` return?

Date: Mon, 9 Nov 2020 17:06:12 +0000
From: Simone Atzeni via Openmp-dev <openmp-dev@lists.llvm.org>

I have a general question on the behavior of omp_get_num_devices(), which seems to be interpreted differently across different compiler vendors (I tried Clang/LLVM and IBM XL).

The device side implementation of omp_get_num_devices() in clang returns 0, see https://github.com/llvm/llvm-project/blob/master/openmp/libomptarget/deviceRTLs/common/src/libcall.cu for the implementation.

That is standards conforming if I understand correctly, but not particularly convenient for the user. A downstream fork adds a couple of fields to the global omptarget_device_environment to implement get_num_devices and get_device_num.

I can put a patch together for this.