Dockerfile 3.48 KB
Newer Older
1
FROM ubuntu:20.04
Paul's avatar
Paul committed
2

Paul's avatar
Paul committed
3
ARG PREFIX=/usr/local
Paul's avatar
Paul committed
4
5
6
7

# Support multiarch
RUN dpkg --add-architecture i386

8
9
# Install rocm key
RUN apt-get update && apt-get install -y gnupg2 --no-install-recommends curl && \
10
    curl -sL http://repo.radeon.com/rocm/rocm.gpg.key | apt-key add -
11

Paul's avatar
Paul committed
12
# Add rocm repository
Chris Austen's avatar
Chris Austen committed
13
RUN sh -c 'echo deb [arch=amd64 trusted=yes] http://repo.radeon.com/rocm/apt/.apt_6.0/ focal main > /etc/apt/sources.list.d/rocm.list'
Paul's avatar
Paul committed
14

15
16
17
# From docs.amd.com for installing rocm. Needed to install properly
RUN sh -c "echo 'Package: *\nPin: release o=repo.radeon.com\nPin-priority: 600' > /etc/apt/preferences.d/rocm-pin-600"

Paul's avatar
Paul committed
18
19
20
21
22
23
24
# Install dependencies
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
    apt-utils \
    build-essential \
    cmake \
    curl \
    doxygen \
Paul's avatar
Paul committed
25
    g++-7 \
Paul's avatar
Paul committed
26
    gdb \
Paul's avatar
Paul committed
27
28
    git \
    lcov \
Paul Fultz II's avatar
Paul Fultz II committed
29
30
    locales \
    pkg-config \
kahmed10's avatar
kahmed10 committed
31
32
33
    python3 \
    python3-dev \
    python3-pip \
Paul's avatar
Paul committed
34
    software-properties-common \
Paul's avatar
Paul committed
35
    wget \
Paul Fultz II's avatar
Paul Fultz II committed
36
    rocm-device-libs \
37
38
    hip-base \
    libnuma-dev \
Paul Fultz II's avatar
Paul Fultz II committed
39
40
    miopen-hip \
    rocblas \
41
42
43
44
45
46
47
48
49
50
51
52
53
54
    hipfft \
    rocthrust \
    rocrand \
    hipsparse \
    rccl \
    rccl-dev \
    rocm-smi-lib \
    rocm-dev \
    roctracer-dev \
    hipcub  \
    hipblas  \
    hipify-clang \
    half \
    libssl-dev \
Paul's avatar
Paul committed
55
    zlib1g-dev && \
Paul's avatar
Paul committed
56
57
58
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

59

60
# add this for roctracer dependancies
61
RUN pip3 install CppHeaderParser
62

Paul Fultz II's avatar
Paul Fultz II committed
63
64
65
66
67
# Workaround broken rocm packages
RUN ln -s /opt/rocm-* /opt/rocm
RUN echo "/opt/rocm/lib" > /etc/ld.so.conf.d/rocm.conf
RUN echo "/opt/rocm/llvm/lib" > /etc/ld.so.conf.d/rocm-llvm.conf
RUN ldconfig
68

Paul Fultz II's avatar
Paul Fultz II committed
69
70
71
RUN locale-gen en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8

Paul's avatar
Paul committed
72
73
74
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

Shucai Xiao's avatar
Shucai Xiao committed
75
76
77
# Install dependencies
ADD dev-requirements.txt /dev-requirements.txt
ADD requirements.txt /requirements.txt
78
ADD rbuild.ini /rbuild.ini
Shucai Xiao's avatar
Shucai Xiao committed
79

80
81
82
# Temporarily install a new cmake until switching to ubuntu 22.04
RUN pip3 install cmake==3.22.1

83
84
85
86
# Location where onnx unit tests models are cached
ENV ONNX_HOME=/.onnx
RUN mkdir -p $ONNX_HOME/models && chmod 777 $ONNX_HOME/models

Shucai Xiao's avatar
Shucai Xiao committed
87
88
COPY ./tools/install_prereqs.sh /
RUN /install_prereqs.sh /usr/local / && rm /install_prereqs.sh
89
RUN test -f /usr/local/hash || exit 1
Paul's avatar
Paul committed
90

kahmed10's avatar
kahmed10 committed
91
# Install yapf
kahmed10's avatar
kahmed10 committed
92
RUN pip3 install yapf==0.28.0
kahmed10's avatar
kahmed10 committed
93

Paul's avatar
Paul committed
94
# Install doc requirements
Chris Austen's avatar
Chris Austen committed
95
ADD docs/.sphinx/requirements.txt /doc-requirements.txt
Paul's avatar
Paul committed
96
97
RUN pip3 install -r /doc-requirements.txt

Paul Fultz II's avatar
Paul Fultz II committed
98
99
# Install latest ccache version
RUN cget -p $PREFIX install facebook/zstd@v1.4.5 -X subdir -DCMAKE_DIR=build/cmake
100
RUN cget -p $PREFIX install ccache@v4.1 -DENABLE_TESTING=OFF
101
102
RUN cget -p /opt/cmake install kitware/cmake@v3.26.4

103
COPY ./test/onnx/.onnxrt-commit /
Paul Fultz II's avatar
Paul Fultz II committed
104
105

ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
106
ARG ONNXRUNTIME_BRANCH=main
107
ARG ONNXRUNTIME_COMMIT
108

Paul Fultz II's avatar
Paul Fultz II committed
109
110
RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime && \
    cd onnxruntime && \
111
112
    if [ -z "$ONNXRUNTIME_COMMIT" ] ; then git checkout $(cat /.onnxrt-commit) ; else git checkout ${ONNXRUNTIME_COMMIT} ; fi && \
    /bin/sh /onnxruntime/dockerfiles/scripts/install_common_deps.sh
113
114


Paul Fultz II's avatar
Paul Fultz II committed
115
116
ADD tools/build_and_test_onnxrt.sh /onnxruntime/build_and_test_onnxrt.sh

117
118
ENV MIOPEN_FIND_DB_PATH=/tmp/miopen/find-db
ENV MIOPEN_USER_DB_PATH=/tmp/miopen/user-db
Paul's avatar
Paul committed
119
120
ENV LD_LIBRARY_PATH=$PREFIX/lib

Paul's avatar
Paul committed
121
122
123
# Setup ubsan environment to printstacktrace
ENV UBSAN_OPTIONS=print_stacktrace=1
ENV ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1
Paul Fultz II's avatar
Paul Fultz II committed
124
RUN ln -s /opt/rocm/llvm/bin/llvm-symbolizer /usr/bin/llvm-symbolizer