GCC 9.2 and OpenMP offloading to GPUs
dbroemmel
dibr-bugzilla@daswigwam.de
Wed Jan 29 09:52:00 GMT 2020
Hi,
we've installed gcc-9.2 with offloading capability to Nvidia GPUs on our
system. A short example in either C++ or Fortran using OpenACC pragmas
does generate code that successfully performs offloading to the GPU.
This is verified by setting GOMP_DEBUG=1 or running nvprof.
The examples are compiled with either
gfortran -fopenacc test_oacc.F90
or
g++ -fopenacc test_oacc.cpp
nvprof in both cases then show a line like
GPU activities: 100.00% 3.22929s [...] MAIN__$_omp_fn$0
However, said short examples in neither C++ nor Fortran are successfully
built when using OpenMP pragmas for offloading. The compile commands are
gfortran -fopenmp test_omp.F90
or
g++ -fopenmp test_omp.cpp
and in both cases result in
unresolved symbol __nvptx_uni
collect2: error: ld returned 1 exit status
mkoffload: fatal error: x86_64-pc-linux-gnu-accel-nvptx-none-gcc
returned 1 exit status
compilation terminated.
lto-wrapper: fatal error: [...]/mkoffload returned 1 exit status
compilation terminated.
[...]/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
Linker and compiler are from different versions since we've installed
gcc-9.2 on-top of our existing setup. Adding -fno-lto as compile flag
does successfully compile a binary, but skips any offloading. GOMP_DEBUG
shows no OpenMP activity and nvprof only shows API calls, no actual kernels.
Adding --save-temps and checking test.s I can see the lines
// BEGIN GLOBAL VAR DECL: __nvptx_uni
.extern .shared .u32 __nvptx_uni[32];
Running strace along with the compiler, I can see mkoffload failing and
various accesses to crt*.o but not crt0.o which is where I suspect the
missing symbol comes from? This is, however, clutching at straws since
the OpenACC case also doesn't seem to touch crt0.o.
What are we missing here? Any hint appreciated, thanks,
Dirk
More information about the Gcc-help
mailing list