Last active
May 26, 2016 22:30
-
-
Save jarutis/912e2a4693accee42a94 to your computer and use it in GitHub Desktop.
get native blas running with dl4j on centos 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install general deps | |
sudo yum groupinstall "Development Tools" | |
sudo yum install wget unzip | |
# install java | |
cd /opt/ | |
sudo wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jdk-8u60-linux-x64.tar.gz" | |
sudo tar xzf jdk-8u60-linux-x64.tar.gz | |
cd /opt/jdk1.8.0_60/ | |
sudo alternatives --install /usr/bin/java java /opt/jdk1.8.0_60/bin/java 2 | |
sudo alternatives --config java | |
# get maven | |
mkdir ~/ini | |
cd ~/ini | |
wget http://apache.mirror.vu.lt/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz | |
tar -xvzf apache-maven-3.3.3-bin.tar.gz | |
mv apache-maven-3.3.3 mvn | |
alias mvn=~/ini/mvn/bin/mvn | |
# install openblas | |
wget https://github.com/xianyi/OpenBLAS/zipball/master | |
unzip master | |
cd xianyi-OpenBLAS-d0c51c4/ | |
make | |
sudo make install | |
# centos 6 ships with gcc 4.4 which does not contain libgfortran.so.3(GFORTRAN_1.4) | |
# we need to install newer libgfortran.so.3 | |
cd /etc/yum.repos.d/ | |
sudo wget http://rpm.agresearch.co.nz/agr-free.repo | |
cd /etc/pki/rpm-gpg/ | |
sudo sudo wget http://rpm.agresearch.co.nz/RPM-GPG-KEY-agresearch | |
sudo yum install agr-devtools-libgfortran | |
# replace system libgfortran with newer version | |
sudo mv /usr/lib64/libgfortran.so.3 /usr/lib64/libgfortran.so.3_back | |
sudo ln -s /opt/centos/agr-devtools/root/usr/lib64/libgfortran.so.3 /usr/lib64/libgfortran.so.3 | |
sudo ln -s /opt/centos/agr-devtools/root/usr/lib64/libquadmath.so.0 /usr/lib64/libquadmath.so.0 | |
# if you do not want to mess with default libgfortran setting LD_LIBRARY_PATH should also work | |
# export LD_LIBRARY_PATH=/opt/centos/agr-devtools/root/usr/lib64/ | |
# create libblas and liblapack links to libopenblas | |
sudo ln -s /opt/OpenBLAS/lib/libopenblas.so /usr/lib64/libblas.so | |
sudo ln -s /opt/OpenBLAS/lib/libopenblas.so /usr/lib64/libblas.so.3 | |
sudo ln -s /opt/OpenBLAS/lib/libopenblas.so /usr/lib64/liblapack.so | |
sudo ln -s /opt/OpenBLAS/lib/libopenblas.so /usr/lib64/liblapack.so.3 | |
# alternatively libblas.so.3 and liblapack.so.3 can be anywhere as long as they are included in PATH system variable | |
# test | |
cd ~/ | |
git clone https://github.com/deeplearning4j/dl4j-0.4-examples | |
cd dl4j-0.4-examples | |
mvn package | |
java -Xmx2048m -cp target/deeplearning4j-examples-0.4-rc0-SNAPSHOT.jar org.deeplearning4j.examples.convolution.CNNMnistExample |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment