Commit 3918ced3 authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

Add Dockerfile and prereqs to create a container for CentOS 8

Currently ROCm doesn't have a later release for 5.2.5 for CENTOS but this
is something still useful to test on

needed to add rocblas-devel and miopen-devel to get properly picked up by
cmake

Will reuse this work for RHEL and other OS builds once I can confirm make analyze
and make checks work with all debug and non debug builds
parent 93ffc92b
FROM centos:latest
ARG PREFIX=/usr/local
# Support multiarch
RUN rpm --target i386
RUN cd /etc/yum.repos.d/
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
# Add rocm repository
RUN sh -c 'echo -e "[rocm]\nname=rocm\nbaseurl=http://repo.radeon.com/rocm/centos8/5.2.5/main/\nenabled=1\ngpgcheck=1\ngpgkey=http://repo.radeon.com/rocm/rocm.gpg.key" > /etc/yum.repos.d/rocm.repo'
RUN yum clean all && \
yum install -y wget \
dnf-plugins-core \
clang \
epel-release
#For CentOS 8.3/8.4
RUN sh -c 'echo yum config-manager --set-enabled PowerTools'
# Install dependencies
RUN dnf update -y && dnf makecache --refresh
RUN dnf groupinstall -y "Development Tools" --setopt=group_package_types=mandatory,default,optional
RUN dnf --enablerepo=powertools install -y --nobest \
yum-utils \
#build-essential \
#clang-format-10 \
git-clang-format \
#cmake \
doxygen \
#g++-7 \
#gdb \
#git \
lcov \
#locales replaced by glib-langpack\
glibc-all-langpacks \
libffi-devel \
xz-devel \
bzip2-devel \
#pkg-config \
python38 \
python38-devel \
#software-properties-common \ # irrelevant to YUM
rocm-device-libs \
hip-base \
#libnuma-devel \
numactl \
miopen-hip \
miopen-hip-devel \
rocblas \
rocblas-devel \
hipfft \
rocthrust \
rocrand \
hipsparse \
rccl \
rccl-devel \
rocm-smi-lib \
rocm-dev \
roctracer-dev \
hipcub \
hipblas \
hipify-clang \
half \
#libssl-devel \
openssl-devel
#zlib1g-devel && \
#zlib-devel && \
RUN alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 60 && alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 50 && update-alternatives --auto python3
RUN python3 --version && ls -la /usr/bin
# add this for roctracer dependancies
RUN pip3.8 install CppHeaderParser
# 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
#RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8
#RUN export LC_ALL=en_US.UTF-8
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
#update pip
RUN pip3.8 install --upgrade pip
# Install dependencies
ADD dev-requirements.txt /dev-requirements.txt
ADD requirements.txt /requirements.txt
ADD rbuild.ini /rbuild.ini
COPY ./tools/install_prereqs_centos.sh /
RUN /install_prereqs_centos.sh /usr/local / && rm /install_prereqs_centos.sh
RUN test -f /usr/local/hash || exit 1
# Install yapf
RUN pip3.8 install yapf==0.28.0
# Install doc requirements
ADD doc/requirements.txt /doc-requirements.txt
RUN pip3.8 install -r /doc-requirements.txt
# Download real models to run onnx unit tests
ENV ONNX_HOME=/.onnx
COPY ./tools/download_models.sh /
RUN /download_models.sh && rm /download_models.sh
# Install latest ccache version
RUN cget -p $PREFIX install facebook/zstd@v1.4.5 -X subdir -DCMAKE_DIR=build/cmake
RUN cget -p $PREFIX install ccache@v4.1 -DENABLE_TESTING=OFF
RUN cget -p /opt/cmake install kitware/cmake@v3.24.3
COPY ./test/onnx/.onnxrt-commit /
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_BRANCH=main
ARG ONNXRUNTIME_COMMIT
RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime && \
cd onnxruntime && \
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
ADD tools/build_and_test_onnxrt.sh /onnxruntime/build_and_test_onnxrt.sh
RUN cget -p /usr/local install ROCmSoftwarePlatform/rocMLIR@acb727b348086b58a7f261b32c0e4f0686a4c0ee -DBUILD_MIXR_TARGET=On -DLLVM_ENABLE_ZSTD=Off -DLLVM_ENABLE_THREADS=Off
ENV MIOPEN_FIND_DB_PATH=/tmp/miopen/find-db
ENV MIOPEN_USER_DB_PATH=/tmp/miopen/user-db
ENV LD_LIBRARY_PATH=$PREFIX/lib
# 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
RUN ln -s /opt/rocm/llvm/bin/llvm-symbolizer /usr/bin/llvm-symbolizer
#!/bin/bash
#####################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#####################################################################################
#
# Build MIGraphX prerequisites for docker container
set -e
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
# Need pip3 and Python headers to build dependencies
dnf update && dnf install -y python3-pip python3-dev cmake rocm-cmake rocblas miopen-hip openmp-extras tbb2 tbb-devel
# Needed for cmake to build various pip packages
pip3.8 install setuptools wheel
# install rbuild to build dependencies
pip3.8 install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz
PREFIX=/usr/local
REQ_FILE_DIR=""
if [ "$#" -ge 2 ]; then
PREFIX=$1
cd $2
elif [ "$#" -eq 1 ]; then
PREFIX=$1
fi
echo "Dependencies are installed at $PREFIX"
# Install deps with rbuild
rbuild prepare -d $PREFIX -s develop
# install onnx package for unit tests
pip3.8 install onnx==1.10.2 numpy==1.21.6 typing==3.7.4 pytest==6.0.1 packaging==23.0
# pin version of protobuf in Python for onnx runtime unit tests
pip3.8 install protobuf==3.20.0
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment