Hi,Mat
Thanks for your reply, the “present” clause did not solved the error. Here is a test case of my project. It occurs the same mistake and puzzled me for many days.
subroutine inline_kernels(flag,xdim,ydim,zdim,a,b,
+ aa,bb,c, d, e, f)
use openacc
implicit none
c use data_f
integer(4) :: y, x,z,xdim,ydim,zdim
integer flag
real a(xdim-1,ydim-1,zdim-1),b(xdim-1,ydim-1,zdim-1),
+ c(xdim-1,ydim-1,zdim-1),d(xdim-1,ydim-1,zdim-1),
+ aa(xdim-1,ydim-1,zdim-1),bb(xdim-1,ydim-1,zdim-1),
+ f(xdim-1,ydim-1,zdim-1),e(xdim-1,ydim-1,zdim-1)
!$acc data copyin(a,aa,bb,
!$acc& b,c,d) copyout(e,f)
!$acc parallel present(a,b,c,d,f,aa,bb,
!$acc& e)
if (flag .eq. 1) then
!$acc loop independent
do x=1,xdim-1
do y=1,ydim-1
do z=1,zdim-1
e(x, y, z)= a(x, y, z)+ b(x, y, z)
end do
end do
end do
else if (flag .NE. 1) then
!$acc loop independent
do x=1,xdim-1
do y=1,ydim-1
do z=1,zdim-1
e(x, y, z)= c(x, y, z)* d(x, y, z)
f(x, y, z)= aa(x, y, z)* bb(x, y, z)
end do
end do
end do
end if
!$acc end parallel
!$acc end data
end
program main
implicit none
real, allocatable :: c(:,:,:), d(:,:,:),e(:,:,:),f(:,:,:)
real, allocatable :: a(:,:,:), b(:,:,:),aa(:,:,:),bb(:,:,:)
integer :: x, y, z,ii,xdim,ydim,zdim
integer :: fail_x, fail_y, fail_z
integer test,flag
real xi,yi,zi
flag = 1
xdim=256
ydim=256
zdim=10
allocate(c(xdim-1,ydim-1,zdim-1))
allocate(d(xdim-1,ydim-1,zdim-1))
allocate(e(xdim-1,ydim-1,zdim-1))
allocate(f(xdim-1,ydim-1,zdim-1))
allocate(a(xdim-1,ydim-1,zdim-1))
allocate(aa(xdim-1,ydim-1,zdim-1))
allocate(b(xdim-1,ydim-1,zdim-1))
allocate(bb(xdim-1,ydim-1,zdim-1))
a(:,:,:) = 2.0d0
b(:,:,:) = 3.0d0
aa(:,:,:) = 2.0d0
bb(:,:,:) = 3.0d0
c(:,:,:) = 2.0d0
d(:,:,:) = 3.0d0
e(:,:,:) = 0.0d0
f(:,:,:) = 0.0d0
test = 1
do ii=1,100
call random_number(xi)
call random_number(yi)
call random_number(zi)
xdim = floor(xi*100)+50
ydim = floor(yi*100)+50
zdim = floor(zi*100)+50
call inline_kernels(flag,xdim,ydim,zdim,a,b,aa,bb,c, d, e, f)
write(6,*) "ii=",ii
enddo
write(6,*) "calculation complete"
do y=1,xdim-1
do x=1,ydim-1
do z=1,zdim-1
if (test .EQ. 1 .AND. flag .EQ. 1
+ .AND. e(x, y, z) .NE. 5.0d0) then
test = 2
fail_x = 10
fail_y = y
fail_z = z
end if
if (test .EQ. 1 .AND. flag .NE. 1
+ .AND. f(x, y, z) .NE. 6.0d0) then
test = 2
fail_x = 20
fail_y = y
fail_z = z
end if
end do
end do
end do
if (test .EQ. 1) then
write(6,*) "test ok"
else
write(6,*) "test failed"
write(6,*) "fails at", fail_x, fail_y, fail_z, "E:",
+ e(fail_x, fail_y, fail_z), "F:", f(fail_x, fail_y, fail_z)
end if
deallocate(a)
deallocate(b)
deallocate(aa)
deallocate(bb)
deallocate(c)
deallocate(d)
deallocate(e)
deallocate(f)
stop
end program main
And here is my compile command
mpif90 inline_kernels.F data_test_0403.F -acc -Minfo=accel -ta=tesla -g -c
mpif90 -acc *.o -o test
Here is the error report
$ ./test
ii= 1
aa lives at 0x7f5e8906ba70 size 7397376 partially present
Present table dump for device[1]: NVIDIA Tesla GPU 0, compute capability 6.0, threadid=1
host:0x7f5e892a8860 device:0x7f5e66400000 size:7397376 presentcount:1+0 line:13 name:a
allocated block device:0x7f5e66400000 size:7397376 thread:1
deleted block device:0x7f5e62c00000 size:2079744 thread 1
deleted block device:0x7f5e62e00000 size:2079744 thread 1
deleted block device:0x7f5e63000000 size:2079744 thread 1
deleted block device:0x7f5e63200000 size:2079744 thread 1
deleted block device:0x7f5e63400000 size:2079744 thread 1
deleted block device:0x7f5e63600000 size:2079744 thread 1
deleted block device:0x7f5e63800000 size:2079744 thread 1
deleted block device:0x7f5e63a00000 size:2079744 thread 1
FATAL ERROR: variable in data clause is partially present on the device: name=aa
file:/home/data_test/inline_kernels.F inline_kernels line:13