POSTS
Improved way to install tensorflow-rocm
Introduction
Summary of how TensorFlow works with AMDGPU Radeon
Installation
Dependencies
sudo apt update
sudo apt -y install software-properties-common curl wget # for add-apt-repository
Install Python 3.5.2
Python3.6/Python3.7 can be unstable with AMD GPUs so we will be using Python 3.5.2 For Ubuntu 18 since the default version is Python3.6 executing the following script will configure 3.5.2
PYTHON35=false
if [[ `python3 --version` == *"3.5"* ]] ; then
echo 'python3.5 -- yes'
PYTHON35=true
else
echo 'python3.5 -- no'
PYTHON35=false
fi
if [ $PYTHON35 == 'true' ] ; then
sudo apt install -y python3.5 python3.5-dev python3-pip
else
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt-get update
sudo apt install -y python3.5 python3.5-dev python3-pip
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --set python3 /usr/bin/python3.5
python3 --version
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
sudo -H python3 /tmp/get-pip.py --force-reinstall
#sudo apt-get remove -y --purge python3-apt
fi
Install GPU Driver for AMD GPU Radeon
Execute the following commands
wget -qO - http://repo.radeon.com/rocm/apt/debian/rocm.gpg.key | sudo apt-key add -
sudo sh -c 'echo deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ xenial main > /etc/apt/sources.list.d/rocm.list'
sudo apt update
sudo apt install -y rocm-dkms rocm-libs miopen-hip cxlactivitylogger libnuma-dev rocm-smi
sudo usermod -a -G video $LOGNAME
/opt/rocm/opencl/bin/x86_64/clinfo
echo 'export ROCM_HOME=/opt/rocm' >> ~/.profile
echo 'export HCC_HOME=$ROCM_HOME/hcc' >> ~/.profile
echo 'export HIP_PATH=$ROCM_HOME/hip' >> ~/.profile
echo 'export PATH=/usr/local/bin:$HCC_HOME/bin:$HIP_PATH/bin:$ROCM_HOME/bin:$PATH:/opt/rocm/opencl/bin/x86_64' >> ~/.profile
echo 'export LD_LIBRARY=$LD_LIBRARY:/opt/rocm/opencl/lib/x86_64' >> ~/.profile
echo 'export LC_ALL="en_US.UTF-8"' >> ~/.profile
echo 'export LC_CTYPE="en_US.UTF-8"' >> ~/.profile
TensorFlow-ROCm Installation
Currently, TensorFlow 1.12.0 is the latest, and a good version of Keras is 2.2.2
We will specify and install Keras 2.2.2.
sudo pip3 uninstall -y tensorflow
sudo pip3 install --user tensorflow-rocm
sudo pip3 install --user Keras==2.2.2
Instructions for how to install tensorflow are below
https://github.com/aieater/rocm_tensorflow_info
The above method can be executed with the following one line.
curl -sL http://install.aieater.com/setup_rocm_tensorflow_p35 | bash -
References
- TensorFlow-ROCm https://github.com/ROCmSoftwarePlatform/tensorflow-upstream
- ROCm https://github.com/ROCmSoftwarePlatform
- MIOpen https://gpuopen.com/compute-product/miopen/
- GPUEater summarized TensorFlow-ROCm https://github.com/aieater/rocm_tensorflow_info
Are you interested in working with us?
We are actively looking for new members for developing and improving GPUEater cloud platform. For more information, please check here.