前置條件:已安裝了 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
- Download the lapack.tgz from the netlib website and unzip.
- Download CMAKE and install it on your machine.
- 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
- Look in your "build" folder, you have your LAPACK Visual Studio Solution, just open it.
- Build the "ALL_BUILD" project, it will build the solution and create the libraries
- Build the "INSTALL". This will put the libraries and include in your install folder.
- 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就行了。
# lib: lapacklib tmglib # 修改前
lib: blaslib lapacklib tmglib # 修改后