Unexpected crash when manipulating a 3D array in a derived type

Hi all,

See the following Fortran code accelerated with OpenACC, which is manipulating a 3D allocatable array which is a field of a derived type:

cat test.f90
program test
  implicit none
  type t
    real, allocatable, dimension(:,:,:) :: x
  end type
  type(t) :: a
  allocate(a%x(1,1,1))
  a%x(:,:,:) = 1.
  !$acc enter data copyin(a,a%x)
  !$acc kernels default(present)
  a%x(:,:,:) = a%x(:,:,:) + 1.
  !$acc end kernels
  !$acc update self(a%x)
  print*,a%x(:,:,:)
end

The code crashes on my (Pascal) card:

nvfortran -acc -Minfo=accel -g -traceback  test.f90 && ./a.out
test:
      9, Generating enter data copyin(a%x(:,:,:),a)
     10, Generating default present(a,a%x(:,:,:))
     11, Loop is parallelizable
         Generating NVIDIA GPU code
         11,   ! blockidx%x threadidx%x auto-collapsed
             !$acc loop gang, vector(128) collapse(3) ! blockidx%x threadidx%x
     13, Generating update self(a%x(:,:,:))
Present table dump for device[1]: NVIDIA Tesla GPU 0, compute capability 6.1, threadid=1
host:0x4102e0 device:0x7ff623efa000 size:240 presentcount:1+1 line:9 name:a
host:0xc0d2c0 device:0x7ff623efa200 size:4 presentcount:0+1 line:9 name:(null)
allocated block device:0x7ff623efa000 size:512 thread:1
allocated block device:0x7ff623efa200 size:512 thread:1
FATAL ERROR: variable in data clause is partially present on the device: name=(unknown)

But doesn’t crash if the array is 2D or 1D. Is there anything incorrect about my implementation?

Thank you in advance!

Pedro

Hi Pedro,

The “default(present)” is causing the issue. Replacing this with “present(a)” will work around the problem.

-Mat

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.