This instruction provides a starting point for build TensorFlow ROCm port from source. Note: it is recommended to start with a clean Ubuntu 18.04 system
Follow steps at Basic Installation to install ROCm stack. NOTE: The ROCm3.1 release changes the installation directory structure. If your system has ROCm packages installed from ROCm3.0 or earlier, make sure the old packages are fully purged before upgrade. For details of the ROCm instructions, please refer to the ROCm QuickStart Installation Guide.
Setup environment variables, and add those environment variables at the end of ~/.bashrc
export ROCM_PATH=/opt/rocm-3.1.0
export HCC_HOME=$ROCM_PATH/hcc
export HIP_PATH=$ROCM_PATH/hip
export PATH=$HCC_HOME/bin:$HIP_PATH/bin:$PATH
export ROCM_TOOLKIT_PATH=$ROCM_PATH
On Python 3-based systems:
sudo apt-get update && sudo apt-get install -y \
python3-numpy \
python3-dev \
python3-wheel \
python3-mock \
python3-future \
python3-pip \
python3-yaml \
python3-setuptools && \
sudo apt-get clean
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install -y openjdk-8-jdk openjdk-8-jre unzip && sudo apt-get clean && sudo rm -rf /var/lib/apt/lists/*
cd ~/ && wget https://github.com/bazelbuild/bazel/releases/download/0.24.1/bazel-0.24.1-installer-linux-x86_64.sh
sudo bash ~/bazel*.sh
# Clone it
cd ~ && git clone -b r1.15-rocm https://github.com/ROCmSoftwarePlatform/tensorflow-upstream.git
# Python 3: Build and install TensorFlow ROCm port pip3 package
cd ~/tensorflow && ./build_rocm_python3