Hi,
I have been troubling by the allocate statements in the device subroutines for quite a few days, and I can’t figure it out, however.
I give the compile environment firstly, I guess the compile option is the key to this problem.
Compile Environment:
PGI Visual Fortran 13.8 x64, Windows 7 x64, Visual Studio 2010
Fortran | Command Line
-gopt -Bstatic -Mbackslash -Mcuda=nofma,cuda5.0,cc35,cc3x,rdc -I"c:\program files\pgi\win64\13.8\include" -I"C:\Program Files\PGI\Microsoft Open Tools 11\include" -I"C:\Program Files (x86)\Windows Kits\8.0\Include\shared" -I"C:\Program Files (x86)\Windows Kits\8.0\Include\um" -Minform=informLinker | Command Line
-gopt -Bstatic -Mcuda=nofma,cuda5.0,cc35,cc3x,rdc -o “D:\Research\Programming\Routine\CUDA Fortran\test\x64\Debug\test.exe”
I wrote a test routine as follows:
module a_test
contains
attributes(global) subroutine kernel(a,n)
implicit none
integer,value :: n
integer,device :: a(n)
integer :: i
integer,device,allocatable :: b(:)
if (threadidx%x==1) then
allocate(b(n))
end if
call syncthreads()
i=threadIdx%x
b(i)=i
a(i)=b(i)
return
end subroutine kernel
end module
program prog
use a_test
use cudafor
implicit none
integer,parameter :: n=128
integer,device :: a_d(n)
integer :: a(n)
call kernel<<<1,128>>>(a_d,n)
a=a_d
write(*,*)a(10:20)
end program
When I ran it, errors occured at link procedure.
error message:
Compiling Project ...
Linking...
pgnvd-Error-Required tool nvlink was not found
pgnvd... looked for nvlink at c:\program files\pgi\win64/2013/cuda/5.0/bin\nvlink
child process exit with signal 1: c:\program files\pgi\win64\13.8\bin\pgnvd.exe
test build failed.
I searched the nvlink file on the whole disk and copyed it to the file folder, I ran it another time, and errors occured again.
error message:
Linking...
C:\Users\Administrator\AppData\Local\Temp\pgnvd3bty4b5LcTr5vB.s: Assembler messages:
C:\Users\Administrator\AppData\Local\Temp\pgnvd3bty4b5LcTr5vB.s:4: Warning: value 0xffed truncated to 0xed
C:\Users\Administrator\AppData\Local\Temp\pgnvd3bty4b5LcTr5vB.s:4: Warning: value 0xffba truncated to 0xba
C:\Users\Administrator\AppData\Local\Temp\pgnvd3bty4b5LcTr5vB.s:5: Warning: value 0xff80 truncated to 0x80
C:\Users\Administrator\AppData\Local\Temp\pgnvd3bty4b5LcTr5vB.s:6: Warning: value 0xffb3 truncated to 0xb3
C:\Users\Administrator\AppData\Local\Temp\pgnvd3bty4b5LcTr5vB.s:13: Warning: value 0xff80 truncated to 0x80
C:\Users\Administrator\AppData\Local\Temp\pgnvd3bty4b5LcTr5vB.s:15: Warning: value 0xffb7 truncated to 0xb7
test build failed.
Have I set the wrong compiler options and how can I do with the nvlink file?