Dockerfile 3.65 KB
Newer Older
1
FROM ubuntu:22.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
13
RUN sh -c 'echo deb [arch=amd64 trusted=yes] http://repo.radeon.com/rocm/apt/5.6/ 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 \
25
    g++ \
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's avatar
Paul committed
69
# Workaround broken miopen cmake files
Paul's avatar
Paul committed
70
RUN sed -i 's,;/usr/lib/x86_64-linux-gnu/librt.so,,g' /opt/rocm/lib/cmake/miopen/miopen-targets.cmake
Paul's avatar
Paul committed
71

Paul Fultz II's avatar
Paul Fultz II committed
72
73
74
RUN locale-gen en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8

Paul's avatar
Paul committed
75
76
77
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

Shucai Xiao's avatar
Shucai Xiao committed
78
79
80
# Install dependencies
ADD dev-requirements.txt /dev-requirements.txt
ADD requirements.txt /requirements.txt
81
ADD rbuild.ini /rbuild.ini
Shucai Xiao's avatar
Shucai Xiao committed
82
83
84

COPY ./tools/install_prereqs.sh /
RUN /install_prereqs.sh /usr/local / && rm /install_prereqs.sh
85
RUN test -f /usr/local/hash || exit 1
Paul's avatar
Paul committed
86

kahmed10's avatar
kahmed10 committed
87
# Install yapf
kahmed10's avatar
kahmed10 committed
88
RUN pip3 install yapf==0.28.0
kahmed10's avatar
kahmed10 committed
89

Paul's avatar
Paul committed
90
# Install doc requirements
Chris Austen's avatar
Chris Austen committed
91
ADD docs/.sphinx/requirements.txt /doc-requirements.txt
Paul's avatar
Paul committed
92
93
RUN pip3 install -r /doc-requirements.txt

94
# Download real models to run onnx unit tests
95
ENV ONNX_HOME=/.onnx
96
COPY ./tools/download_models.sh /
Shucai Xiao's avatar
Shucai Xiao committed
97
RUN /download_models.sh && rm /download_models.sh
98

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

104
105
106
# Install MLIR
ADD mlir-requirements.txt /mlir-requirements.txt
RUN cget -p /usr/local install -f /mlir-requirements.txt
Paul Fultz II's avatar
Paul Fultz II committed
107

108
COPY ./test/onnx/.onnxrt-commit /
Paul Fultz II's avatar
Paul Fultz II committed
109
110

ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
111
ARG ONNXRUNTIME_BRANCH=main
112
ARG ONNXRUNTIME_COMMIT
113

Paul Fultz II's avatar
Paul Fultz II committed
114
115
RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime && \
    cd onnxruntime && \
116
117
    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
118
119


Paul Fultz II's avatar
Paul Fultz II committed
120
121
ADD tools/build_and_test_onnxrt.sh /onnxruntime/build_and_test_onnxrt.sh

122
123
ENV MIOPEN_FIND_DB_PATH=/tmp/miopen/find-db
ENV MIOPEN_USER_DB_PATH=/tmp/miopen/user-db
Paul's avatar
Paul committed
124
125
ENV LD_LIBRARY_PATH=$PREFIX/lib

Paul's avatar
Paul committed
126
127
128
# 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
129
RUN ln -s /opt/rocm/llvm/bin/llvm-symbolizer /usr/bin/llvm-symbolizer