【问题标题】:Issue when linking cuBLAS subroutine (FORTRAN binding) with FORTRAN subroutines将 cuBLAS 子例程(FORTRAN 绑定)与 FORTRAN 子例程链接时出现问题
【发布时间】:2014-06-15 18:47:13
【问题描述】:

我正在尝试使用 GPU 优化一些分子模拟代码(完全用 fortran 编写)。我开发了一个小子程序,它使用 cuBLAS fortran 绑定库(非 thunking - Linux 上的 /usr/local/cuda/src/fortran.c)执行矩阵向量乘法。

当我在其余代码之外测试子例程时(即没有任何其他外部子例程调用),一切正常。当我编译时,我使用了这些标签-names uppercase -assume nounderscore。没有它们,我会收到未定义的参考错误。

将其移植到分子动力学代码的主函数中时,-assume nounderscore -names uppercase 标签会混淆我在主程序中的所有其他函数调用。

有什么办法解决这个问题吗?请参考我之前的问题-assume nounderscore -names uppercase被建议here

提前致谢!

【问题讨论】:

    标签: cuda fortran intel-fortran cublas


    【解决方案1】:

    我会尝试 Fortran-C 互操作。像

    interface
      function cublas_alloc(argument list) bind(C, name="the_binding_name")
        defs of arguments
      end function
    end interface
    

    绑定名称可以是大写或小写,无论您需要什么,例如bind(C,name="CUBLAS_ALLOC")。不会附加下划线。

    iso_c_binding 模块可能也有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-24
      • 2014-01-14
      • 2012-01-02
      • 2013-10-06
      • 2012-07-30
      相关资源
      最近更新 更多