如何调试Fortran 90编译错误“没有特定的子程序的通用'foo'在(1)”? [英] How to debug Fortran 90 compile error "There is no specific subroutine for the generic 'foo' at (1)"?

查看:591
本文介绍了如何调试Fortran 90编译错误“没有特定的子程序的通用'foo'在(1)”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用iso_c_bindings模块编写Fortran 2003绑定到CUFFT库,但我有 cufftPlanMany 子例程的问题(类似于 sfftw_plan_many_dft 在FFTW库中)。



绑定本身如下所示:

  
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

! cufftResult cufftPlanMany(cufftHandle * plan,int rank,int * n,
!int * inembed,int istride,int idist,
!int * onembed,int ostride,int odist,
!cufftType类型,int批)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!

interface cufftPlanMany
子程序cufftPlanMany(plan,rank,n,&
inembed,istride,idist,&
onembed,ostride,odist,&
类型,批处理)&
&bind(C,name ='cufftPlanMany')
使用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 ),onembed(*)
end subroutine cufftPlanMany
end interface cufftPlanMany

调用部分如下:

  
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 )

不幸的是尝试编译这个结果



< blockquote>

错误:没有通用的cufftplanmany在(1)


错误。尝试使用变量代替常量也没有帮助。

使用的编译器是 gfortran :GNU Fortran(Gentoo 4.4.5 p1.2,pie-0.4。你可以帮助调试这个吗?



< 5)4.4.5

解决方案

尝试给接口和子程序不同的名字,

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

解决方案

Try giving the interface and the subroutine different names, i.e., rename the interface.

这篇关于如何调试Fortran 90编译错误“没有特定的子程序的通用'foo'在(1)”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆