I welcome all,
I am a new user for PGI CUDA Fortran.
I try to run the example. I work in the VS2010.
In the project settings, I have included all that is possible. Nevertheless when compiling I get an error.
The set project properties:
FORTRAN:
General>Additional Include Directories:
“c:\ProgramFiles\Intel\MKL\10.2.6.037\include”
“c:\ProgramFiles\Intel\MKL\10.2.6.037\include\em64t\lp64”
“c:\ProgramFiles\Intel\MKL\10.2.6.037\include\em64t\ilp64”
“c:\ProgramFiles\PGI\win64\2010”
“c:\ProgramFiles\PGI\win64\10.8\include”
Code Generation> Runtime Library: Multi-threaded (-Bstatic)
Language> Enable CUDA Fortran: Yes
Command Line:
-V -Mpreprocess -g -Bstatic -Mbackslash -Mextend -mp -Mcuda=fastmath,keepbin,keepgpu -I"“c:\ProgramFiles\Intel\MKL\10.2.6.037\include”" -I"“c:\ProgramFiles\Intel\MKL\10.2.6.037\include\em64t\lp64"” -I"“c:\ProgramFiles\Intel\MKL\10.2.6.037\include\em64t\ilp64"” -I"“c:\ProgramFiles\PGI\win64\2010"” -I"“c:\ProgramFiles\PGI\win64\10.8\include”" -I"c:\Program Files\Intel\MKL\10.2.6.037\include\em64t\lp64" -I"c:\Program Files\Intel\MKL\10.2.6.037\include\em64t\ilp64" -I"c:\Program Files\Intel\MKL\10.2.6.037\em64t\bin" -I"c:\Program Files\Intel\MKL\10.2.6.037\inlude" -I"c:\Program Files\PGI\win64\10.8\src" -I"c:\Program Files\PGI\win64\10.8\include" -I"C:\Program Files\PGI\Microsoft Open Tools 10\include" -I"C:\Program Files\PGI\Microsoft Open Tools 10\PlatformSDK\include" -I"c:\program files\pgi\win64\10.8\include" -Minform=inform -Minfo=ftn
Additional options: -ta=nvidia -lcufft
LINKER:
General>Additional Library Directories:
“c:\ProgramFiles\Intel\MKL\10.2.6.037\em64t\lib”
“c:\ProgramFiles\PGI\win64\10.8\lib”
“c:\ProgramFiles\PGI\win64\2010\cuda\2.3\lib”
“c:\ProgramFiles\NVIDIAGPUComputingToolkit\CUDA\v.4.0\lib\x64”
Additional Dependencies:
“c:\Program Files\Intel\MKL\10.2.6.037\em64t\lib\mkl_pgi_thread.lib”
“c:\Program Files\Intel\MKL\10.2.6.037\em64t\lib\mkl_core.lib”
“c:\Program Files\Intel\MKL\10.2.6.037\em64t\lib\libiomp5md.lib”
“c:\Program Files\PGI\win64\2010\cuda\2.3\lib\cudart.lib”
“c:\Program Files\PGI\win64\2010\cuda\3.1\lib\cudart.lib”
“c:\Program Files\Intel\MKL\10.2.6.037\em64t\lib\mkl_intel_thread.lib”
[My code]
module cufft
! CUFFT Transform Directions:
integer, public :: CUFFT_FORWARD = -1
integer, public :: CUFFT_INVERSE = 1
! CUFFT Transform Types:
integer, public :: CUFFT_R2C = Z’2a’ ! Real to Complex (interleaved) (interleaved - )
integer, public :: CUFFT_C2R = Z’2c’ ! Complex (interleaved) to Real
integer, public :: CUFFT_C2C = Z’29’ ! Complex to Complex, interleaved
integer, public :: CUFFT_D2Z = Z’6a’ ! Double to Double-Complex
integer, public :: CUFFT_Z2D = Z’6c’ ! Double-Complex to Double
integer, public :: CUFFT_Z2Z = Z’69’ ! Double-Complex to Double-Complex
!!!
! cufftPlan1d(cufftHandle *plan, int nx,cufftType type,int batch)
!!!
interface cufftPlan1d
subroutine cufftPlan1d(plan, nx, type, batch) bind(C,name=‘cufftPlan1d’)!bind -
use iso_c_binding
integer(c_int):: plan
integer(c_int),value:: nx, batch,type
end subroutine cufftPlan1d
end interface cufftPlan1d
!!!
! cufftDestroy(cufftHandle plan)
!!!
interface cufftDestroy
subroutine cufftDestroy(plan) bind(C,name=‘cufftDestroy’)
use iso_c_binding
integer(c_int),value:: plan
end subroutine cufftDestroy
end interface cufftDestroy
!!!
! cufftExecC2C(cufftHandle plan,
! cufftComplex *idata,
! cufftComplex *odata,
! int direction)
!!!
interface cufftExecC2C
subroutine cufftExecC2C(plan, idata, odata, direction) bind(C,name=‘cufftExecC2C’)
use iso_c_binding
!!use precision
!!use f95_precision
!!use mkl95_precision
integer(c_int),value:: direction
integer(c_int),value:: plan
complex(fp_kind),device:: idata(),odata()
end subroutine cufftExecC2C
end interface cufftExecC2C
!!!
! cufftExecZ2Z(cufftHandle plan,
! cufftDoubleComplex *idata,
! cufftDoubleComplex *odata,
! int direction);
!!!
interface cufftExecZ2Z
subroutine cufftExecZ2Z(plan, idata, odata, direction) bind(C,name=‘cufftExecZ2Z’)
use iso_c_binding
!!use precision
!!use f95_precision
!!use mkl95_precision
integer(c_int),value:: direction
integer(c_int),value:: plan
complex(fp_kind),device:: idata(),odata()
end subroutine cufftExecZ2Z
end interface cufftExecZ2Z
end module cufft
PROGRAM fft_test
use cufft
complex(fp_kind) ,allocatable:: a(:),b(:)
complex(fp_kind),device,allocatable:: a_d(:),b_d(:)
integer:: n
integer:: plan
n=8
! allocate arrays on the host
allocate (a(n),b(n))
! allocate arrays on the device
allocate (a_d(n))
allocate (b_d(n))
!initialize arrays on host
a=1
!copy arrays to device
a_d=a
! Print initial array
print *, “Array A:”
print *, a
! Initialize the plan
call cufftPlan1D(plan,n,CUFFT_Z2Z,1)
! Execute FFTs
call cufftExecZ2Z(plan,a_d,b_d,CUFFT_FORWARD)
call cufftExecZ2Z(plan,b_d,b_d,CUFFT_INVERSE)
! Copy results back to host
b=b_d
! Print initial array
print *, “Array B”
print *, b
!release memory on the host
deallocate (a,b)
!release memory on the device
deallocate (a_d,b_d)
! Destroy the plan
call cufftDestroy(plan)
END PROGRAM fft_test
The result of compiling:
Compiling Project …
E:\FFTdevice.f90
PGF90/x86-64 Windows 10.8-0
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2010, STMicroelectronics, Inc. All Rights Reserved.
E:\FFTdevice.f90(0) : warning W0006 : Input file empty
PGF90/x86-64 Windows 10.8-0: compilation completed with warnings
PGF90/x86-64 Windows 10.8-0
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2010, STMicroelectronics, Inc. All Rights Reserved.
pgfortran 10.8-0 64-bit target on x86-64 Windows -tp core2-64
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2010, STMicroelectronics, Inc. All Rights Reserved.
Linking…
libcmt.lib(crt0.obj) : error LNK2019: unresolved external symbol main referenced in function __tmainCRTStartup
D:\Projects\PVFProject5\PVFProject5\x64\Debug\PVFProject5.exe : fatal error LNK1120: 1 unresolved externals
PVFProject5 build failed.
Build log was saved at file://D:\Projects\PVFProject5\PVFProject5\x64\Debug\BuildLog.htm
Please, tell me, what is my mistake ?!
AVK