1、IMSL下载地址:
x86_64
[ftp:]
x32
[ftp:]
2、安装:
安装过程中会提示你输入的序列号:201111
仅有以上是不够的,还需要license.lic(附件)
license放置位置:你在运行的时候会提示未注册,你就按提示,选择license所在文件
3、配置:
工具--选项
Libraries:C:/Program Files/VNI/imsl/fnl600/IA32/lib
Includes :C:/Program Files/VNI/imsl/fnl600/IA32/include/dll
4、使用方法:
和CVF中带的IMSL使用方法不同,这点是需要注意的
附件中给了4个例子,在我的电脑上都能成功运行
补充::我用的 IntelVisualFortran v11.1.038 (very CD 电驴有下)+visual studio 2008
Fortran历史:[baike.baidu.com]
IMSL在IVF中的安装和应用(Windows系统):
IMSL在IVF中的安装和应用 (Windows系统)
-----------------------------------------------------
1. IMSL在IVF中的安装
2. IMSL在IVF中的调用
3. 其它程序库的调用
-----------------------------------------------------
1. IMSL在IVF中的安装
1) 如果是IVF pro版本自带的IMSL,直接安装就OK.可以直接阅读第2部分。
2) 如果是手动安装,IVF与IMSL版本不同,要注意以下问题
a) 首先,安装IMSL到缺省目录 (不同的版本,目录可能不同)
例如,IMSL5.0的安装路径是C:/Program Files/VNI/CTT6.0/
b)如果是在IDE环境下调用IMSL,那么需要首先设置IMSL在IVF中
的搜索路径,其设置方法为:
设置步骤:
(1) 打开IVF9.*/10.* in Visual studio .net 2003/2005 IDE;
(2) 打开菜单 Tools|options...
(3) 选择左侧的 ”Intel(R) Fortran“ ,再选”Gerneral“或是”compiler“,
然后在右侧找到 "Project Directories"或是“compiler Selection”.
然后在下面你可以看到 "Libraries" 和 "Includes".
点击右侧的 "..." 在Includes打开窗口中输入IMSL的include搜索路径,
在Libraries打开的窗口中输入IMSL的lib搜索路径
对于IMSL5.0,其include路径为:
C:/Program Files/VNI/CTT6.0/include/IA32
C:/Program Files/VNI/CTT6.0/include/IA32_s
其lib路径是:
C:/Program Files/VNI/CTT6.0/lib/IA32
如果是其他版本,也请查找类似目录。在include和lib目录下的某个目录,
一般说,include某个目录下应该有很多*.mod文件,在lib的某个目录下有很多
*.lib或*.dll文件,这就是正确的路径所在。
(4)选择“ok”,完成设置。
c)如果需要在命令行的方式下调用IMSL,且IVF的版本与IMSL的版本不一致,
则需要手动进行如下修改:
(1) 首先找到ifortvars这个IVF的设置文件,例如:
C:/Program Files/Intel/Compiler/Fortran/10.1.011/IA32/Bin/ifortvars.bat
(2) 用文本编辑器打开这个文件,你会找到类似的一行:
if exist "%FNL_DIR%/IA32/bin/fnlsetup.bat" call "%FNL_DIR%/IA32/bin/fnlsetup.bat"
这个句子的目的是查找IMSL的目录下是否有fnlsetup.bat这个文件,如果有的话,就执行它。
当然,不同的IVF版本,这一行可能有差别,我这里给出的是10.1.011版本的内容。
如果你不是对应的IMSL版本,可能不存在fnlsetup.bat这个文件,例如在IMSL5.0的安装目录下存在
C:/Program Files/VNI/CTT6.0/ctt/bin/cttsetup.bat 这个文件。那么你就需要更改ifortvars.bat
里面的内容,从而调用正确的bat文件。例如,IMSL5.0在IVF10.1.011下,要在ifortvars.bat文件中
加入下面一行
if exist "C:/Program Files/VNI/CTT6.0/ctt/bin/cttsetup.bat" call "C:/Program Files/VNI/CTT6.0/ctt/bin/cttsetup.bat " IA32
这样就可以正确在命令行方式下调用IMSL了。
---------------------------------------------------------------------------------------------------------------------------------------------------------------
2. IMSL在IVF中的调用
1)找到IMSL中合适的函数或子程序(在开始菜单中,安装IMSL的目录下会找到一个pdf文件,里面是IMSL的说明文件,包括函数和子程序的
详细信息,并有例子)
2)在自己的程序中调用IMSL. 首先在IVF的帮助文档中“index”选项卡下输入IMSL,就可以看到
Using from the Command Line
Using from IDE
这两项主要内容,请仔细阅读这个部分。一般情况下,调用IMSL需要注意两个地方:
a) 加入 INCLUDE 'link_fnl_static.h' 或是类似的语句在你的主程序中,不同的库函数选用不同的*.h文件
b) 加入合适的use 语句,例如
use IMSL
use lin_sol_gen_int
use rand_gen_int
use error_option_packet
等,你可以在IMSL的帮助文档中看到如何应用合适的use 语句
c) 在主程序中call IMSL中的functions或是subroutines
d) 编译,链接,得到执行程序。
3)在命令行中调用和编译:
首先在command窗口中执行ifortvars这个命令,如果不能执行,请直接从开始菜单中的IVF目录下面直接运行这个程序(Build Environment for applications running on IA-32),
或是将此文件所在的目录写入path环境变量,使其可以执行。
然后用ifort命令对你的主程序进行编译即可。
---------------------------------------------------------------------------------------------------------------------------------------------------------------
3. 其它程序库的调用
学会了IMSL的调用,其实其他的程序库如CXML,LAPACK, BLAS, WFL等在IVF下的调用都是类似过程,即主要要设置好include和lib的路径,使得编译器
可以找到需要包含的mod文件和链接的lib文件,这个过程大同小异。
-----------------------------------------------------
Good Luck!
其实C:/Program Files/VNI/imsl/fnl600/IA32/notes/Release_notes.txt中也有说明:
==< Part 5: Using the IMSL Fortran Library from Microsoft Visual Studio .NET 200X >==
1) Start the Microsoft Visual Studio Developer Environment. Select
Microsoft Visual Studio .NET 2003 from Start -> Programs -> Microsoft
Microsoft Visual Studio .NET 2003, or Microsoft Visual Studio 2005
from Start -> Programs -> Microsoft Visual Studio 2005
2) If you have not already defined a Solution Workspace for your
application, you must do so before proceeding. Close all Solutions
and choose File -> New -> Blank Solution. Under Project Types,
select Intel(R) Fortran Projects. Under Templates, choose
"Console Application" as the project type, fill in the name of
the project, select the desired location, and click OK. In the
Win32 Application Wizard select Application Settings. Select
Empty Project and Finish.
Select Project -> Add Existing Item and add your Fortran source
code file or for testing you may use imslmp.f90 from
<FNL_DIR>/IA32/examples/validate
NOTE: <FNL_DIR> denotes the main IMSL installation directory. By default,
this is set as C:/Program Files/VNI/imsl/fnl600, but may be
different if you installed IMSL in a different directory.
3) Click on Project -> Properties -> Configuration Properties
Under Fortran -> General, add <FNL_DIR>/IA32/include/DLL
to the "Additional Include Directories" list and then click OK.
Under Fortran -> Floating Point, check that the default setting
for Floating Point Exception Handling is selected. It should
be set to "Produce NaN, signed infinity, and denormal results"
Under Linker -> General, add <FNL_DIR>/IA32/lib
to the "Additional Library Directories" list and then click OK.
NOTE: If you did not allow Setup to update the System Registry at
installation time, this directory, <FNL_DIR>/IA32/lib ,
must be added to the environment variable PATH prior to starting
Microsoft Visual Studio .NET.
4) Next, you must specify the IMSL libraries to link against in your
project. For simplicity, we will build a dynamically linked program,
which links in the DLL version of IMSL. You can do this by explicitly
adding imsl_dll.lib to your Visual Studio Solution, in the Project
Explorer or use the 'link_fnl_shared.h' include file directly in your
source code. In your Fortran source code, add the following header
file in an include statement:
include 'link_fnl_shared.h'
5) You should now be ready to build the Solution and run the program.
This sample project builds a very simple example, a shared console
application, but should illustrate how easy it is to build a Visual
Studio project that calls the IMSL libraries. More complex and visually
appealing applications can be built with Microsoft Visual Studio and
the Intel Fortran compiler, see the Intel Fortran documentation for
more information.
一个简单的测试例子(动态调用):
! ================ Program start ==============
program fnl
! Include the necessary header file:
! For the dynamic library:
INCLUDE 'link_fnl_shared.h'
! For the static library:
!INCLUDE 'link_fnl_static.h'
!!DEC$ OBJCOMMENT lib:"libguide.lib"
! Declare which IMSL functions will be used
USE LSARG_INT
USE WRRRN_INT
! Declare variables
PARAMETER (LDA=3, N=3)
REAL A(LDA,LDA), B(N), X(N)
!
! Set values for A and B
! A = (33.0 16.0 72.0)
! (-24.0 -10.0 -57.0)
! (18.0 -11.0 7.0)
! B = (129.0 -96.0 8.5)
!
DATA A/33.0, -24.0, 18.0, 16.0, -10.0, -11.0, 72.0, -57.0, 7.0/
DATA B/129.0, -96.0, 8.5/
!
! The main IMSL function call to solve for x in Ax=B.
! This is the floating point version, to use double-precision, call DLSARG.
!
CALL LSARG(A,B,X)
!
! Now print the solution x using WRRRN, a printing utility
!
CALL WRRRN('X',X,1,N,1)
Read(*,*)
END PROGRAM fnl
!================ Program End ==============
编译后的文件大小是:0.852M
一个简单的测试例子(静态调用):
! ================ Program start ==============
program fnl
! Include the necessary header file:
! For the dynamic library:
!INCLUDE 'link_fnl_shared.h'
! For the static library:
INCLUDE 'link_fnl_static.h'
!DEC$ OBJCOMMENT lib:"libguide.lib"
! Declare which IMSL functions will be used
USE LSARG_INT
USE WRRRN_INT
! Declare variables
PARAMETER (LDA=3, N=3)
REAL A(LDA,LDA), B(N), X(N)
!
! Set values for A and B
! A = (33.0 16.0 72.0)
! (-24.0 -10.0 -57.0)
! (18.0 -11.0 7.0)
! B = (129.0 -96.0 8.5)
!
DATA A/33.0, -24.0, 18.0, 16.0, -10.0, -11.0, 72.0, -57.0, 7.0/
DATA B/129.0, -96.0, 8.5/
!
! The main IMSL function call to solve for x in Ax=B.
! This is the floating point version, to use double-precision, call DLSARG.
!
CALL LSARG(A,B,X)
!
! Now print the solution x using WRRRN, a printing utility
!
CALL WRRRN('X',X,1,N,1)
Read(*,*)
END PROGRAM fnl
! ================ Program End ==============