[ROCm] Update Dockerfiles of ROCm and MIgraphX to ROCm5.4 (#14013)

Update Dockerfiles of ROCm and MIGraphX to ROCm5.4
Update README.md

Co-authored-by: peixuanzuo <peixuanzuo@linmif39a000004.zvflicr54joexhdgnhvmxrxygg.phxx.internal.cloudapp.net>
This commit is contained in:
PeixuanZuo 2022-12-22 10:03:34 +08:00 committed by GitHub
parent b5fd2a6a80
commit a170e40fbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 9 deletions

View file

@ -5,10 +5,11 @@
# Dockerfile to run ONNXRuntime with MIGraphX integration
#--------------------------------------------------------------------------
FROM ubuntu:18.04
FROM ubuntu:20.04
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_BRANCH=main
ARG ROCM_VERSION=5.4
ENV DEBIAN_FRONTEND noninteractive
ENV MIGRAPHX_DISABLE_FAST_GELU=1
@ -21,10 +22,10 @@ ENV LANG C.UTF-8
# Install rocm
RUN apt-get update && apt-get install -y gnupg2 --no-install-recommends curl && \
curl -sL http://repo.radeon.com/rocm/rocm.gpg.key | apt-key add - && \
sh -c 'echo deb [arch=amd64] http://repo.radeon.com/rocm/apt/4.5.2/ ubuntu main > /etc/apt/sources.list.d/rocm.list'
sh -c 'echo deb [arch=amd64] http://repo.radeon.com/rocm/apt/${ROCM_VERSION}/ ubuntu main > /etc/apt/sources.list.d/rocm.list'
RUN apt-get update &&\
apt-get install -y sudo git bash build-essential rocm-dev libpython3.6-dev python3-pip miopen-hip \
apt-get install -y sudo git bash build-essential rocm-dev python3-dev python3-pip miopen-hip \
rocblas half aria2 libnuma-dev
RUN aria2c -q -d /tmp -o cmake-3.24.3-linux-x86_64.tar.gz \
@ -39,7 +40,7 @@ ENV PATH /opt/miniconda/bin:/code/cmake-3.24.3-linux-x86_64/bin:${PATH}
# Install MIGraphX from source
RUN mkdir -p /migraphx
RUN cd /migraphx && git clone --depth=1 --branch migraphx_for_ort https://github.com/ROCmSoftwarePlatform/AMDMIGraphX src
RUN cd /migraphx && rbuild package --cxx /opt/rocm-4.5.2/llvm/bin/clang++ -d /migraphx/deps -B /migraphx/build -S /migraphx/src/ -DPYTHON_EXECUTABLE=/usr/bin/python3
RUN cd /migraphx && rbuild package --cxx /opt/rocm/llvm/bin/clang++ -d /migraphx/deps -B /migraphx/build -S /migraphx/src/ -DPYTHON_EXECUTABLE=/usr/bin/python3
RUN dpkg -i /migraphx/build/*.deb
RUN rm -rf /migraphx
@ -54,5 +55,5 @@ RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXR
/bin/sh onnxruntime/dockerfiles/scripts/install_common_deps.sh &&\
cd onnxruntime &&\
/bin/sh ./build.sh --cmake_extra_defines ONNXRUNTIME_VERSION=`cat ./VERSION_NUMBER` --config Release --parallel \
--skip_tests --build_wheel --use_rocm --rocm_version=4.5.2 --rocm_home /opt/rocm --use_migraphx &&\
--skip_tests --build_wheel --use_rocm --rocm_version=${ROCM_VERSION} --rocm_home /opt/rocm --use_migraphx &&\
pip install /code/onnxruntime/build/Linux/Release/dist/*.whl

View file

@ -5,15 +5,18 @@
# Dockerfile to run ONNXRuntime with ROCm integration
#--------------------------------------------------------------------------
FROM rocm/pytorch:rocm5.2.3_ubuntu20.04_py3.7_pytorch_1.12.1
FROM rocm/pytorch:rocm5.4_ubuntu20.04_py3.7_pytorch_1.12.1
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_BRANCH=main
WORKDIR /code
ENV PATH /opt/miniconda/bin:/code/cmake-3.24.3-linux-x86_64/bin:${PATH}
# Prepare onnxruntime repository & build onnxruntime
RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime &&\
/bin/sh onnxruntime/dockerfiles/scripts/install_common_deps.sh &&\
cd onnxruntime &&\
/bin/sh ./build.sh --config Release --build_wheel --update --build --parallel --cmake_extra_defines\
ONNXRUNTIME_VERSION=$(cat ./VERSION_NUMBER) --use_rocm --rocm_home=/opt/rocm &&\

View file

@ -279,7 +279,7 @@ Nothing else from ONNX Runtime source tree will be copied/installed to the image
Note: When running the container you built in Docker, please either use 'nvidia-docker' command instead of 'docker', or use Docker command-line options to make sure NVIDIA runtime will be used and appropiate files mounted from host. Otherwise, CUDA libraries won't be found. You can also [set NVIDIA runtime as default in Docker](https://github.com/dusty-nv/jetson-containers#docker-default-runtime).
## MIGraphX
**Ubuntu 18.04, rocm4.5, AMDMIGraphX v1.2**
**Ubuntu 20.04, ROCm5.4, AMDMIGraphX v1.2**
1. Build the docker image from the Dockerfile in this repository.
```
@ -293,7 +293,7 @@ Note: When running the container you built in Docker, please either use 'nvidia-
```
## ROCm
**Ubuntu 20.04, ROCm5.2.3**
**Ubuntu 20.04, ROCm5.4**
1. Build the docker image from the Dockerfile in this repository.
```
@ -303,5 +303,5 @@ Note: When running the container you built in Docker, please either use 'nvidia-
2. Run the Docker image
```
docker run -it --device=/dev/kfd --device=/dev/dri --group-add video --privileged onnxruntime-rocm
docker run -it --device=/dev/kfd --device=/dev/dri --group-add video onnxruntime-rocm
```