2021-03-12 15:51:08 +00:00
|
|
|
# --------------------------------------------------------------
|
|
|
|
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
|
# Licensed under the MIT License.
|
|
|
|
|
# --------------------------------------------------------------
|
|
|
|
|
# Dockerfile to run ONNXRuntime with MIGraphX integration
|
|
|
|
|
#--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
FROM ubuntu:18.04
|
|
|
|
|
|
|
|
|
|
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
|
|
|
|
|
ARG ONNXRUNTIME_BRANCH=master
|
|
|
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
|
RUN apt-get clean && apt-get update && apt-get install -y locales
|
|
|
|
|
RUN locale-gen en_US.UTF-8
|
|
|
|
|
RUN update-locale LANG=en_US.UTF-8
|
|
|
|
|
ENV LC_ALL C.UTF-8
|
|
|
|
|
ENV LANG C.UTF-8
|
|
|
|
|
|
|
|
|
|
# Install rocm
|
|
|
|
|
RUN apt-get update && apt-get install -y gnupg2 --no-install-recommends curl && \
|
2022-01-10 23:18:43 +00:00
|
|
|
curl -sL http://repo.radeon.com/rocm/rocm.gpg.key | apt-key add - && \
|
2021-03-12 15:51:08 +00:00
|
|
|
sh -c 'echo deb [arch=amd64] http://repo.radeon.com/rocm/apt/4.0/ xenial main > /etc/apt/sources.list.d/rocm.list'
|
|
|
|
|
|
|
|
|
|
RUN apt-get update &&\
|
|
|
|
|
apt-get install -y --no-install-recommends sudo git bash build-essential cmake libelf1 rocm-dkms libpython3.6-dev python3-pip miopen-hip rocblas\
|
|
|
|
|
libnuma-dev kmod half hipsparse rocfft hipblas
|
|
|
|
|
|
|
|
|
|
# Install yapf
|
|
|
|
|
RUN pip3 install yapf==0.28.0
|
|
|
|
|
|
2021-07-31 00:16:37 +00:00
|
|
|
ENV PATH /opt/miniconda/bin:/code/cmake-3.21.0-linux-x86_64/bin:${PATH}
|
2021-03-12 15:51:08 +00:00
|
|
|
|
|
|
|
|
# Install dependencies
|
|
|
|
|
COPY ./scripts/install_rocm_deps.sh /
|
|
|
|
|
RUN chmod +x /install_rocm_deps.sh && /install_rocm_deps.sh && rm /install_rocm_deps.sh
|
|
|
|
|
|
|
|
|
|
WORKDIR /code
|
|
|
|
|
|
|
|
|
|
# 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 &&\
|
|
|
|
|
pip install /code/onnxruntime/build/Linux/Release/dist/*.whl &&\
|
|
|
|
|
cd .. &&\
|
2021-07-31 00:16:37 +00:00
|
|
|
rm -rf onnxruntime cmake-3.21.0-linux-x86_64
|
2021-03-12 15:51:08 +00:00
|
|
|
|