【发布时间】:2019-07-19 11:21:41
【问题描述】:
我正在编译一些尝试使用英特尔 MKL 库特征求解器的代码。我已经毫无问题地使用了 VSL RNG 和 DFT 库。我在安装了 Intel Parallel Studio XE 的 Visual Studio 中编译和运行所有内容。我已确保在项目属性中启用了 mkl 标志。
include 'lapack.f90'
program heev_test
use lapack95
implicit none
integer , parameter :: dp = kind(0.0d0)
complex(dp) :: matrix(4,4)
real(dp) :: eigs(4)
matrix = (1.0_dp,0.0_dp)
call zheev(matrix, eigs)
print*, eigs
read(*,*)
stop
end program
到目前为止,在我测试过的两台机器上运行此代码会产生段错误。我认为问题在于正在调用 F77 例程,这需要更多参数(文档here)。我想使用更简单的 F95 例程。根据文档,我应该用heev 替换zheev。所以我试过了,但后来我得到了错误
fatal error LNK1120: 1 unresolved externals
error LNK2019: unresolved external symbol _ZHEEV_F95 referenced in function _MAIN__
ZHEEV_F95 在lapack.f90 文件中定义了一个接口。
我现在唯一拥有的另一件事是文档说我还应该包含mkl.fi,但是这样做会出现以下编译错误
Error error #6218: This statement is positioned incorrectly and/or has syntax errors. C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\\mkl\include\lapack.f90 21
Error error #6790: This is an invalid statement; an END [PROGRAM] statement is required. C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\\mkl\include\lapack.f90 24
Error error #6785: This name does not match the unit name. [F95_PRECISION] C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018\windows\\mkl\include\lapack.f90 24
Error Compilation Aborted (code 1)
Warning warning #5427: Program may contain only one main entry routine
参考lapack.f90 文件中的这些行:
21 MODULE F95_PRECISION
22 INTEGER, PARAMETER :: SP = KIND(1.0E0)
23 INTEGER, PARAMETER :: DP = KIND(1.0D0)
24 END MODULE F95_PRECISION
【问题讨论】:
-
您是否指定了任何额外的链接库,或者您只是使用
/mkl? -
@francescalus,我只是在项目属性中启用了“使用 MKL 库”选项,这是我使用 VSL 和 DFT 例程时所必需的。
-
你用的是什么编译器?
标签: fortran intel-fortran intel-mkl