代码如下
module atest
contains
attributes(global) subroutine kerneltest(a,n)
integer,device::a(n)
integer,value::n
integer::i
i=threadIdx%x
a(i)=i
end subroutine
end module
program test
use cudafor
use atest
implicit none
integer,allocatable,target,device::a_d(
integer,pointer,device::b_d(
integer,parameter::n=512
integer,target::a(n)
integer,pointer::b(
integer::istat,i
!host 指针
do i=1,n
a(i)=i*i
end do
b=>a
do i=1,10
open(1,file= '../data/test.dat',status='unknown')
write(1,*)b(i)
end do
istat=cudafree(a_d)
end program
~
~在编译的时候总是出现
pgfortran -Mcuda=cuda3.0 kk.f90 -o ../bin/mod_b_test
PGF90-S-0134-Illegal attribute - conflict with device (kk.f90: 16)
PGF90-S-0134-Illegal attribute - conflict with device (kk.f90: 17)
请问该问题如何解决? |