Armadillo_OpenBLAS_IntelMKLインストール
5614 ワード
1. Intel-MKL
1-1 Installation
# ./install.sh ,
./install.sh
2. OpenBLAS
make -j4
make install PREFIX=xxx
3. Armadillo
Armadillo is a high quality linear algebra library (matrix maths) for the C++ language, aiming towards a good balance between speed and ease of use.
3-1 Linux Compiling & Linking
The "examples" directory contains several quick example programs
that use the Armadillo library.
In general, programs which use Armadillo are compiled along these lines:
g++ example1.cpp -o example1 -O2 -larmadillo
If you want to use Armadillo without installation (not recommended),
compile along these lines:
g++ example1.cpp -o example1 -O2 -I /home/blah/armadillo-7.200.3/include -DARMA_DONT_USE_WRAPPER -lblas -llapack
The above command line assumes that you have unpacked the armadillo archive into /home/blah/
You will need to adjust this for later versions of Armadillo (ie. change the 7.200.3 part)
and/or if you have unpacked the armadillo archive into a different directory.
Replace -lblas with -lopenblas if you have OpenBLAS.
On Mac OS X, replace -lblas -llapack with -framework Accelerate
3-2ライブラリをコンパイルせずにArmadillo+OpenBLASを使用
# Armadillo include OpenBLAS include
# Armadillo example1.cpp
# Armadillo BLAS API
g++ example1.cpp -o example1 -O2 -I ./include -DARMA_DONT_USE_WRAPPER -L./lib -lopenblas
# Armadillo , !!!
3-3 Armadillo+OpenBLASのコンパイル
# CMake , README.txt
# cmake . -LH
cmake . -LH
# config.hpp ,
vim include/armadillo_bits/config.hpp
// #define ARMA_USE_LAPACK
// #define ARMA_USE_BLAS
# OpenBLAS lib Armadillo
cmake -Dopenblas_LIBRARY:FILEPATH=./lib/libopenblas.a \
-Dopenblaso_LIBRARY:FILEPATH=./lib/libopenblas.so \
-Dopenblasp_LIBRARY:FILEPATH=./lib/libopenblas_penrynp-r0.2.19.so \
-DMKL_ROOT:STRING=. .
make install DESTDIR=my_usr_dir
3-4 Armadillo Build with MKL
cmake -DMKL_ROOT:STRING=/home/chouisbo/intel/mkl .
mkdir install; make install DESTDIR=./install
cmake -DMKL_ROOT:STRING=/home/zhubolong/intel/mkl .
make install DESTDIR=/home/zhubolong/Armadillo-7.500.2_with_IntelMKL-2017.0.098