Clang: error: no library 'libomptarget-new-nvptx-sm_35.bc' found in the default clang

Hello,

I hope you are all fine and look forward to your help.

I am trying to compile and run, on a GPU NVIDIA GeForce GTX 1060, a C program using Linux Ubuntu 22.04.1 LTS.

First I followed these steps to install LLVM: Install LLVM on Ubuntu 22.04 (linuxhint.com)

I tried to compile this program:

#include

int main(){
int N = 1e8;
float *x = new float[N];
float *y = new float[N];

#pragma omp target teams distribute parallel for map(to: x[0:N]) map(from: y[0:N])
for(int i = 0; i < N; i++){
for(int j = 0; j < 1000; j++){
y[i] += 3*x[i];
}
}

printf(“%g\n”, y[5]);

delete x;
delete y;
}

Script to compile: clang++ -fopenmp -fopenmp-targets=nvptx64 -O3 run.cpp && time ./a.out

And I received the error on the subject.

Then I followed these steps: Build Clang with OpenMP Target Offloading for NVIDIA GPUs · GitHub

And I received the same error.

So now, my questions are:

  1. How can I compile and run, on the indicated GPU, the program above, using LLVM?
  2. How can I determine which versions of LLVM (clang) I have installed in my Linux?
  3. How can I remove from my Linux the versions of LLVM that I am not interested in having?

Thank you very much in advance.

Best regards,
David.

The build steps there are outdated and may not work anymore, use the CMake flags described in our FAQ:
https://openmp.llvm.org/SupportAndFAQ.html#q-how-to-build-an-openmp-gpu-offload-capable-compiler