CUFFT FOR FORTRAN HOW TO USE

Hi, Nice to meet you.

I don’t know how to use 2D-CUFFT,3D-CUFFT for fortran

but, I can use 1D-CUFFT for fortran.

This is my program. ///

  module precision1
  integer, parameter, public :: Single = kind(0.0) ! Single precision
  integer, parameter, public :: Double = kind(0.0d0) ! Double precision
  integer, parameter, public :: fp_kind =kind(0.0)

c integer, parameter, public :: fp_kind =Double
end module precision1

  module cufft
  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_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

  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, batch,type
  end subroutine cufftPlan1d
  end interface cufftPlan1d

  interface cufftPlan2d
  subroutine cufftPlan2d(plan, nx,ny, type)
 &bind(C,name='cufftPlan2d')
  use iso_c_binding
  integer(c_int):: plan
  integer(c_int),value:: nx,ny,type
  end subroutine cufftPlan2d
  end interface cufftPlan2d


  interface cufftPlan3d
  subroutine cufftPlan3d(plan, nx,ny,nz, type)
 &bind(C,name='cufftPlan3d')
  use iso_c_binding
  integer(c_int):: plan
  integer(c_int),value:: nx,ny,nz,type
  end subroutine cufftPlan3d
  end interface cufftPlan3d


  interface cufftDestroy
  subroutine cufftDestroy(plan) bind(C,name='cufftDestroy')
  use iso_c_binding
  integer(c_int),value:: plan
  end subroutine cufftDestroy
  end interface cufftDestroy


  interface cufftExecC2C
  subroutine cufftExecC2C(plan, idata, odata, direction)
 &bind(C,name='cufftExecC2C')
  use iso_c_binding
  use precision1
  integer(c_int),value:: direction
  integer(c_int),value:: plan

c complex(fp_kind),device :: idata(),odata()
complex(fp_kind),device :: idata(),odata()
end subroutine cufftExecC2C
end interface cufftExecC2C

  interface cufftExecZ2Z
  subroutine cufftExecZ2Z(plan, idata, odata, direction)
 &bind(C,name='cufftExecZ2Z')
  use iso_c_binding
  use precision1
  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

C ----------------------------------------------------------------
C------------------- MAIN PROGRAM --------------------------------
program fft_test
use precision1
use cufft
complex(fp_kind) ,allocatable:: a( : )
complex(fp_kind),device,allocatable:: a_d( : )
integer:: n
integer:: plan
n=8
allocate (a(n))
allocate (a_d(n))
a=1
a_d=a
print *, “Array A:”
print *, a
call cufftPlan2D(plan,n,n,CUFFT_C2C,1)
a=a_d
print *, “Array A”
print *, a
deallocate (a)
deallocate (a_d)
call cufftDestroy(plan)
end program fft_test

########## FINISH ################

this is compile error

PGF90-S-0155-Could not resolve generic procedure cufftplan2d

http://cudamusing.blogspot.com/

please tell me… :">

You have too many arguments (five) in your call to cufftPlan2D

call cufftPlan2D(plan,n,n,CUFFT_C2C,1)

The interface is not able to select the function, it is expecting only 4 arguments:

interface cufftPlan2d
subroutine cufftPlan2d(plan, nx,ny, type)

end interface

You are also declaring 1D arrays.

You have too many arguments (five) in your call to cufftPlan2D

call cufftPlan2D(plan,n,n,CUFFT_C2C,1)

The interface is not able to select the function, it is expecting only 4 arguments:

interface cufftPlan2d
subroutine cufftPlan2d(plan, nx,ny, type)

end interface

You are also declaring 1D arrays.

thank you .

I can use 2D-cufft,3D-cufft.

thank you .

I can use 2D-cufft,3D-cufft.

I’m sorry.
I can not do still.

this is new compile error

#PGF90-S-0155-Could not resolve generic procedure cufftexecc2c

please tell me …

I’m sorry.
I can not do still.

this is new compile error

#PGF90-S-0155-Could not resolve generic procedure cufftexecc2c

please tell me …