Hi everyone, OpenACC newbie here.
When I compile the following code with PGI 13.6, I get:
on device, dq(5) = 0.000000
on host, dq(5) = 5.000000
Should the first value (“on device”) be 0.0 or 5.0? I was
expecting 5.0, but perhaps I don’t understand what’s
happening here?
Thanks,
Eric
program deviceptr
implicit none
integer :: i
real, dimension(:), pointer :: dq
allocate(dq(10))
dq(:) = 0.0
!$acc data copy(dq)
!$acc parallel present(dq)
do i = 1, 10
dq(i) = real(i)
end do
!$acc end parallel
!$acc host_data use_device(dq)
write(*,*) 'on device, dq(5) = ', dq(5)
!$acc end host_data
!$acc end data
write(*,*) 'on host, dq(5) = ', dq(5)
end program deviceptr
[/code][/quote]