Hi adrianj,
You need to create pointers to the member arrays.
% cat test.f90
program dtypetest
implicit none
integer, parameter :: dp=selected_real_kind(15,300)
type :: e_d
complex(kind=dp), dimension(:), allocatable :: aa
complex(kind=dp), dimension(:), allocatable :: bb
real(kind=dp), dimension(:), allocatable ::r_aa
real(kind=dp), dimension(:), allocatable :: r_bb
end type e_d
complex(kind=dp), dimension(:), pointer :: aaptr
complex(kind=dp), dimension(:), pointer :: bbptr
real(kind=dp), dimension(:), pointer ::r_aaptr
real(kind=dp), dimension(:), pointer :: r_bbptr
type(e_d),target :: dataa
integer :: i
allocate(dataa%aa(10))
allocate(dataa%bb(10))
allocate(dataa%r_aa(10))
allocate(dataa%r_bb(10))
aaptr=>dataa%aa
bbptr=>dataa%bb
r_aaptr=>dataa%r_aa
r_bbptr=>dataa%r_bb
!$acc kernels loop independent
do i=1,10
aaptr(i) = cmplx(i,i)
bbptr(i) = cmplx(i,i)
r_aaptr(i) = real(i)
r_bbptr(i) = real(i)
end do
!$acc end kernels
write(*,*) dataa%aa
write(*,*) ' '
write(*,*) dataa%bb
write(*,*) ' '
write(*,*) dataa%r_aa
write(*,*) ' '
write(*,*) dataa%r_bb
deallocate(dataa%aa)
deallocate(dataa%bb)
deallocate(dataa%r_aa)
deallocate(dataa%r_bb)
end program
% pgf90 test.f90 -acc -Minfo=accel; a.out
dtypetest:
30, Generating copyout(r_bbptr(1:10))
Generating copyout(r_aaptr(1:10))
Generating copyout(bbptr(1:10))
Generating copyout(aaptr(1:10))
Generating NVIDIA code
31, Loop is parallelizable
Accelerator kernel generated
31, !$acc loop gang, vector(32) ! blockidx%x threadidx%x
(1.000000000000000,1.000000000000000) (2.000000000000000,2.000000000000000)
(3.000000000000000,3.000000000000000) (4.000000000000000,4.000000000000000)
(5.000000000000000,5.000000000000000) (6.000000000000000,6.000000000000000)
(7.000000000000000,7.000000000000000) (8.000000000000000,8.000000000000000)
(9.000000000000000,9.000000000000000) (10.00000000000000,10.00000000000000)
(1.000000000000000,1.000000000000000) (2.000000000000000,2.000000000000000)
(3.000000000000000,3.000000000000000) (4.000000000000000,4.000000000000000)
(5.000000000000000,5.000000000000000) (6.000000000000000,6.000000000000000)
(7.000000000000000,7.000000000000000) (8.000000000000000,8.000000000000000)
(9.000000000000000,9.000000000000000) (10.00000000000000,10.00000000000000)
1.000000000000000 2.000000000000000 3.000000000000000
4.000000000000000 5.000000000000000 6.000000000000000
7.000000000000000 8.000000000000000 9.000000000000000
10.00000000000000
1.000000000000000 2.000000000000000 3.000000000000000
4.000000000000000 5.000000000000000 6.000000000000000
7.000000000000000 8.000000000000000 9.000000000000000
10.00000000000000