ubuntu16.04下OpenBLAS安装步骤

2017年12月02日 08:42:14

阅读数:1962

安装的步骤如下:

(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时报错:

/usr/bin/ld: cannot find -lgfortran
 Check what version of gcc, g++, and gfortran you have:

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

文章标签: ubuntulinuxOpenBLAS

https://blog.csdn.net/sinat_24143931/article/details/78692622

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐