安装的步骤如下:
(1)git clone git://github.com/xianyi/OpenBLAS
(2)cd OpenBLAS
(3)sudo make FC=gfortran (如果没有安装gfortran,执行sudo apt-get install gfortran)
也可以用这个指令,就把安装目录改为下面的目录了:/usr/local/Openblas/
sudo make --PREFIX=/usr/local/Openblas/ install /*安装*/
(4) sudo make install (将OpenBLAS安装到/opt下)
结果如下:
make -j 8 -f Makefile.install install
make[1]: Entering directory '/home/lbg/下载/OpenBLAS'
Generating openblas_config.h in /opt/OpenBLAS/include
Generating f77blas.h in /opt/OpenBLAS/include
Generating cblas.h in /opt/OpenBLAS/include
Copying LAPACKE header files to /opt/OpenBLAS/include
Copying the static library to /opt/OpenBLAS/lib
Copying the shared library to /opt/OpenBLAS/lib
Generating openblas.pc in /opt/OpenBLAS/lib/pkgconfig
Generating OpenBLASConfig.cmake in /opt/OpenBLAS/lib/cmake/openblas
Generating OpenBLASConfigVersion.cmake in /opt/OpenBLAS/lib/cmake/openblas
Install OK!
make[1]: Leaving directory '/home/lbg/下载/OpenBLAS'
编译好的文件夹大小40M
(5)执行以下命令完成安装
ln -s /opt/OpenBLAS/lib/libopenblas.so /usr/lib/libblas.so.3
ln -s /opt/OpenBLAS/lib/liblapack.so.3 /usr/lib/liblapack.so.3
再次运行程序,则不会发生此类错误
make时报错:
Check what version of gcc,g++,and gfortran you have:/usr/bin/ld: cannot find -lgfortran g++ --version gcc --version gfortran --version
结果gfortran也有,在目录/usr/lib/x86_64-linux-gnu/里面,
sudo ln -s /usr/lib/x86_64-linux-gnu/libgfortran.so.3 /usr/lib/libgfortran.so
就可以了
使用编译例子:
gcc testOpenBlas.c -I /opt/OpenBLAS/include/ -L/opt/OpenBLAS/lib -lopenblas原文链接:https://www.f2er.com/ubuntu/354275.html