Skip to content

Instantly share code, notes, and snippets.

@bartbroere
Forked from jarutis/ubuntu.sh
Last active January 26, 2017 15:31
Show Gist options
  • Save bartbroere/de03f71b1ea63a63fc90a47fb5cafa07 to your computer and use it in GitHub Desktop.
Save bartbroere/de03f71b1ea63a63fc90a47fb5cafa07 to your computer and use it in GitHub Desktop.
Theano and Keras setup on ubuntu with OpenCL on AMD card
## install Catalyst proprietary
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment