GCC OpenAcc executables problems

Alexander Monakov amonakov@ispras.ru
Mon Jan 4 18:29:00 GMT 2016


On Mon, 4 Jan 2016, Esteban Hernández wrote:
> I compile my source with
> 
> gcc pi.c -fopenacc -foffload=nvptx-none -foffload="-O3" -O3 -o gpu_a.x
> 
> 
> but when i run a example of phi the result is wrong, ./gpu_a.x
> pi=0.0000000000

Can you attach pi.c?

There are several ways you can troubleshoot this. You can use "GOMP_DEBUG=1
./gpu_a.x" to see if the device code is JIT-compiled successfully; "strace
-e open ./gpu_a.x" to see if device nodes (/dev/nvidia*) are opened at all.
Finally, try minimal examples (like assigning result of acc_on_device() to a
variable and then printing it).

> when i review the ptx code on executable, i obtain the following error
> 
> cuobjdump gpu_a.x
> cuobjdump info    : File 'gpu_a.x' does not contain device code

That is expected: GCC embeds device code differently from NVCC (and it seems
PGI invokes or mimics NVCC so layout is the same).  You can use "gcc
-save-temps -foffload=-save-temps" to make GCC dump PTX code, or if the kernel
is very short "GOMP_DEBUG=1 ./gpu_a.x" should work too.  Finally as a very
quick'n'dirty approach you can simply use "strings -a gpu_a.x".

Alexander


More information about the Gcc-help mailing list