Dockerfile 4.64 KB
Newer Older
1
FROM ubuntu:20.04
Illia Silin's avatar
Illia Silin committed
2
ARG DEBIAN_FRONTEND=noninteractive
3
4
ARG ROCMVERSION=5.6
ARG compiler_version=""
5
ARG compiler_commit=""
JD's avatar
JD committed
6
7
8
9

RUN set -xe

ARG DEB_ROCM_REPO=http://repo.radeon.com/rocm/apt/.apt_$ROCMVERSION/
Illia Silin's avatar
Illia Silin committed
10
RUN useradd -rm -d /home/jenkins -s /bin/bash -u 1004 jenkins
JD's avatar
JD committed
11
# Add rocm repository
Illia Silin's avatar
Illia Silin committed
12
RUN chmod 1777 /tmp
JD's avatar
JD committed
13
RUN apt-get update
Illia Silin's avatar
Illia Silin committed
14
RUN apt-get install -y --allow-unauthenticated apt-utils wget gnupg2 curl
15
16
17
18

ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
RUN curl -fsSL https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/rocm-keyring.gpg

19
20
RUN wget https://repo.radeon.com/amdgpu-install/5.7/ubuntu/focal/amdgpu-install_5.7.50700-1_all.deb  --no-check-certificate
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated ./amdgpu-install_5.7.50700-1_all.deb
21

22
23
24
RUN wget -qO - http://repo.radeon.com/rocm/rocm.gpg.key | apt-key add - && \
    sh -c "echo deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/rocm-keyring.gpg] $DEB_ROCM_REPO focal main > /etc/apt/sources.list.d/rocm.list" && \
    sh -c 'echo deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/rocm-keyring.gpg] https://repo.radeon.com/amdgpu/$ROCMVERSION/ubuntu focal main > /etc/apt/sources.list.d/amdgpu.list'
Illia Silin's avatar
Illia Silin committed
25

26
RUN sh -c "echo deb http://mirrors.kernel.org/ubuntu focal main universe | tee -a /etc/apt/sources.list"
27
RUN amdgpu-install -y --usecase=rocm --no-dkms
JD's avatar
JD committed
28
29
30
31

# Install dependencies
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
    build-essential \
32
    ccache \
33
    cmake \
JD's avatar
JD committed
34
35
36
37
38
39
40
41
42
    git \
    hip-rocclr \
    jq \
    libelf-dev \
    libncurses5-dev \
    libnuma-dev \
    libpthread-stubs0-dev \
    llvm-amdgpu \
    pkg-config \
43
    python \
44
    python3 \
JD's avatar
JD committed
45
46
    python3-dev \
    python3-pip \
Illia Silin's avatar
Illia Silin committed
47
    sshpass \
JD's avatar
JD committed
48
49
    software-properties-common \
    vim \
50
    nano \
JD's avatar
JD committed
51
52
    zlib1g-dev \
    openssh-server \
53
    clang-format-12 \
JD's avatar
JD committed
54
    kmod && \
JD's avatar
JD committed
55
56
57
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

58
#Install latest version of cmake
59
60
61
62
RUN wget -qO /usr/local/bin/ninja.gz https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip
RUN gunzip /usr/local/bin/ninja.gz
RUN chmod a+x /usr/local/bin/ninja
RUN git clone https://github.com/nico/ninjatracing.git
63
64
# Update the cmake to the latest version
RUN pip install --upgrade cmake
65

JD's avatar
JD committed
66
67
68
69
70
71
72
73
74
# Setup ubsan environment to printstacktrace
RUN ln -s /usr/bin/llvm-symbolizer-3.8 /usr/local/bin/llvm-symbolizer
ENV UBSAN_OPTIONS=print_stacktrace=1

# Install an init system
RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb
RUN dpkg -i dumb-init_*.deb && rm dumb-init_*.deb

ARG PREFIX=/opt/rocm
75
76
# Install packages for processing the performance results
RUN pip3 install --upgrade pip
Illia Silin's avatar
Illia Silin committed
77
RUN pip3 install sqlalchemy==1.4.46
78
79
80
81
RUN pip3 install pymysql
RUN pip3 install pandas
RUN pip3 install setuptools-rust
RUN pip3 install sshtunnel
JD's avatar
JD committed
82
83
84
85
86
87
# Setup ubsan environment to printstacktrace
ENV UBSAN_OPTIONS=print_stacktrace=1

ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
RUN groupadd -f render
88
89
90
91
92

# Install the new rocm-cmake version
RUN git clone -b master https://github.com/RadeonOpenCompute/rocm-cmake.git  && \
  cd rocm-cmake && mkdir build && cd build && \
  cmake  .. && cmake --build . && cmake --build . --target install
93
94
95
96

WORKDIR /

ENV compiler_version=$compiler_version
97
ENV compiler_commit=$compiler_commit
98
RUN sh -c "echo compiler version = '$compiler_version'"
99
RUN sh -c "echo compiler commit = '$compiler_commit'"
100

101
RUN if [ "$compiler_version" = "amd-stg-open" ] && [ "$compiler_commit" = "" ]; then \
102
        git clone -b "$compiler_version" https://github.com/RadeonOpenCompute/llvm-project.git && \
103
        cd llvm-project && mkdir build && cd build && \
104
        cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=1 -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_ENABLE_RUNTIMES="compiler-rt" ../llvm && \
105
106
107
108
        make -j 8 ; \
    else echo "using the release compiler"; \
    fi

109
RUN if [ "$compiler_version" = "amd-stg-open" ] && [ "$compiler_commit" != "" ]; then \
110
111
        git clone -b "$compiler_version" https://github.com/RadeonOpenCompute/llvm-project.git && \
        cd llvm-project && git checkout "$compiler_commit" && echo "checking out commit $compiler_commit" && mkdir build && cd build && \
112
        cmake -DCMAKE_INSTALL_PREFIX=/opt/rocm/llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=1 -DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_ENABLE_RUNTIMES="compiler-rt" ../llvm && \
113
114
115
116
117
        make -j 8 ; \
    else echo "using the release compiler"; \
    fi


118
119
#ENV HIP_CLANG_PATH='/llvm-project/build/bin'
#RUN sh -c "echo HIP_CLANG_PATH = '$HIP_CLANG_PATH'"