Hi everybody
I am experiencing a problem with a device array. I declare it in a module as follows
real, allocatable, save, device :: d_coefx(:)
In the module, there is a subroutine that copies the host array to the device like that
d_coefx(:)=p%modeling%coefx(:)
after that, in the same subroutine, a kernel is executed within a loop
time: do nstep = 1,p%nt
call kernel<<<dimGrid, dimBlock>>>(p%modeling%order, p%nmin1, p%nmax1, p%nmin2, p%nmax2, d_p2, &
d_p3, d_v2, d_coefx)
xc(:)=d_coefx(:)
if(nstep .ge. 600 .and. nstep .le. 605)then
print*,'nstep',nstep
print*,xc
end if
end do time
the values of the device array are not modified inside the kernel, they are just read. Then, they are copied to a host array named xc and the array is printed. In step 603 one of the values is changed, in step 604 two values are changed, and finally, in step 605 three values are changed. This is the output
step 600
-3.6168982E-05 5.7870371E-04 -1.0850694E-03 5.7870371E-04
-3.6168982E-05
step 601
-3.6168982E-05 5.7870371E-04 -1.0850694E-03 5.7870371E-04
-3.6168982E-05
step 602
-3.6168982E-05 5.7870371E-04 -1.0850694E-03 5.7870371E-04
-3.6168982E-05
step 603
-0.4724865 5.7870371E-04 -1.0850694E-03 5.7870371E-04
-3.6168982E-05
step 604
-0.4724865 -0.4724865 -1.0850694E-03 5.7870371E-04
-3.6168982E-05
step 605
-0.4724865 -0.4724865 495.1141 5.7870371E-04
-3.6168982E-05
I really don’t understand where come from this values since the array is only used in that kernel and none overwrite operation is done with it. Does someone have a tip to try to catch the error?
Before of step 600 the values are kept without modifications