Skip to content

Instantly share code, notes, and snippets.

@ruze00
Forked from jarutis/ubuntu.sh
Created January 7, 2018 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruze00/a9bb5202c042a7826a7ac70378cda784 to your computer and use it in GitHub Desktop.
Save ruze00/a9bb5202c042a7826a7ac70378cda784 to your computer and use it in GitHub Desktop.
Theano and Keras setup on ubuntu with OpenCL on AMD card
## install Catalyst proprietary
sudo ntfsfix /dev/sda2
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.BAK
sudo apt-get remove --purge fglrx*
sudo apt-get install linux-headers-generic
sudo apt-get install fglrx xvba-va-driver libva-glx1 libva-egl1 vainfo
sudo amdconfig --initial
## install build essentials
sudo apt-get install cmake
sudo apt-get update && sudo apt-get install build-essential
## install AMD APP SDK
tar -xvf AMD-APP-SDK-v3.0-0.113.50-Beta-linux64.tar.bz2
sudo ./AMD-APP-SDK-v3.0-0.113.50-Beta-linux64.sh
## install libgpuarray
sudo apt-get install libssl0.9.8:i386
sudo apt-get install libboost-all-dev
sudo apt-get install libgtest-dev
cd /usr/src/gtest
sudo cmake .
sudo make
sudo mv libg* /usr/lib/
## download AMD acml library
mkdir ~/Ini
tar -xvf acml-6.1.0.31-gfortran64.tgz -C ~/Ini/acml
echo "###################################################################" >> ~/.bashrc
echo "export ACML_ROOT=/home/jjarutis/Ini/acml" >> ~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/home/jjarutis/Ini/acml/gfortran64/lib" >> ~/.bashrc
## clBlas
sudo apt-get install git
git clone https://github.com/clMathLibraries/clBLAS.git
cd clBLAS/
mkdir build
cd build/
sudo apt-cache search openblas
sudo apt-get install libopenblas-base libopenblas-dev
sudo apt-get install liblapack3gf liblapack-doc liblapack-dev
cmake ../src
make
sudo make install
git clone https://github.com/Theano/libgpuarray.git
cd libgpuarray
mkdir Build
cd Build
cmake .. -DCMAKE_BUILD_TYPE=Release -DOPENCL_INCLUDE_DIRS=/opt/AMDAPPSDK-3.0-0-Beta/include
make
sudo make install
cd ..
sudo apt-get install cython
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
python setup.py build
sudo python setup.py install
## Theano
pip install Theano
sudo pip install Theano
THEANO_FLAGS=device=opencl0:0 python test.py
## Install emacs
sudo apt-get build-dep emacs24
wget http://ftp.gnu.org/gnu/emacs/emacs-24.5.tar.gz
tar -xf emacs-24.5.tar.* && cd emacs-24.5
./configure
make
sudo make install
cd ~/
git clone --recursive https://github.com/syl20bnr/spacemacs ~/.emacs.d
emacs
echo "setxkbmap -layout us -option ctrl:nocaps" >> ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment