前置条件:已安装了 VS2012,IVF2013。

 

需要安装 lapack 等库文件来实现科学计算。

实现步骤:Lapack 库需要使用 Cmake,因此需要先安装好 Cmake!

 

一、Cmake 的安装

过程可参考这里

To build LAPACK libraries under Windows?

You will need to install CMAKE on your machine and please refer to the build section .

Cmake 版本(cmake-3.18.4-win64-x64.msi),可以从这里下载。

 

二、Lapack 的安装

(注:Lapack 库在 Win10下的安装和使用样例,可以参见这篇博客 https://www.cnblogs.com/panscience/p/4966404.html

 lapack-3.9.0.tar.gz 的下载地址位于这里,可以参考 Lapack 网站 上的介绍,即,“LAPACK for Windows”一节的介绍:

LAPACK for Windows
LAPACK is built under Windows using Cmake the cross-platform, open-source build system. The new build system was developed in collaboration with Kitware Inc.

A dedicated website (http://icl.cs.utk.edu/lapack-for-windows/lapack) is available for Windows users.

You will find information about your configuration need.

 

安装和样例调试的所有步骤,见这里,即,“Easy Windows Build”一节的介绍:

Easy Windows Build

Build Instructions for LAPACK 3.9.0 for Windows with Visual Studio

Requirements: Visual Studio, Intel C and Fortran Compilers, CMAKE 2.8.12

  1. Download the lapack.tgz from the netlib website and unzip.
  2. Download CMAKE and install it on your machine.
  3. Open CMAKE
    • Point to your lapack-3.9.0 folder as the source code folder
    • Point to a new folder where you want the build to be (not the same is better)
    • Click configure, check the install path if you want to have the libraries and includes in a particular location.
    • Choose Visual Studio Solution.
    • You will have to click "Specify native compilers" and indicate the path to the ifort compiler. On my machine, it is "C:/Program Files (x86)/Intel/Compiler/11.1/048/bin/ia32/icl.exe".
    • You may have to click again configure until everything becomes white
    • Click generate, that will create the Visual Studio Solution and you are done.
    • Close CMAKE
  4. Look in your "build" folder, you have your LAPACK Visual Studio Solution, just open it.
  5. Build the "ALL_BUILD" project, it will build the solution and create the libraries
  6. Build the "INSTALL". This will put the libraries and include in your install folder.
  7. Build the "RUN_TESTS". The BLAS and LAPACK testings will be run.

 

注意事项:

需要注意的是,下载的 lapack 文件夹中,需要在 CMake 开始前,执行两步修改:

(1)复制 make.inc.example 文件,并重命名为 make.inc;

(2)Lapack 需要用到 Blas 库,因此系统有无 Blas 库对应着两种不同的做法。

      如果系统已经有了 Blas 库,或者说你想要用自己的 Blas 库,你需要修改 make.inc 里的 USEXBLAS 、 XBLASLIB 和 XBLASLIB 三个变量,修改完直接Make就行了。

      如果系统没有 Blas 库,Lapack 源码里自己带了一个,可以直接用。那么保持 make.inc 里的设置不变,打开 Makefile,把 Blas 库加到编译目标里,就是 lib 参数编程: 
# lib: lapacklib tmglib # 修改前
lib: blaslib lapacklib tmglib # 修改后

 

posted on 2020-10-12 16:28  Certainly  阅读(2850)  评论(0编辑  收藏  举报