问题
I am trying to write Fortran 2003 bindings to CUFFT library using iso_c_bindings module, but I have problems with cufftPlanMany
subroutine (similar to sfftw_plan_many_dft
in FFTW library).
The bindings itself look like this:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! cufftResult cufftPlanMany(cufftHandle *plan, int rank, int *n,
! int *inembed, int istride, int idist,
! int *onembed, int ostride, int odist,
! cufftType type, int batch)
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
interface cufftPlanMany
subroutine cufftPlanMany(plan, rank, n, &
inembed, istride, idist, &
onembed, ostride, odist, &
type, batch) &
& bind(C,name='cufftPlanMany')
use iso_c_binding
integer(c_int):: plan
integer(c_int),value:: rank, type, batch
integer(c_int):: n(*)
integer(c_int),value:: istride, idist, ostride, odist
integer(c_int):: inembed(*), onembed(*)
end subroutine cufftPlanMany
end interface cufftPlanMany
The calling part looks like this:
integer(c_int):: plan
integer(c_int):: batch
integer(c_size_t):: size
! ...
call cufftPlanMany(plan, 1, size,&
0, 1, size,&
0, 1, size,&
CUFFT_C2C, batch)
Unfortunately trying to compile this results in
Error: There is no specific subroutine for the generic 'cufftplanmany' at (1)
compilation error. Trying to use variables in place of constants didn't help either. Could you help with debugging this?
The compiler used is gfortran: GNU Fortran (Gentoo 4.4.5 p1.2, pie-0.4.5) 4.4.5
回答1:
Try giving the interface and the subroutine different names, i.e., rename the interface.
回答2:
I think your types for dummy arguments do not conform to the actual arguments in your call. Why do you declare n, inembed, onembed as arrays, when they should be int*, eg. just passed as integer from fortran? Also, are sure that you can interchange int and size_t? I am worried that size_t might be 64 bit and int 32 bit in gcc on your system.
来源:https://stackoverflow.com/questions/8044568/how-to-debug-fortran-90-compile-error-there-is-no-specific-subroutine-for-the-g