Last active
November 9, 2020 09:01
-
-
Save jarutis/ff28bca8cfb9ce0c8b1a to your computer and use it in GitHub Desktop.
Theano and Keras setup on ubuntu with OpenCL on AMD card
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 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 |
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Formulator
At least for me the following experimental driver works fine. At least tests for torch-cl pass.