Skip to content

Commit

Permalink
Add builds for sles in github actions (#2048)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfultz2 authored Aug 12, 2023
1 parent 11c0d23 commit 2bc62c4
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 2 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,71 @@ jobs:
git config --global --add safe.directory /data
python3 tools/format.py origin/${{ github.event_name == 'pull_request' && github.base_ref || 'develop' }}

sles:
runs-on: ROCM-Ubuntu
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

# In this step, this action saves a list of existing images,
# the cache is created without them in the post run.
# It also restores the cache if it exists.
- name: Docker layer cache
uses: jpribyl/[email protected]
with:
key: docker-layer-caching-migraphx-sles-${{hashFiles('hip-clang.docker', '**/*requirements.txt', '**/install_prereqs.sh', 'rbuild.ini')}}
restore-keys:
docker-layer-caching-migraphx-sles-
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true

- name: Build the Docker image
run: docker build . --file tools/docker/sles.docker --tag migraphx-sles

- name: Restore cache files for ccache
uses: actions/cache/restore@v3
id: ccache_restore
with:
path: ${{ github.workspace }}/ccache
key: ccache-sles-${{ github.ref }}
restore-keys: ccache-sles-

- name: Build migraphx
shell: bash -c "docker run -i -v=$GITHUB_WORKSPACE:/data -w /data migraphx-sles bash < {0}"
run: |
set -e
export CCACHE_COMPRESSLEVEL=10
export CCACHE_DIR=/data/ccache
export CCACHE_NOHASHDIR=true
export CCACHE_BASEDIR=/data
export CCACHE_MAXSIZE=1
mkdir build
cd build
CXX=/opt/rocm/llvm/bin/clang++ CC=/opt/rocm/llvm/bin/clang cmake \
-DBUILD_DEV=On \
-DCMAKE_CXX_COMPILER_LAUNCHER=/usr/local/bin/ccache \
-DCMAKE_C_COMPILER_LAUNCHER=/usr/local/bin/ccache \
..
make -j$(nproc) tests driver

- name: Clear ccache cache before saving
if: ${{ steps.ccache_restore.outputs.cache-hit }}
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set +x
gh extension install actions/gh-actions-cache --pin v1.0.1
gh actions-cache delete ${{ steps.ccache_restore.outputs.cache-matched-key }} --confirm

- name: Save cache files for ccache
uses: actions/cache/save@v3
if: always()
with:
path: ${{ github.workspace }}/ccache
key: ccache-sles-${{ github.ref }}

pyflakes:
runs-on: ubuntu-20.04

Expand Down
2 changes: 2 additions & 0 deletions src/include/migraphx/algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
#include <migraphx/config.hpp>

namespace migraphx {
Expand Down
46 changes: 46 additions & 0 deletions tools/docker/sles.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM registry.suse.com/suse/sle15:15.4

RUN sh -c 'echo -e "\
[rocm]\n\
name=rocm\n\
baseurl=https://repo.radeon.com/rocm/zyp/5.5/main\n\
enabled=1\n\
gpgcheck=1\n\
gpgkey=https://repo.radeon.com/rocm/rocm.gpg.key\n\
" > /etc/zypp/repos.d/rocm.repo'

RUN cat /etc/zypp/repos.d/rocm.repo

RUN zypper -n --gpg-auto-import-keys refresh

RUN zypper install -y -t pattern devel_basis enhanced_base
RUN zypper --gpg-auto-import-keys install -y \
doxygen \
gcc-c++ \
gdb \
git \
python3-pip

# 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

ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

# Install yapf
RUN pip3 install yapf==0.28.0

# Install doc requirements
# ADD docs/.sphinx/requirements.txt /doc-requirements.txt
# RUN pip3 install -r /doc-requirements.txt

# Install dependencies
ADD dev-requirements.txt /dev-requirements.txt
ADD requirements.txt /requirements.txt
ADD rbuild.ini /rbuild.ini

COPY ./tools/install_prereqs.sh /
RUN /install_prereqs.sh /usr/local / && rm /install_prereqs.sh
27 changes: 25 additions & 2 deletions tools/install_prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,30 @@ set -e
export LC_ALL=C.UTF-8
export LANG=C.UTF-8

source /etc/os-release

if [[ ("${ID}" == "sles") ]]; then
zypper -n --gpg-auto-import-keys install -y \
cmake \
miopen-hip-devel \
openmp-extras-devel \
python3-devel \
python3-pip \
rocblas-devel \
rocm-cmake
else
# Need pip3 and Python headers to build dependencies
apt update && apt install -y \
cmake \
libnuma-dev \
miopen-hip-dev \
openmp-extras \
python3-dev \
python3-pip \
rocblas-dev \
rocm-cmake
fi

# Need pip3 and Python headers to build dependencies
apt update && apt install -y python3-pip python3-dev cmake rocm-cmake rocblas miopen-hip openmp-extras

# Needed for cmake to build various pip packages
pip3 install setuptools wheel
Expand All @@ -56,9 +77,11 @@ echo "Dependencies are installed at $PREFIX"
# Install deps with rbuild
rbuild prepare -d $PREFIX -s develop

if [[ ("${ID}" != "sles") ]]; then
export CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=ON"

pip3 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 between dist versions
pip3 install protobuf==3.20.0
fi

0 comments on commit 2bc62c4

Please sign in to comment.