0

this is my code:

#include <cmath>
int main(){
    float f[100];
    #pragma acc parallel
    {
        #pragma acc loop
        for (int i = 0; i < 100; i++){
            f[i] = sin(i);
        }
    }
}

I installed g++-11 by running sudo apt install nvptx-tools gcc-11-offload-nvptx ,and I compiled my code by running g++-11 test.cpp -fopenacc -fcf-protection=none -o t,but I got errors as below:

unresolved symbol sin collect2: error: ld returned 1 exit status mkoffload: fatal error: x86_64-linux-gnu-accel-nvptx-none-gcc-11 returned 1 exit status compilation terminated. lto-wrapper: fatal error: /usr/lib/gcc/x86_64-linux-gnu/11//accel/nvptx-none/mkoffload returned 1 exit status compilation terminated. /usr/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status

and I added -foffload=-lm -lm, but it didn't work

Yeke Chen
  • 1
  • 1

0 Answers0