PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Beginner question on interface module

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
MichaelStrayer98762



Joined: 03 May 2012
Posts: 3

PostPosted: Wed Oct 03, 2012 11:02 am    Post subject: Beginner question on interface module Reply with quote

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
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 5871
Location: The Portland Group Inc.

PostPosted: Wed Oct 03, 2012 11:41 am    Post subject: Reply with quote

Hi Michael,

Quote:
What am I missing?
The "-Mcuda" flag to tell the compiler that is CUDA Fortran code. Alternately, you can use the ".cuf" extension in place of ".f90" to indicate that this a CUDA Fortran source file.

Note that "-acc" enables OpenACC.

Hope this helps,
Mat
Back to top
View user's profile
MichaelStrayer98762



Joined: 03 May 2012
Posts: 3

PostPosted: Wed Oct 03, 2012 1:30 pm    Post subject: Reply with quote

Thanks!

Mike
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group