-
-
Save jarutis/ff28bca8cfb9ce0c8b1a to your computer and use it in GitHub Desktop.
## 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 |
Thanks for this gist. I actually got Theano to work on my AMD GPU using OpenCL. Sadly Lasagne is still not using the new Theano backend (gpuarray), so do not bother if you need Lasagne.
@Formulator
The Ubuntu guys suggest not upgrading if you need to use the proprietary AMD drivers. In Ubuntu 14.04 you can switch the driver with one click within the configuration.
How does the emacs section relate to the rest of the gist?
Also beware of those 2 lines :
sudo ntfsfix /dev/sda2
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.BAK
Hi,
Didn't expect this to get much attention, glad somebody found it useful :)
@saxenauts you are right, at least at the time of writing this script I couldn't get Theano to train a neural network on AMD GPU, do not remember exact problem now. Some basic stuff worked though. I wonder if things have changed since then.
@Formulator I wanted to try this on 16.04 as well, I'll post the outcome.
@jonsafari emacs has nothing to with this, I should have put that part somewhere else... I basically just copy pasted bash history for future reference.
@Formulator
At least for me the following experimental driver works fine. At least tests for torch-cl pass.
Can we train DNN over opencl with theano? I read theano uses CUNN for nn training. Is that still true?
@jarutis
Thanks for this, it's great to use amd graphic card with theano
But for me, I installed everything as per your instructions but now when I try to import theano I get the error "Could not initialize pygpu, support disabled".. Please help me with this, I am a newbee in deep learning and will love it if I can get theano to work with amd
Thanks for this lovely post. Everything installed just fine however CNN does not seem to work on GPU? Have you faced similar issue. Looks like Thano does not support OpenCL completely.
Any tips to get this working on Ubuntu 16.04, been trying to get it to work for a few days now, first time trying to get calculations on the GPU and giving up hope! Apparently AMD Catalyst no longer supported on, 16.04 offers AMDGPU driver. clBLAS is giving errors on 'make'. Also am using Anaconda. Is what I'm doing a lost cause? Suggestions greatly appreciated.
GPU
product: Whistler [Radeon HD 6630M/6650M/6750M/7670M/7690M]
[http://www.omgubuntu.co.uk/2016/03/ubuntu-drops-amd-catalyst-fglrx-driver-16-04]
make[2]: *** No rule to make target '/opt/AMDAPPSDK-3.0/lib/x86_64/libOpenCL.so', needed by 'library/libclBLAS.so.2.10.0'. Stop.
CMakeFiles/Makefile2:223: recipe for target 'library/CMakeFiles/clBLAS.dir/all' failed
make[1]: *** [library/CMakeFiles/clBLAS.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2