Skip to content

Instantly share code, notes, and snippets.

@mdrokz
Last active June 25, 2022 11:25
Show Gist options
  • Save mdrokz/04ff6d96e8b32f6842061306f127530b to your computer and use it in GitHub Desktop.
Save mdrokz/04ff6d96e8b32f6842061306f127530b to your computer and use it in GitHub Desktop.
Dockerfile with install script for setting up ROCM toolchain with (GFX803) support & Tensorflow Object Detection API
FROM ubuntu:20.04
LABEL maintainer="mdrokz <mdrokz18@gmail.com>"
COPY install-rocm.sh install-tensorflow-garden.sh ./
# Install updates to base image
RUN \
apt-get update -y \
&& apt-get dist-upgrade -y \
&& apt-get install -y \
&& apt-get install python3 pip libncurses5 libnuma-dev wget curl git protobuf-compiler -y \
&& chmod +x /install-rocm.sh \
&& chmod +x /install-tensorflow-garden.sh
CMD ["/install-rocm.sh"]
#!/bin/bash
# latest rocm
# wget -q -O - https://repo.radeon.com/rocm/rocm.gpg.key | apt-key add -
# echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/debian/ xenial main' | tee /etc/apt/sources.list.d/rocm.list
# specific version for rocm
# wget -q -O - https://repo.radeon.com/rocm/apt/5.1.1/rocm.gpg.key | apt-key add -
# echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/5.1.1/ xenial main' | tee /etc/apt/sources.list.d/rocm.list
# apt update
# usermod -a -G render root
usermod -a -G video root
# apt install rocm-dkms -y
# apt install rocm-libs hipcub miopen-hip rccl -y
mkdir ~/Documents
mkdir ~/Documents/tensorflow_rocm
cd ~/Documents/tensorflow_rocm
# install rocm core libs
wget https://repo.radeon.com/amdgpu-install/21.50.2/ubuntu/focal/amdgpu-install_21.50.2.50002-1_all.deb
apt-get install ./amdgpu-install_21.50.2.50002-1_all.deb -y
amdgpu-install --usecase=rocm --no-dkms -y
apt-get install rccl -y
# install custom rocblas
wget https://github.com/xuhuisheng/rocm-gfx803/releases/download/rocm511/rocblas_2.43.0-490c4140.dirty_amd64.deb
apt-get install ./rocblas_2.43.0-490c4140.dirty_amd64.deb -y
# get all python libs
# install custom tensorflow & pytorch
wget https://github.com/xuhuisheng/rocm-gfx803/releases/download/rocm500/tensorflow_rocm-2.8.0-cp38-cp38-linux_x86_64.whl
pip3 install tensorflow_rocm-2.8.0-cp38-cp38-linux_x86_64.whl
wget https://github.com/xuhuisheng/rocm-gfx803/releases/download/rocm500/torch-1.11.0a0+git503a092-cp38-cp38-linux_x86_64.whl
pip3 install torch-1.11.0a0+git503a092-cp38-cp38-linux_x86_64.whl
wget https://github.com/xuhuisheng/rocm-gfx803/releases/download/rocm500/torchvision-0.12.0a0+2662797-cp38-cp38-linux_x86_64.whl
pip3 install torchvision-0.12.0a0+2662797-cp38-cp38-linux_x86_64.whl
mkdir ~/Documents/object-detection-tensorflow
pip3 install pycocotools
cd ~/Documents/object-detection-tensorflow
git clone https://github.com/tensorflow/models
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
cp object_detection/packages/tf2/setup.py .
python3 -m pip install .
@mdrokz
Copy link
Author

mdrokz commented Jun 16, 2022

References / Credits

Run Command for docker - docker run -it --device=/dev/kfd --device=/dev/dri --volume /home/mdrokz/Documents/Machines/ubuntu-tensorflow:/home/mdrokz/Documents/Machines/ubuntu-tensorflow ubuntu-tensorflow /bin/bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment