I’m trying to put together an interface module to access cuFFT from fortran. I’m starting with an example I found on the web but I am running to a syntax error when I try to specify device data.
The code is
module cufft
!---------------------------------------------------------------------
! Define interface to NVIDIA cuFFT library
!---------------------------------------------------------------------
implicit none
integer, public :: CUFFT_FORWARD = -1
integer, public :: CUFFT_INVERSE = 1
integer, public :: CUFFT_R2C = Z’2a’ ! Real to Complex(interleaved)
integer, public :: CUFFT_C2R = Z’2c’ ! Complex (interleaved) to Real
integer, public :: CUFFT_C2C = Z’29’ ! Complex to Complex (interleaved)
integer, public :: CUFFT_S2Z = 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’)
use iso_c_binding
integer(c_int) :: plan
integer(c_int),value :: nx
integer(c_int),value :: batch
integer(c_int),value :: 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(cufftHanle 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
integer(c_int),value :: plan
integer(c_int),value :: direction
complex(dp_kind), device, dimension() :: idata
complex(dp_kind), device, dimension() :: odata[/b]
end subroutine cufftExecC2C
end interface cufftExecC2C
end module
When I try to compile this i get
Z:\fft>pgfortran -fast -acc -Minfo -tp=sandybridge-64 -c cufft.f90
PGF90-S-0034-Syntax error at or near device (cufft.f90: 52)
PGF90-S-0034-Syntax error at or near device (cufft.f90: 53)
0 inform, 0 warnings, 2 severes, 0 fatal for cufft
What am I missing?
Thanks