Nvfortran with gpu flags

I am trying to compile my code using nvfortran, so far I am not using any gpu yet (no do concurrent, no omp, etc).
If i compile my code with only the options “-O3 -Wall -Minfo=all” everythng works fine, but as soon as I add also “-stdpar=gpu” I get a segmentation fault after allocating an array. If insetad I use “-stdpar=multicore” everything works fine.

The allocation that generates the seg fault is:
integer(kind=i4), intent(in) :: npart
newcorpsi%npair=npair

allocate(newcorpsi%pair(newcorpsi%npart,newcorpsi%npart))

and that array is definied in a type as

integer(kind=i4), allocatable :: pair(:,:)

The error given at execution is
[payne:330187:0:330187] Caught signal 11 (Segmentation fault: address not mapped to object at address 0x39)
BFD: DWARF error: section .debug_info is larger than its filesize! (0x5d4f30 vs 0x436a28)
BFD: DWARF error: section .debug_info is larger than its filesize! (0x5d4f30 vs 0x436a28)
BFD: DWARF error: section .debug_info is larger than its filesize! (0x5d4f30 vs 0x436a28)
BFD: DWARF error: section .debug_info is larger than its filesize! (0x5d4f30 vs 0x436a28)
BFD: DWARF error: section .debug_info is larger than its filesize! (0x5d4f30 vs 0x436a28)
BFD: DWARF error: section .debug_info is larger than its filesize! (0x5d4f30 vs 0x436a28)
BFD: DWARF error: section .debug_info is larger than its filesize! (0x5d4f30 vs 0x436a28)
BFD: DWARF error: section .debug_info is larger than its filesize! (0x5d4f30 vs 0x436a28)
==== backtrace (tid: 330187) ====
0 0x0000000000042520 sigaction() ???:0
1 0x00000000000a53fe free() ???:0
2 0x00000000004546fe wavefunction_setpsi
() /home/stefano/home/nuclear/newafdmc/f90/opwavenuclei.f90:355
3 0x00000000004073a4 MAIN
() /home/stefano/home/nuclear/newafdmc/f90/afnuclear.f90:303
4 0x0000000000404af1 main() ???:0
5 0x0000000000029d90 __libc_init_first() ???:0
6 0x0000000000029e40 __libc_start_main() ???:0
7 0x00000000004049e5 _start() ???:0

[payne:330187] *** Process received signal ***
[payne:330187] Signal: Segmentation fault (11)
[payne:330187] Signal code: (-6)
[payne:330187] Failing at address: 0x3d85000509cb
[payne:330187] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x77261e42520]
[payne:330187] [ 1] /lib/x86_64-linux-gnu/libc.so.6(free+0x1e)[0x77261ea53fe]
[payne:330187] [ 2] afnucmatmpinew[0x4546fe]
[payne:330187] [ 3] afnucmatmpinew[0x4073a4]
[payne:330187] [ 4] afnucmatmpinew[0x404af1]
[payne:330187] [ 5] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x77261e29d90]
[payne:330187] [ 6] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x77261e29e40]
[payne:330187] [ 7] afnucmatmpinew[0x4049e5]
[payne:330187] *** End of error message ***

Any idea?
Thanks,
Stefano

Hi Stefano,

The only major difference when compiling with “-gpu=stdpar” would be that the memory is being allocated in CUDA managed memory, but that shouldn’t cause this.

The actual segv is happening in a “free” which doesn’t quite correspond with the posted code so I’m not sure what’s going on.

Are you able to provide a reproducing example?

Thanks,
Mat

Though, can you try compiling with “-gpu=mem:separate”? This will have the compiler not use managed.

Also, are you compiling all files with “-gpu=stdpar”? One thing that could be happening is that if something is allocated with managed, but free’d in a different file not using managed, it could cause this error.

Ah, that’s was the problem! I was compiling with “-gpu=stdpar” just one file (the one where I’ll ad the gpu stuff), and not the others. After compiling everything with that option, I don’t get the seg fault anymore.

Thanks again!
Stefano