码迷,mamicode.com
首页 > 其他好文 > 详细

numpy delete

时间:2014-08-02 01:36:12      阅读:422      评论:0      收藏:0      [点我收藏+]

标签:http   os   io   for   2014   cti   ar   div   

手动安装

sudo rm -rf /usr/local/lib/python2.7/site-packages/numpy/
sudo rm -rf /usr/local/lib/python2.7/site-packages/numpy-*.egg* sudo rm -rf /usr/local/bin/f2py


pip安装
 sudo rm -rf /usr/local/lib/python2.7/dist-packages/numpy/
 sudo rm -rf /usr/local/lib/python2.7/dist-packages/numpy-*.egg*
sudo rm -rf /usr/local/bin/f2py


export BLAS=~/.local/lib/libopenblas.a
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.local/lib/



30down voteaccepted

I just compiled numpy inside a virtualenv with OpenBLAS integration, and it seems to be working ok. This was my process:

  1. Compile OpenBlas:

    git clone git://github.com/xianyi/OpenBLAS
    cd OpenBLAS && make FC=gfortran
    sudo make PREFIX=/opt/OpenBLAS install
    sudo ldconfig
  2. Grab the numpy source code:

    git clone https://github.com/numpy/numpy
    cd numpy
  3. Copy site.cfg.example to site.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
    ....
  4. 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 = f77
    
      FOUND:
        libraries = [‘openblas‘, ‘openblas‘]
        library_dirs = [‘/opt/OpenBLAS/lib‘]
        language = f77
    ...

    Then just build and install:

    python setup.py build && python setup.py install
  5. Optional: you can use this script to test performance for different thread counts.

    OMP_NUM_THREADS=1 python build/test_numpy.py
    
    FAST BLAS
    version: 1.8.0.dev-27690e3
    maxint: 9223372036854775807
    
    dot: 0.100896406174 sec
    
    
    OMP_NUM_THREADS=8 python test_numpy.py
    
    FAST BLAS
    version: 1.8.0.dev-27690e3
    maxint: 9223372036854775807
    
    dot: 0.0660264015198 sec

There seems to be a noticeable improvement in performance for higher thread counts. However, I haven‘t tested this very systematically, and it‘s likely that for smaller matrices the additional overhead would outweigh the performance benefit from a higher thread count.

share|improve this answer
 
1  
I apply what you did bu tending with foollowing error at your test script /linalg/lapack_lite.so: undefined symbol: zgelsd_ –  Erogol Jan 30 at 17:47 
1  
@Erogol Could you check that lapack_lite.so is correctly linked against the libopenblas.so you just built? You can call ldd /<path-to-site-packages>/numpy/linalg/lapack_lite.so - if you installed OpenBLAS with PREFIX=/usr/local you should see something like libopenblas.so.0 => /usr/local/lib/libopenblas.so.0 in the output. –  ali_m Jan 30 at 18:01 
1  
I have following line even I do strictly what you typed above answer. libopenblas.so.0 => /usr/lib/libopenblas.so.0 (0x00007f77e08fc000) –  Erogol Jan 30 at 18:06 
    
It sounds like numpy has not been built correctly. I would suggest you uninstall the broken copy of numpy, do a python setup.py clean and python setup.py build and look for any error messages during the compilation. –  ali_m Jan 30 at 18:14 
    
Also, you should probably call sudo ldconfig after installing OpenBLAS if you haven‘t already (I‘ve added this line to my answer) –  ali_m Jan 30 at 18:21

numpy delete,布布扣,bubuko.com

numpy delete

标签:http   os   io   for   2014   cti   ar   div   

原文地址:http://www.cnblogs.com/huashiyiqike/p/3885996.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!