Hi,
I’m trying to run some samples from PVF 11.8 and a linker error comes up in some cases, and in others not.
The set project properties, among others, are
Fortran-> Language -> Enable CudaFortran -> yes
Target Accelarators -> Target NVIDIA Accelaratos -> yes
…
Linker Commnad Line:
-Bstatic -Mcuda -ta=nvidia,wait -o “D:\Projetos\PVFProject5\PVFProject5\Win32\Release\PVFProject5.exe”
For instance in the following case:
[/code]
program BandwidthTest
use TesteBndWidth
call Teste
end program BandwidthTest
Module TesteBndWidth
use cudafor
implicit none
integer, parameter :: nElements = 410241024
! host arrays
real(4) :: a_pageable(nElements), b_pageable(nElements) ! pageable host memory
real(4), allocatable, pinned :: a_pinned(:), b_pinned(:) ! pinned (aka page-locked) host memory, must be allocatable
! device arrays
real(4), device :: a_d(nElements), b_d(nElements)
! events for timing
type (cudaEvent) :: startEvent, stopEvent
! misc
type (cudaDeviceProp) :: prop
real(4) :: time
integer :: istat, i
logical :: pinnedFlag
contains
Subroutine Teste
! allocate and initialize
do i = 1, nElements
a_pageable(i) = i
end do
b_pageable = 0.0
allocate(a_pinned(nElements), b_pinned(nElements), STAT=istat, PINNED=pinnedFlag)
if (istat /= 0) then
write(,) ‘Allocation of a_pinned/b_pinned failed’
pinnedFlag = .false.
else
if (.not. pinnedFlag) write(,) ‘Pinned allocation failed’
end if
if (pinnedFlag) then
a_pinned = a_pageable
b_pinned = 0.0
endif
istat = cudaEventCreate(startEvent)
istat = cudaEventCreate(stopEvent)
! output device info and transfer size
istat = cudaGetDeviceProperties(prop, 0)
write(,)
write(,) 'Device: ', trim(prop%name)
write(,) 'Transfer size (MB): ', 4*nElements/1024./1024.
! pageable data transfers
write(,)
write(,) ‘Pageable transfers’
istat = cudaEventRecord(startEvent, 0)
a_d = a_pageable
istat = cudaEventRecord(stopEvent, 0)
istat = cudaEventSynchronize(stopEvent)
istat = cudaEventElapsedTime(time, startEvent, stopEvent)
write(,) ’ Host to Device bandwidth (GB/s): ', nElements4/time(1.e+3/1024**3)
istat = cudaEventRecord(startEvent, 0)
b_pageable = a_d
istat = cudaEventRecord(stopEvent, 0)
istat = cudaEventSynchronize(stopEvent)
istat = cudaEventElapsedTime(time, startEvent, stopEvent)
write(,) ’ Device to Host bandwidth (GB/s): ', nElements4/time(1.e+3/1024**3)
if (any(a_pageable /= b_pageable)) write(,) ‘*** Pageable transfers failed ***’
! pinned data transfers
if (pinnedFlag) then
write(,)
write(,) ‘Pinned transfers’
istat = cudaEventRecord(startEvent, 0)
a_d = a_pinned
istat = cudaEventRecord(stopEvent, 0)
istat = cudaEventSynchronize(stopEvent)
istat = cudaEventElapsedTime(time, startEvent, stopEvent)
write(,) ’ Host to Device bandwidth (GB/s): ', nElements4/time(1.e+3/1024**3)
istat = cudaEventRecord(startEvent, 0)
b_pinned = a_d
istat = cudaEventRecord(stopEvent, 0)
istat = cudaEventSynchronize(stopEvent)
istat = cudaEventElapsedTime(time, startEvent, stopEvent)
write(,) ’ Device to Host bandwidth (GB/s): ', nElements4/time(1.e+3/1024**3)
if (any(a_pinned /= b_pinned)) write(,) ‘*** Pinned transfers failed ***’
end if
! Device to Device transfer
write(,)
write(,) ‘Transfer between arrays on a (single) device’
istat = cudaEventRecord(startEvent, 0)
b_d = a_d
istat = cudaEventRecord(stopEvent, 0)
istat = cudaEventSynchronize(stopEvent)
istat = cudaEventElapsedTime(time, startEvent, stopEvent)
write(,) ’ Device bandwidth (GB/s): ', 2nElements4/time*(1.e+3/1024**3)
end subroutine Teste
end module
- Error 1 unresolved external symbol MAIN referenced in function _main f90main.obj
Error 2 1 unresolved externals D:\Projetos\PVFProject5\PVFProject5\Win32\Release\PVFProject5.exe