"cannot find libdevice for sm_"

Hello,

I have installed clang12 with OpenMP target-offload on a cluster of v100 nodes using cuda 10.1 and gcc 8.2.

When I try to test it:

clang -c -I…/common -O3 -g -fopenmp -fopenmp-targets=nvptx64-nvida-cuda -Xopenmp-target=nvptx64-nvidia-cuda -march=sm_70 -mcmodel=medium -DCRPL_COMP=0 ft.c

clang-12: error: cannot find libdevice for sm_

with a blank architecture.

I have the openmp target bc libraries

lrwxrwxrwx 1 gjost scicon 19 Aug 21 14:39 libRemarks.so → libRemarks.so.12git

-rw-r–r-- 1 gjost scicon 69656 Aug 21 14:52 libomptarget-nvptx-sm_35.bc

-rw-r–r-- 1 gjost scicon 69196 Aug 21 14:52 libomptarget-nvptx-sm_70.bc

-rw-r–r-- 1 gjost scicon 69608 Aug 21 14:52 libomptarget-nvptx-sm_60.bc

lrwxrwxrwx 1 gjost scicon 9 Aug 21 15:07 libgomp.so → libomp.so

lrwxrwxrwx 1 gjost scicon 9 Aug 21 15:07 libiomp5.so → libomp.so

The only place in the llvm code where I see a message like this is here:

grep “cannot find libdevice for sm_” llvm-project/clang/test/Driver/cuda-detect.cu

// MISSINGLIBDEVICE: error: cannot find libdevice for sm_20.

pfe25.gjost 69> grep MISSINGLIBDEVICE llvm-project/clang/test/Driver/cuda-detect.cu

// RUN: | FileCheck %s -check-prefix COMMON -check-prefix MISSINGLIBDEVICE

// RUN: | FileCheck %s -check-prefix COMMON -check-prefix MISSINGLIBDEVICE

// MISSINGLIBDEVICE: error: cannot find libdevice for sm_20.

Hi Jost, most probably the compiler cannot correctly find CUDA installation or cannot detect its version correctly. Check, if your CUDA installation directiry has version.txt file.