从源代码正确安装lapack/blas/openblas-用新的替换系统库 [英] lapack/blas/openblas proper installation from source - replace system libraries with new ones
问题描述
我想使用可用的软件包从源代码安装BLAS,CBLAS,LAPACK和OpenBLAS库,您可以在此处下载 openblas 和 lapack ,
I wanted to install BLAS, CBLAS, LAPACK and OpenBLAS libraries from source using available packages you can download here openblas and lapack, blas/cblas.
首先,我删除了系统的blas/cblas和lapack库,但是不幸的是,无法卸载atlas库(我可以同时拥有blas和lapack或atlas-无法将它们全部删除).我没有打扰,开始编译下载的库,因为我认为安装后我将能够删除地图集.
Firstly I removed my system blas/cblas and lapack libraries, but unfortunately atlas library couldn't be uninstalled (I can either have both blas and lapack or atlas - can't remove them all). I didn't bother and started compiling downloaded libraries cause I thought that after installation I would be able to remove atlas.
构建过程基于此教程.为了完整起见,我将列出步骤:
Building process was based on this tutorial. For completeness I will list the steps:
-
OpenBLAS .编辑Makefile.rule(NO_CBLAS = 1,NO_LAPACK = 1,NO_LAPACKE = 1)文件后,我运行以下代码:
OpenBLAS. After editing Makefile.rule (NO_CBLAS=1, NO_LAPACK=1, NO_LAPACKE=1) file I run the following code:
make FC=gfortran
sudo make PREFIX=/usr/local/ install
CBLAS .编辑Makefile.in之后(除了-lpthread我还需要添加-pthread标志):
CBLAS. After editing Makefile.in (apart from -lpthread I needed to add -pthread flag):
make
cd lib
ar -x libcblas.a
gfortran -lopenblas -shared -o libcblas.so *.o
sudo cp libcblas.* /usr/local/lib/
LAPACK .编辑make.inc文件后:
LAPACK. After editing make.inc file:
make lapacklib
mkdir tmp
cd tmp
cp ../liblapack.3.6.0.a .
ar -x liblapack.3.6.0.a
gfortran -lopenblas -lcblas -shared -o liblapack.3.6.0.so *.o
sudo cp liblapack.3.6.0.* /usr/local/lib
cd /usr/local/lib
sudo ln -sn liblapack.3.6.0.a liblapack.a
sudo ln -sn liblapack.3.6.0.so liblapack.so
LAPACKE .我通过以下方式编辑了gcc的make.inc文件:
LAPACKE. I edited make.inc file for gcc in the following way:
CC = gcc
CFLAGS = -O3 -march=native -m64 -fomit-frame-pointer -fPIC
然后我跑:
make lapackelib
mkdir tmpe
cd tmpe
cp ../liblapacke.a .
ar -x liblapacke.a
gfortran -lopenblas -lcblas -shared -o liblapacke.so *.o
sudo cp liblapacke.* /usr/local/lib
BLAS .我编辑了make.inc文件:
BLAS. I edited make.inc file:
FORTRAN = gfortran
OPTS = -O3 -march=native -m64 -fomit-frame-pointer -fPIC
DRVOPTS = $(OPTS)
NOOPT = -O0 -fPIC
LOADER = gfortran
LOADOPTS = -lopenblas -lcblas
并运行:
make
gfortran -lopenblas -shared -o libblas.so *.o
sudo cp libblas.* /usr/local/lib/
现在,我将静态库和共享库全部放在/usr/local/lib目录中,我想以某种方式告诉我我的Linux mint 17.2系统已安装它们,以便最终可以卸载地图集.有什么想法怎么做吗?
Now I have my static and shared libraries all placed in /usr/local/lib directory and I want to tell somehow my linux mint 17.2 system that I have them installed so I can finally uninstall atlas. Any ideas how to do it?
我的总体目标是正确设置OpenBLAS,因此我也希望从源代码中编译所有其他库.我还想检查我的图书馆是否正在运行,或者我做错了什么.
My general goal was to properly set OpenBLAS so I wanted to compile from source all other libraries also. I also want to check if my libraries are working or maybe I did something wrong.
我的长远目标是与OpenBLAS一起安装Arpack和SuperLU,然后最终安装Armadillo库(C ++).
Also my long term goal is to install Arpack and SuperLU working with OpenBLAS and then finally install Armadillo library (C++).
推荐答案
您可以使用LD_LIBRARY_PATH
环境变量.刚刚添加到您的~/.bashrc
中.即
You can use LD_LIBRARY_PATH
environment variable. Just added in your ~/.bashrc
. i.e.
$ echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
注意:请注意两次>> ,不要删除以前的内容.
Note: notice double >> not to delete the previous content.
第二个选项是在/etc/ld.so.conf.d
中添加路径.即
Second option is to add the path in the /etc/ld.so.conf.d
. i.e.
$ echo /usr/local/lib > /etc/ld.so.conf.d/myblas.conf
您可以查看此问题还要了解更多详细信息.
You can check this question also for more details.
这篇关于从源代码正确安装lapack/blas/openblas-用新的替换系统库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!