GCC 9.2 and OpenMP offloading to GPUs
dbroemmel
dibr-bugzilla@daswigwam.de
Wed Jan 29 15:22:00 GMT 2020
Hi Alexander,
thanks for the tip! This does seem to get me closer to solving the
problem. At least I now see activity on the GPU.
Where could I have come across this explanation and the hint that
--disable-multilib will result in an incomplete build?
We did configure with that switch (as we always do) and I was struggling
for a while to get it working without (building with 32-bit support
doesn't work, so eventually I've tried with --with-multilib-list=m64
instead - not sure this breaks things again).
For a somewhat longer example, even when compiled with
-foffload=-lgfortran
I now get
unresolved symbol _gfortran_os_error
collect2: error: ld returned 1 exit status
I suspect this is a similar problem?
Thanks!
On 29/01/2020 13:44, Alexander Monakov wrote:
> 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