Dockerfile 6.29 KB
Newer Older
1
FROM ubuntu:20.04
Illia Silin's avatar
Illia Silin committed
2
ARG DEBIAN_FRONTEND=noninteractive
3
ARG ROCMVERSION=6.2
4
ARG compiler_version=""
5
ARG compiler_commit=""
6
ARG CK_SCCACHE=""
JD's avatar
JD committed
7
ARG DEB_ROCM_REPO=http://repo.radeon.com/rocm/apt/.apt_$ROCMVERSION/
8
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
Illia Silin's avatar
Illia Silin committed
9
10
11
12
13
14

# Add rocm repository
RUN set -xe && \
    useradd -rm -d /home/jenkins -s /bin/bash -u 1004 jenkins && \
    apt-get update && apt-get install -y --allow-unauthenticated apt-utils wget gnupg2 curl && \
    curl -fsSL https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/rocm-keyring.gpg
15

16
17
18
RUN if [ "$ROCMVERSION" != "6.3" ]; then \
        sh -c "wget https://repo.radeon.com/amdgpu-install/$ROCMVERSION/ubuntu/focal/amdgpu-install_6.2.60200-1_all.deb  --no-check-certificate" && \
        apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated ./amdgpu-install_6.2.60200-1_all.deb && \
19
20
21
        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'; \
22
    elif [ "$ROCMVERSION" = "6.3" ] && [ "$compiler_version" = "rc1" ]; then \
23
24
25
26
        sh -c "wget http://artifactory-cdn.amd.com/artifactory/list/amdgpu-deb/amdgpu-install-internal_6.3-20.04-1_all.deb --no-check-certificate" && \
        apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install dialog libpopt0 rsync && DEBIAN_FRONTEND=noninteractive apt-get install ./amdgpu-install-internal_6.3-20.04-1_all.deb && \
        sh -c 'echo deb [arch=amd64 trusted=yes] http://compute-artifactory.amd.com/artifactory/list/rocm-release-archive-20.04-deb/ 6.3 rel-20 > /etc/apt/sources.list.d/rocm-build.list' && \
        amdgpu-repo --amdgpu-build=2074281; \
27
    fi
Illia Silin's avatar
Illia Silin committed
28

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

32
## Sccache binary built from source for ROCm, only install if CK_SCCACHE is defined
33
34
35
ARG SCCACHE_REPO_URL=http://compute-artifactory.amd.com/artifactory/rocm-generic-experimental/rocm-sccache
ENV SCCACHE_INSTALL_LOCATION=/usr/local/.cargo/bin
ENV PATH=$PATH:${SCCACHE_INSTALL_LOCATION}
36
37
38
39
40
41
ENV CK_SCCACHE=$CK_SCCACHE
RUN if [ "$CK_SCCACHE" != "" ]; then \
        mkdir -p ${SCCACHE_INSTALL_LOCATION} && \
        curl ${SCCACHE_REPO_URL}/portable/0.2.16/sccache-0.2.16-alpha.1-rocm --output ${SCCACHE_INSTALL_LOCATION}/sccache && \
        chmod +x ${SCCACHE_INSTALL_LOCATION}/sccache; \
    fi
42

JD's avatar
JD committed
43
44
45
# Install dependencies
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
    build-essential \
46
    cmake \
JD's avatar
JD committed
47
48
    git \
    hip-rocclr \
49
    iputils-ping \
JD's avatar
JD committed
50
51
52
53
54
55
    jq \
    libelf-dev \
    libncurses5-dev \
    libnuma-dev \
    libpthread-stubs0-dev \
    llvm-amdgpu \
56
    net-tools \
JD's avatar
JD committed
57
    pkg-config \
58
    python \
59
    python3 \
JD's avatar
JD committed
60
61
    python3-dev \
    python3-pip \
62
    redis \
63
    rocm-llvm-dev \
Illia Silin's avatar
Illia Silin committed
64
    sshpass \
65
    stunnel \
JD's avatar
JD committed
66
67
    software-properties-common \
    vim \
68
    nano \
JD's avatar
JD committed
69
    zlib1g-dev \
70
    zip \
JD's avatar
JD committed
71
    openssh-server \
72
    clang-format-12 \
JD's avatar
JD committed
73
    kmod && \
JD's avatar
JD committed
74
    apt-get clean && \
Illia Silin's avatar
Illia Silin committed
75
76
77
78
    rm -rf /var/lib/apt/lists/* && \
    rm -rf amdgpu-install* && \
# Remove unnecessary rocm components that take a lot of space
    apt-get remove -y rocblas rocfft rocsparse composablekernel-dev
JD's avatar
JD committed
79

80
# Update the cmake to version 3.27.5
Illia Silin's avatar
Illia Silin committed
81
RUN pip install --upgrade cmake==3.27.5 && \
82
#Install latest ccache
Illia Silin's avatar
Illia Silin committed
83
84
    git clone https://github.com/ccache/ccache.git && \
    cd ccache && mkdir build && cd build && cmake .. && make install && \
Illia Silin's avatar
Illia Silin committed
85
#Install ninja build tracing tools
Illia Silin's avatar
Illia Silin committed
86
    cd / && \
Illia Silin's avatar
Illia Silin committed
87
88
89
90
    wget -qO /usr/local/bin/ninja.gz https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip && \
    gunzip /usr/local/bin/ninja.gz && \
    chmod a+x /usr/local/bin/ninja && \
    git clone https://github.com/nico/ninjatracing.git && \
Illia Silin's avatar
Illia Silin committed
91
#Install latest cppcheck
Illia Silin's avatar
Illia Silin committed
92
    git clone https://github.com/danmar/cppcheck.git && \
Illia Silin's avatar
Illia Silin committed
93
94
    cd cppcheck && mkdir build && cd build && cmake .. && cmake --build . && \
    cd / && \
JD's avatar
JD committed
95
# Install an init system
Illia Silin's avatar
Illia Silin committed
96
    wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
Illia Silin's avatar
Illia Silin committed
97
    dpkg -i dumb-init_*.deb && rm dumb-init_*.deb && \
98
# Install packages for processing the performance results
Illia Silin's avatar
Illia Silin committed
99
100
101
102
    pip3 install --upgrade pip && \
    pip3 install sqlalchemy==1.4.46 pymysql pandas==2.0.3 setuptools-rust sshtunnel==0.4.0 && \
# Add render group
    groupadd -f render && \
103
# Install the new rocm-cmake version
Illia Silin's avatar
Illia Silin committed
104
105
106
    git clone -b master https://github.com/ROCm/rocm-cmake.git  && \
    cd rocm-cmake && mkdir build && cd build && \
    cmake  .. && cmake --build . && cmake --build . --target install
107
108

WORKDIR /
Illia Silin's avatar
Illia Silin committed
109
# Add alternative compilers, if necessary
110
ENV compiler_version=$compiler_version
111
ENV compiler_commit=$compiler_commit
Illia Silin's avatar
Illia Silin committed
112
113
RUN sh -c "echo compiler version = '$compiler_version'" && \
    sh -c "echo compiler commit = '$compiler_commit'"
114

115
RUN if ( [ "$compiler_version" = "amd-staging" ] || [ "$compiler_version" = "amd-mainline" ] ) && [ "$compiler_commit" = "" ]; then \
116
        git clone -b "$compiler_version" https://github.com/ROCm/llvm-project.git && \
117
        cd llvm-project && mkdir build && cd build && \
118
        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 && \
119
120
121
122
        make -j 8 ; \
    else echo "using the release compiler"; \
    fi

123
RUN if ( [ "$compiler_version" = "amd-staging" ] || [ "$compiler_version" = "amd-mainline" ] ) && [ "$compiler_commit" != "" ]; then \
124
        git clone -b "$compiler_version" https://github.com/ROCm/llvm-project.git && \
125
        cd llvm-project && git checkout "$compiler_commit" && echo "checking out commit $compiler_commit" && mkdir build && cd build && \
126
        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 && \
127
128
129
        make -j 8 ; \
    else echo "using the release compiler"; \
    fi