GCC 9.2 and OpenMP offloading to GPUs

Alexander Monakov amonakov@ispras.ru
Wed Jan 29 12:44:00 GMT 2020


On Wed, 29 Jan 2020, dbroemmel wrote:

> 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,

Definition for that symbol is provided by libgcc.a from the offloading
compiler, namely mgomp.o member in the libgcc.a archive.

Note that OpenMP offloading in GCC uses additional code generation
conventions on top of "standard" PTX conventions (see documentation
for the option '-mgomp' in the manual), and for that reason support
libraries are multilibbed: installed tree has an mgomp/ subdirectory
with versions of libgomp.a, libgcc.a and others for OpenMP offloading.

mkoffload also knows to select the multilibs by passing -mgomp when
linking for OpenMP (i.e. when -fopenmp flag is present).

If you configured with --disable-multilib, or accidentally have old
mkoffload or incomplete install tree, that would explain the problem.

HTH
Alexander



More information about the Gcc-help mailing list