OpenACC Compile Issues

I am trying to compile C++ code using OpenACC. The serial version of the code works just fine. The code runs with OpenMP, too. So I am not sure what is wrong with OpenACC. One solution online said I needed to run “sudo apt install gcc-offload-nvptx”. However this did not fix my errors below. Maybe I need to add the path or something?

lto1: error: ‘-fcf-protection=full’ is not supported for this target
mkoffload: fatal error: /usr/bin/x86_64-linux-gnu-accel-nvptx-none-gcc-9 returned 1 exit status
compilation terminated.
lto-wrapper: fatal error: /usr/lib/gcc/x86_64-linux-gnu/9//accel/nvptx-none/mkoffload returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

I should note that the errors above only show up when I add this statement “#pragma acc parallel reduction (+:sum)”. When I just find the package and link the target libraries, things work fine.

Hi eb1064,

Sorry I don’t use the GNU compilers myself too often but you might try using a newer version such as 10.2 since I believe their support for OpenACC has gotten better in recent releases. Looks like you’re using g++ 9.

You can also use the NVIDIA HPC nvc++ C++ compiler instead which has support for OpenACC.