Skip to content

Instantly share code, notes, and snippets.

@poolio
Last active August 29, 2015 14:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poolio/ed2858be41657d477255 to your computer and use it in GitHub Desktop.
Save poolio/ed2858be41657d477255 to your computer and use it in GitHub Desktop.

#Instructions for installing OpenBLAS on a terminal.com instance. Mostly folows: http://stackoverflow.com/questions/11443302/compiling-numpy-with-openblas-integration

##Run the following:

sudo dpkg -r python-numpy

sudo apt-get install gfortran
sudo pip install cython

git clone git://github.com/xianyi/OpenBLAS
cd OpenBLAS
# Set NUM_THREADS to be the maximum number of cores you use
NUM_THREADS=32 make FC=gfortran
sudo make PREFIX=/opt/OpenBLAS install
sudo ldconfig

cat >> ~/.bashrc << EOF
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/OpenBLAS/lib
EOF

source ~/.bashrc

git clone https://github.com/numpy/numpy
cd numpy
cp site.cfg.example site.cfg

##Edit site.cfg and uncomment these lines:

....
[openblas]
libraries = openblas
library_dirs = /opt/OpenBLAS/lib
include_dirs = /opt/OpenBLAS/include
....

##Install numpy

python setup.py config
python setup.py build && python setup.py install

##Try it out

wget https://gist.githubusercontent.com/poolio/a6a98589202541bcfff3/raw/41de22fddcd270d06a0aabb208cc523b1b99e04f/test_mat.py
python test_mat.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment