I’m using pgi/16.5 ( or 16.1 & cuda7.5 or 8.0RC ) and testing managed memory in fortran on MESONH , a big Frecnh Fortran90 Weather Model .
A present time the code compile with managed memory , run incorrectly ( Nan ) on nvidia , and “seg fault” on host .
Here is a sample test case with fortran pointer showing/doing the “seg faut” on the host part , but not in the nvidia part ( Maxwell/K620 or Kepler/Titan or K40 )
I’ve no seen in the doc on managed memory any limitation on using pointer with managed memory .
One of the big advantage/goal of this one been precisely to simplify derive-type management & pointer usage !
PROGRAM MANAG_POINTER IMPLICIT NONE REAL , DIMENSION(:), POINTER , CONTIGUOUS :: ZTAB !REAL , DIMENSION(:), ALLOCATABLE :: ZTAB ALLOCATE(ZTAB(1000000)) !$acc kernels copyout(ZTAB) ZTAB = 10.767867868 !$acc end kernels print*,'ZTAB=',ZTAB(123456) END PROGRAM MANAG_POINTER
Compiled with managed memory
pgf90 -Mcuda -ta=host,tesla:managed -Minfo=acc manag_pointer.f90 -o manag_pointer manag_pointer: 10, Generating copyout(ztab(:)) 11, Loop is parallelizable Accelerator kernel generated Generating Tesla code 11, !$acc loop gang, vector(128) ! blockidx%x threadidx%x
Running it on nvidia kepler/maxwell , no problem
CUDA_VISIBLE_DEVICES=1 ACC_DEVICE=NVIDIA ./manag_pointer ZTAB= 10.76787
Running on the host = Seg Fault
CUDA_VISIBLE_DEVICES=1 ACC_DEVICE=HOST ./manag_pointer Erreur de segmentation
Changing the pointer to allocatable ( or removing the managed otion ) solve the problem but it is not applicable for us ( big code with lot of derive type + pointer ) .
For our big code it very important to have in the same executable the double target host/tesla:managed at the same time to track ‘bit reproducible’ problems .
REM : with the allocatable , I got also a “seg fault” without the ‘-Mcuda’ option