装了VS+IVF后一直想只用IVF自带的MKL函数库去解大型稀疏方程组,在百度上看了很多帖子,但是无论怎么搞,怎么设置,还是不能使用MKL函数库,求高手能详细介绍如何在VS中做相关的设置才能在IVF中调用MKL库里面的函数!
我装的是VS2010旗舰版,Intel.Visual.Fortran.XE2011.5.221.【含win7.32位.64位】版
直接装VS和IVF后,不知道怎么用自带的MKL函数库,于是百度了一些例子,后面发现都不行。参考下面的链接
http://blog.sina.com.cn/s/blog_47569d460100m4cb.html
中的第五步:配置编译环境,设置一些路径(我将IVF装在D盘,版本不一样路径有所不同),如以下(列出其中一个):
MKL中有一个计算LU分解的函数
这里我用了:call sgetrf ( m , n , a , lda , ipiv , info),因为MKL手册中提到‘REAL for sgetrf’
下面是一个程序:
[Fortran] 纯文本查看 复制代码 program main
include 'MKL.h'
parameter(m=3,n=3,lda=3)
integer lda,info
integer ipv(n)
real a(lda,n)
a(1,1)=1;a(1,2)=2;a(1,3)=3
a(2,1)=2;a(2,2)=5;a(1,3)=2
a(3,1)=3;a(3,2)=1;a(3,3)=5
call sgetrf ( m , n , a , lda , ipiv , info )
end
调试后出现如下情况:
1>------ 已启动生成项目: Console4, 配置: Debug x64 ------
1>Compiling with Intel(R) Visual Fortran Compiler XE 12.0.5.221 [Intel(R) 64]...
1>Source4.F90
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(29): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(30): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(32): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(33): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(34): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(36): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(1): error #5082: Syntax error, found '/' when expecting one of: <LABEL> <END-OF-STATEMENT> ; BLOCK BLOCKDATA PROGRAM MODULE TYPE BYTE CHARACTER ...
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(37): error #5192: Lead underscore not allowed
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(37): error #5192: Lead underscore not allowed
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(38): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(39): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(40): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(41): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(42): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(43): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(44): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(45): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(46): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(48): warning #5117: Bad # preprocessor line
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(37): error #5276: Unbalanced parentheses
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(37): error #5082: Syntax error, found '*' when expecting one of: ( % [ : . = =>
1>D:\Program Files\Intel\ComposerXE-2011\mkl\include\MKL.h(37): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( % [ . = =>
1>compilation aborted for F:\My Programs c c++ F90\1\Console4\Console4\Source4.F90 (code 1)
1>
1>Build log written to "file://F:\My Programs c c++ F90\1\Console4\Console4\x64\Debug\BuildLog.htm"
1>Console4 - 7 error(s), 16 warning(s)
==========成功|0 个,失败1 个,最新 0 个,跳过y0 个==========
下图为MKL.h文件:
以上错误似乎都是出错在MKL.h的文件里面,于是将
include 'MKL.h'
这一行去掉,调试出现如下问题:
1>------ 已启动生成项目: Console4, 配置: Debug x64 ------
1>Compiling with Intel(R) Visual Fortran Compiler XE 12.0.5.221 [Intel(R) 64]...
1>Source4.F90
1>Linking...
1>Source4.obj : error LNK2019: 无法解析的外部符号 for_set_reentrancy,该符号在函数 MAIN__ 中被引用
1>Source4.obj : error LNK2019: 无法解析的外部符号 SGETRF,该符号在函数 MAIN__ 中被引用
1>Source4.obj : error LNK2001: 无法解析的外部符号 _fltused
1>LINK : error LNK2001: 无法解析的外部符号 mainCRTStartup
1>x64\Debug\Console4.exe : fatal error LNK1120: 4 个无法解析的外部命令
1>
1>Build log written to "file://F:\My Programs c c++ F90\1\Console4\Console4\x64\Debug\BuildLog.htm"
1>Console4 - 5 error(s), 0 warning(s)
==========成功|0 个,失败1 个,最新 0 个,跳过y0 个==========
函数sgetrf是MKL函数库中的函数,想调用来做计算,在VS+IVF中虽然有MKL库,但不能直接使用,该如何设置呢?还是我的程序调用方式本身就用问题?
求助高手!!!另外,对于77、90接口问题本人菜鸟,确不明了,只想能使用就好
|