This example is a very shortened version of what I am trying to do
in real code. I am trying to put an array on MIC, then pass the array to
a routine on the host, then do a loop in the routine on the MIC. If I put
the MIC loop inline, it works. But if I put it in a subroutine, it fails.
Thank you
Gene W
genew@cy015:~/testdir> cat subargprob1.F
program t
implicit none
real matrix(10000)
integer i
print *,'start'
print *,'b4 offload_transfer'
!dir$ offload_transfer target(mic:0) nocopy(matrix:
& alloc_if(.true.) free_if(.false.))
print *,'af offload_transfer'
!THE FOLLOWING CODE WORKS INLINE BUT FAILS IN SUBROUTINE
!dir$ offload target(mic:0) inout(matrix(1:10000):
& alloc_if(.false.) free_if(.false.))
!$omp parallel do
do i=1,10000
matrix(i)=i
end do
print '(a,z)','GW b4 call t3s2 loc(matrix)=',loc(matrix)
!CODE FAILS INSIDE THIS SUBROUTINE
call t3s2(matrix)
end
subroutine t3s2(matrix)
implicit none
real matrix(10000)
integer i
print *,'GW start t3s2'
print '(a,z)','GW inside t3s2 loc(matrix)=',loc(matrix)
!THE FOLLOWING CODE WORKS INLINE BUT FAILS IN SUBROUTINE
!dir$ offload target(mic:0) inout(matrix(1:10000):
& alloc_if(.false.) free_if(.false.))
!$omp parallel do
do i=1,10000
matrix(i)=i
end do
end
mpiifort -openmp subargprob1.F -o subargprob1 -list=subargprob1.list
./subargprob1
start
b4 offload_transfer
[Offload] [MIC 0] [File] subargprob1.F
[Offload] [MIC 0] [Line] 8
[Offload] [MIC 0] [Tag] Tag 0
[Offload] [HOST] [Tag 0] [CPU Time] 1.900814 (seconds)
[Offload] [MIC 0] [Tag 0] [MIC Time] 0.000000 (seconds)
af offload_transfer
[Offload] [MIC 0] [File] subargprob1.F
[Offload] [MIC 0] [Line] 13
[Offload] [MIC 0] [Tag] Tag 1
[Offload] [HOST] [Tag 1] [CPU Time] 0.659075 (seconds)
[Offload] [MIC 0] [Tag 1] [MIC Time] 0.323732 (seconds)
GW b4 call t3s2 loc(matrix)= 7FFFFFFF3890
GW start t3s2
GW inside t3s2 loc(matrix)= 7FFFFFFF3890
[Offload] [MIC 0] [File] subargprob1.F
[Offload] [MIC 0] [Line] 32
[Offload] [MIC 0] [Tag] Tag 2
offload error: cannot find data associated with pointer variable 0x7fffffff3890