While trying to compile my code, I got the following error:
clang -fopenmp -omptargets=nvptx64sm_35-nvidia-linux -g -O3 -std=c99 Source.c -o source -L /home/rjordans/openmp4/lib -lm
clang-3.8: error: CUDA math library (libdevice) is required and cannot be found.
How can I solve this error?
I have never used clang to compile what you're trying, but in general
please ensure that your nvcc and friends are installed in your path
and the driver is loaded.
Typically it's recommended to run 'nvidia−smi' to see if stuff is
If that is - then a wild and probably wrong guess is to try -Wl,-rpath
and -Wl,-L where the libdevice is located
Assuming you are using clang-omp from GitHub (which is discontinued btw):
You have to put <CUDA_ROOT>/nvvm/libdevice into your $LIBRARY_PATH (not $LD_LIBRARY_PATH).
Clang should then automatically find the required files.