Dockerfile 5.88 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
RUN if [ "$ROCMVERSION" != "5.6" ] && [ "$ROCMVERSION" != "5.7" ]; then \
Illia Silin's avatar
Illia Silin committed
16
        wget -qO - http://repo.radeon.com/rocm/rocm.gpg.key | apt-key add - && \
17
        sh -c "echo deb [arch=amd64] $DEB_ROCM_REPO ubuntu main > /etc/apt/sources.list.d/rocm.list"; \
Illia Silin's avatar
Illia Silin committed
18
19
    elif [ "$ROCMVERSION" = "5.6" ] && [ "$compiler_version" = "" ]; then \
         sh -c "wget http://artifactory-cdn.amd.com/artifactory/list/amdgpu-deb/amd-nonfree-radeon_20.04-1_all.deb" && \
20
         apt update && apt-get install -y ./amd-nonfree-radeon_20.04-1_all.deb && \
21
22
         amdgpu-repo --amdgpu-build=1567752 --rocm-build=compute-rocm-dkms-no-npi-hipclang/11914 && \
         amdgpu-install -y --usecase=rocm --no-dkms; \
23
    elif [ "$ROCMVERSION" = "5.6" ] && [ "$compiler_version" = "rc4" ] || [ "$compiler_version" = "amd-stg-open" ]; then \
Illia Silin's avatar
Illia Silin committed
24
25
         sh -c "wget http://artifactory-cdn.amd.com/artifactory/list/amdgpu-deb/amdgpu-install-internal_5.6-20.04-1_all.deb" && \
         apt update && apt-get install -y ./amdgpu-install-internal_5.6-20.04-1_all.deb && \
26
27
28
29
30
31
         sh -c 'echo deb [arch=amd64 trusted=yes] http://compute-artifactory.amd.com/artifactory/list/rocm-release-archive-20.04-deb/ 5.6 rel-62  > /etc/apt/sources.list.d/rocm-build.list' && \
         amdgpu-repo --amdgpu-build=1609671 && amdgpu-install -y --usecase=rocm --no-dkms; \
    elif [ "$ROCMVERSION" = "5.7" ] && [ "$compiler_version" = "" ] || [ "$compiler_version" = "amd-stg-open" ]; then \
         sh -c "wget http://artifactory-cdn.amd.com/artifactory/list/amdgpu-deb/amdgpu-install-internal_5.7-20.04-1_all.deb" && \
         apt update && apt-get install -y ./amdgpu-install-internal_5.7-20.04-1_all.deb && \
         amdgpu-repo --amdgpu-build=1609671 --rocm-build=compute-rocm-npi-mi300/1354 && amdgpu-install -y --usecase=rocm --no-dkms; \
32
    fi
Illia Silin's avatar
Illia Silin committed
33

JD's avatar
JD committed
34
RUN wget --no-check-certificate -qO - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add -
35
RUN sh -c "echo deb http://mirrors.kernel.org/ubuntu focal main universe | tee -a /etc/apt/sources.list"
36
RUN curl -fsSL https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/rocm-keyring.gpg
JD's avatar
JD committed
37
38
39
40

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

66
67
68
69
70
71
72
73
74
75
76
#Install latest version of cmake
RUN apt purge --auto-remove -y cmake
RUN apt update
RUN apt install -y software-properties-common lsb-release
RUN apt clean all
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
RUN apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"
RUN apt install -y kitware-archive-keyring
RUN rm /etc/apt/trusted.gpg.d/kitware.gpg
RUN apt install -y cmake

JD's avatar
JD committed
77
78
79
80
81
82
83
84
85
# 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
86
87
# Install packages for processing the performance results
RUN pip3 install --upgrade pip
Illia Silin's avatar
Illia Silin committed
88
RUN pip3 install sqlalchemy==1.4.46
89
90
91
92
RUN pip3 install pymysql
RUN pip3 install pandas
RUN pip3 install setuptools-rust
RUN pip3 install sshtunnel
JD's avatar
JD committed
93
94
95
96
97
98
# 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
99
100
101
102
103

# 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
104
105
106
107

WORKDIR /

ENV compiler_version=$compiler_version
108
ENV compiler_commit=$compiler_commit
109
RUN sh -c "echo compiler version = '$compiler_version'"
110
RUN sh -c "echo compiler commit = '$compiler_commit'"
111

112
RUN if [ "$compiler_version" = "amd-stg-open" ] && [ "$compiler_commit" = "" ]; then \
113
        git clone -b "$compiler_version" https://github.com/RadeonOpenCompute/llvm-project.git && \
114
115
116
117
118
119
        cd llvm-project && mkdir build && cd build && \
        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;compiler-rt" ../llvm && \
        make -j 8 ; \
    else echo "using the release compiler"; \
    fi

120
RUN if [ "$compiler_version" = "amd-stg-open" ] && [ "$compiler_commit" != "" ]; then \
121
122
123
124
125
126
127
128
        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 && \
        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;compiler-rt" ../llvm && \
        make -j 8 ; \
    else echo "using the release compiler"; \
    fi


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