本文主要是介绍OpenBLAS,Numpy,Scipy For Linux(编译最新完成),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
-
Compile
OpenBLAS
:~$ git clone git://github.com/xianyi/OpenBLAS ~$ cd OpenBLAS && make FC=gfortran ~$ sudo make PREFIX=/opt/OpenBLAS install
If you don't have sudo rights you could set
PREFIX=
to a directory you have write privileges to (just modify the corresponding steps below accordingly). -
Make sure that the directory containing
libopenblas.so
is in your shared library search path.-
To do this locally, you could edit your
~/.bashrc
file to contain the lineexport LD_LIBRARY_PATH=/opt/OpenBLAS/lib:$LD_LIBRARY_PATH
The
LD_LIBRARY_PATH
environment variable will be updated when you start a new terminal session (use$ source ~/.bashrc
to force an update within the same session). -
you can also set the path in your /etc/profile to contain the bellow line:
export LD_LIBRARY_PATH=/opt/OpenBLAS/lib:$LD_LIBRARY_PATH
-
remember to use the command: source /etc/profile
-
Another option that will work for multiple users is to create a
.conf
file in/etc/ld.so.conf.d/
containing the line/opt/OpenBLAS/lib
, e.g.:~$ sudo -s "echo '/opt/OpenBLAS/lib' > /etc/ld.so.conf.d/openblas.conf"
Once you are done with either option, run
~$ sudo ldconfig
-
-
Install Numpy
-
Grab the
numpy
source code:~$ git clone https://github.com/numpy/numpy ~$ cd numpy
-
Copy
site.cfg.example
tosite.cfg
and edit the copy:~$ cp site.cfg.example site.cfg ~$ nano site.cfg
Uncomment these lines:
.... [openblas] libraries = openblas library_dirs = /opt/OpenBLAS/lib include_dirs = /opt/OpenBLAS/include ....
-
Check configuration, build, install (optionally in a
virutalenv
)~$ python setup.py config
The output should look something like this:
... openblas_info:FOUND:libraries = ['openblas', 'openblas']library_dirs = ['/opt/OpenBLAS/lib']language = cdefine_macros = [('HAVE_CBLAS', None)]FOUND:libraries = ['openblas', 'openblas']library_dirs = ['/opt/OpenBLAS/lib']language = cdefine_macros = [('HAVE_CBLAS', None)] ...
Then just build and install:
~$ python setup.py build && python setup.py install
Install Scipy
将numpy使用的更改过的site.cfg文件拷贝到scipy根目录下,执行相同的编译和安装过程即可。
这篇关于OpenBLAS,Numpy,Scipy For Linux(编译最新完成)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!