[Openmp-dev] What should `omp_get_num_devices()` return?

Jon Chesterfield via Openmp-dev openmp-dev at lists.llvm.org
Wed Nov 11 06:54:19 PST 2020


>
> Date: Mon, 9 Nov 2020 17:06:12 +0000
> From: Simone Atzeni via Openmp-dev <openmp-dev at 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.

Thanks,

Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20201111/9069e61d/attachment.html>


More information about the Openmp-dev mailing list