lapack/blas/openblas proper installation from source - replace system libraries with new ones

匿名 (未验证) 提交于 2019-12-03 08:56:10

问题:

I wanted to install BLAS, CBLAS, LAPACK and OpenBLAS libraries from source using available packages you can download here openblas and lapack, blas/cblas.

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:

  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 
  2. 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/ 
  3. 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 
  4. LAPACKE. I edited make.inc file for gcc in the following way:

    CC = gcc CFLAGS = -O3 -march=native -m64 -fomit-frame-pointer -fPIC 

    Then I run:

    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 
  5. 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 

    and run:

    make gfortran -lopenblas -shared -o libblas.so *.o sudo cp libblas.* /usr/local/lib/ 

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?

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.

Also my long term goal is to install Arpack and SuperLU working with OpenBLAS and then finally install Armadillo library (C++).

回答1:

You can use LD_LIBRARY_PATH environment variable. Just added in your ~/.barsrc. i.e.

$ echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc 

Note: notice double >> not to delete the previous content.

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!