[cfe-users] omp_get_num_devices() returns 0 even though I have GPUs

mashilamani sambasivam via cfe-users cfe-users at lists.llvm.org
Sun Jul 5 05:00:30 PDT 2020


Hi,
  I figured it out. I hadnt downloaded the proper NVIDIA drivers.
https://linuxhint.com/ubuntu_nvidia_ppa/
proved useful to me.
Now I am able to detect my GPU.

Thanks much,
mashilamani

On Fri, Jul 3, 2020 at 11:11 AM mashilamani sambasivam <
kandanarul1976 at gmail.com> wrote:

>
> I forgot to mention that I am using the latest clang-llvm-openmp versions
> of source code (10.0.0).
> ---------- Forwarded message ---------
> From: mashilamani sambasivam <kandanarul1976 at gmail.com>
> Date: Fri, Jul 3, 2020 at 10:56 AM
> Subject: omp_get_num_devices() returns 0 even though I have GPUs
> To: <cfe-users at lists.llvm.org>
>
>
> Hi,
> I am trying to offload to my GPUs. I have GTX1060 6GB with compute
> capability of 6.1.
>
> I followed the instructions given in
>
> https://hpc-wiki.info/hpc/Building_LLVM/Clang_with_OpenMP_Offloading_to_NVIDIA_GPUs
>
> Then I compiled my helloworld program using the following environment
> variables:
> CFLAGS="-fopenmp -fopenmp-targets=nvptx64-sm_61 -pthread -I
> /usr/lib/gcc/x86_64-linux-gnu/9/include -O2
> --libomptarget-nvptx-path=$CLANG_HOME/lib --cuda-gpu-arch=sm_61"
>
> LD_LIBRARY_PATH=$CLANG_HOME/lib:$LD_LIBRARY_PATH
>
> CC=clang
>
> my helloworld program simply printfs omp_get_num_devices() after
> #including <omp.h>
>
> it compiles fine; but when i run it i get the number of devices as 0.
>
> Does someone have any idea?
> Thanks much,
> Mani
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20200705/2d196c7e/attachment.html>


More information about the cfe-users mailing list