parallel code blocks for stencil (for multi rhs and block decomposition) #1084
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build/Test | |
on: | |
push: | |
pull_request: | |
env: | |
MAKE_BUILD_FLAGS: -j2 | |
GRID_REPOSITORY_REF: feature/gpt | |
CC: mpicc | |
CXX: mpic++ | |
OMPI_CC: cc | |
OMPI_CXX: c++ | |
MPICH_CC: cc | |
MPICH_CXX: c++ | |
# Note if this is changed, all caches will be not be valid anymore | |
CACHE_KEY: 2021-05-30 | |
jobs: | |
build-grid: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: ['gcc', 'clang'] | |
mpi: ['none', 'mpich', 'openmpi'] | |
outputs: | |
c-lime-version: ${{ steps.c-lime-version.outputs.key }} | |
grid-version: ${{ steps.grid-version.outputs.key }} | |
steps: | |
- name: Check Hardware | |
run: | | |
cat /proc/cpuinfo | grep avx2 | |
- name: Install Ubuntu packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang-9 libmpfr-dev libgmp-dev libssl-dev zlib1g-dev libmpich-dev libopenmpi-dev libfftw3-dev | |
- name: Set compiler alternatives to clang-9 | |
if: matrix.compiler == 'clang' | |
run: | | |
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-9 1 | |
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-9 1 | |
sudo update-alternatives --set cc /usr/bin/clang-9 | |
sudo update-alternatives --set c++ /usr/bin/clang++-9 | |
- name: Set compiler to cc and c++ | |
if: matrix.mpi == 'none' | |
run: | | |
echo 'CC=cc' >> $GITHUB_ENV | |
echo 'CXX=c++' >> $GITHUB_ENV | |
- name: Set MPI alternatives to mpich | |
if: matrix.mpi == 'mpich' | |
run: | | |
sudo update-alternatives --set mpi /usr/bin/mpicc.mpich | |
sudo update-alternatives --set mpirun /usr/bin/mpirun.mpich | |
sudo update-alternatives --set mpi-x86_64-linux-gnu /usr/include/x86_64-linux-gnu/mpich | |
- name: Clone c-lime | |
uses: actions/checkout@v3 | |
with: | |
repository: usqcd-software/c-lime | |
path: c-lime | |
- name: Get c-lime cache key | |
id: c-lime-version | |
run: | | |
cd c-lime | |
echo "key=$(git rev-parse HEAD)-${CACHE_KEY}" >> $GITHUB_OUTPUT | |
- name: c-lime package cache | |
uses: actions/cache@v3 | |
id: c-lime-package-cache | |
with: | |
path: c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb | |
key: c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ steps.c-lime-version.outputs.key }} | |
- name: Build and package c-lime | |
if: steps.c-lime-package-cache.outputs.cache-hit != 'true' | |
run: | | |
PKGDIR=$PWD/c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }} | |
mkdir -p $PKGDIR | |
cd c-lime | |
./autogen.sh | |
./configure || cat config.log | |
make ${MAKE_BUILD_FLAGS} | |
DESTDIR=$PKGDIR make install | |
cd $PKGDIR | |
mkdir -p DEBIAN | |
wget -nv -O ./DEBIAN/control https://gist.githubusercontent.com/lehner/a0feb168a9cb2068e0345a94b2df2eb9/raw/79dd47ef34aa7166191c7d8293372bcb4b9a5533/deb.general.control | |
sed -e 's/%pkgname%/c-lime/g' -e 's/%version%/0.0.1/g' -e 's/%size%/1024/g' -e 's/%maintainer%/GPT Dev Team/g' -e 's/%description%/C-LIME/g' -i ./DEBIAN/control | |
cd - | |
dpkg-deb --build $PKGDIR | |
- name: Install c-lime | |
run: | | |
sudo dpkg -i c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb | |
- name: Clone Grid | |
uses: actions/checkout@v3 | |
with: | |
repository: lehner/Grid | |
ref: ${{ env.GRID_REPOSITORY_REF }} | |
path: Grid | |
- name: Get Grid cache key | |
id: grid-version | |
run: | | |
cd Grid | |
./bootstrap.sh | |
mkdir -p build | |
cd build | |
if [ "${{ matrix.mpi }}" == "none" ] | |
then | |
../configure CXXFLAGS=-fPIC --enable-simd=AVX2 || cat config.log | |
else | |
../configure CXXFLAGS=-fPIC --enable-simd=AVX2 --enable-comms=mpi-auto || cat config.log | |
fi | |
cd Grid | |
make version-cache Version.h | |
echo "key=$(sha256sum version-cache|cut -f 1 -d " ")-${CACHE_KEY}" >> $GITHUB_OUTPUT | |
- name: Grid package cache | |
uses: actions/cache@v3 | |
id: grid-package-cache | |
with: | |
path: grid-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb | |
key: grid-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ steps.grid-version.outputs.key }} | |
- name: Build and package Grid | |
if: steps.grid-package-cache.outputs.cache-hit != 'true' | |
run: | | |
PKGDIR=$PWD/grid-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }} | |
mkdir -p $PKGDIR | |
cd Grid/build/Grid | |
make ${MAKE_BUILD_FLAGS} | |
DESTDIR=$PKGDIR make install | |
cd .. && install -D -m755 grid-config ${PKGDIR}/usr/bin/grid-config || return 1 | |
cd $PKGDIR | |
mkdir -p DEBIAN | |
wget -nv -O ./DEBIAN/control https://gist.githubusercontent.com/lehner/a0feb168a9cb2068e0345a94b2df2eb9/raw/79dd47ef34aa7166191c7d8293372bcb4b9a5533/deb.general.control | |
sed -e 's/%pkgname%/grid/g' -e 's/%version%/0.0.1/g' -e 's/%size%/1024/g' -e 's/%maintainer%/GPT Dev Team/g' -e 's/%description%/Grid/g' -i ./DEBIAN/control | |
cd - | |
dpkg-deb --build $PKGDIR | |
build-gpt: | |
needs: build-grid | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.6', '3.7', '3.8'] | |
compiler: ['gcc', 'clang'] | |
mpi: ['none', 'mpich', 'openmpi'] | |
outputs: | |
cgpt-version: ${{ steps.cgpt-version.outputs.key }} | |
gpt-version: ${{ steps.gpt-version.outputs.key }} | |
python-gpt-version: ${{ steps.python-gpt-version.outputs.version }} | |
steps: | |
- name: Check Hardware | |
run: | | |
cat /proc/cpuinfo | grep avx2 | |
- name: Install Ubuntu packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang-9 libmpfr-dev libgmp-dev libssl-dev zlib1g-dev libmpich-dev libopenmpi-dev libfftw3-dev | |
- name: Set compiler alternatives to clang-9 | |
if: matrix.compiler == 'clang' | |
run: | | |
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-9 1 | |
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-9 1 | |
sudo update-alternatives --set cc /usr/bin/clang-9 | |
sudo update-alternatives --set c++ /usr/bin/clang++-9 | |
- name: Set MPI alternatives to mpich | |
if: matrix.mpi == 'mpich' | |
run: | | |
sudo update-alternatives --set mpi /usr/bin/mpicc.mpich | |
sudo update-alternatives --set mpirun /usr/bin/mpirun.mpich | |
sudo update-alternatives --set mpi-x86_64-linux-gnu /usr/include/x86_64-linux-gnu/mpich | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: Setup python dependencies | |
run: | | |
pip install numpy | |
- name: c-lime package cache | |
uses: actions/cache@v3 | |
id: c-lime-package-cache | |
with: | |
path: c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb | |
key: c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ needs.build-grid.outputs.c-lime-version }} | |
- name: Install c-lime | |
run: | | |
sudo dpkg -i c-lime-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb | |
- name: Grid package cache | |
uses: actions/cache@v3 | |
id: grid-package-cache | |
with: | |
path: grid-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb | |
key: grid-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ needs.build-grid.outputs.grid-version }} | |
- name: Install Grid | |
run: | | |
sudo dpkg -i grid-${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb | |
- name: Clone gpt | |
uses: actions/checkout@v3 | |
with: | |
path: gpt | |
- name: Get cgpt cache key | |
id: cgpt-version | |
# Currently it is not possible to use multiple patterns with hashFiles, therefore we use our own hashing, see: | |
# https://github.community/t/hashfiles-with-multiple-patterns/17168 | |
run: | | |
# TODO: if the make and make.summit files are removed from ./gpt/lib/cgpt we can use the complete folder for hashing | |
echo ${{ hashFiles('gpt/lib/cgpt/lib/**') }} >> cgpt_cache_key_file | |
echo ${{ needs.build-grid.outputs.grid-version }} >> cgpt_cache_key_file | |
echo "key=$(sha256sum cgpt_cache_key_file|cut -f 1 -d " ")-${CACHE_KEY}" >> $GITHUB_OUTPUT | |
- name: Get gpt cache key | |
id: gpt-version | |
# Currently it is not possible to use multiple patterns with hashFiles, therefore we use our own hashing, see: | |
# https://github.community/t/hashfiles-with-multiple-patterns/17168 | |
run: | | |
echo ${{ hashFiles('gpt/lib/gpt/**') }} >> gpt_cache_key_file | |
echo "key=$(sha256sum gpt_cache_key_file|cut -f 1 -d " ")-${CACHE_KEY}" >> $GITHUB_OUTPUT | |
- name: Get python-gpt version | |
id: python-gpt-version | |
run: | | |
gpt_version=$(printf "0.0.0r%s" "$(cd gpt && git rev-parse --short HEAD)") | |
echo "version=${gpt_version}" >> $GITHUB_OUTPUT | |
- name: cgpt package cache | |
uses: actions/cache@v3 | |
id: cgpt-package-cache | |
with: | |
path: cgpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb | |
key: cgpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ steps.cgpt-version.outputs.key }} | |
- name: Build and package cgpt | |
if: steps.cgpt-package-cache.outputs.cache-hit != 'true' | |
run: | | |
PKGDIR=$PWD/cgpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }} | |
mkdir -p $PKGDIR | |
cd gpt/lib/cgpt | |
./make %grid-config 2 | |
SITEPACKAGES="/usr/local/lib/python${{ matrix.python-version}}/site-packages" | |
DST="${PKGDIR}/${SITEPACKAGES}" | |
mkdir -p ${DST} | |
cp build/cgpt.so ${DST} | |
cd $PKGDIR | |
mkdir -p DEBIAN | |
wget -nv -O ./DEBIAN/control https://gist.githubusercontent.com/lehner/a0feb168a9cb2068e0345a94b2df2eb9/raw/79dd47ef34aa7166191c7d8293372bcb4b9a5533/deb.general.control | |
sed -e 's/%pkgname%/cgpt/g' -e 's/%version%/0.0.1/g' -e 's/%size%/1024/g' -e 's/%maintainer%/GPT Dev Team/g' -e 's/%description%/cgpt/g' -i ./DEBIAN/control | |
cd - | |
dpkg-deb --build $PKGDIR | |
- name: gpt package cache | |
uses: actions/cache@v3 | |
id: gpt-package-cache | |
with: | |
path: gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb | |
key: gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ steps.gpt-version.outputs.key }} | |
- name: Build and package gpt | |
if: steps.gpt-package-cache.outputs.cache-hit != 'true' | |
run: | | |
PKGDIR=$PWD/gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }} | |
mkdir -p $PKGDIR | |
cd gpt | |
python3 -m compileall lib/gpt | |
SITEPACKAGES="/usr/local/lib/python${{ matrix.python-version}}/site-packages" | |
DST="${PKGDIR}/${SITEPACKAGES}" | |
mkdir -p ${DST} | |
cp -r lib/gpt ${DST} | |
cd $PKGDIR | |
mkdir -p DEBIAN | |
wget -nv -O ./DEBIAN/control https://gist.githubusercontent.com/lehner/a0feb168a9cb2068e0345a94b2df2eb9/raw/79dd47ef34aa7166191c7d8293372bcb4b9a5533/deb.general.control | |
sed -e 's/%pkgname%/gpt/g' -e 's/%version%/0.0.1/g' -e 's/%size%/1024/g' -e 's/%maintainer%/GPT Dev Team/g' -e 's/%description%/gpt/g' -i ./DEBIAN/control | |
cd - | |
dpkg-deb --build $PKGDIR | |
- name: Create combined package | |
run: | | |
PKGDIR=$PWD/python-gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }} | |
dpkg-deb -X gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb ${PKGDIR} | |
dpkg-deb -X cgpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb ${PKGDIR} | |
cd ${PKGDIR} | |
mkdir -p DEBIAN | |
wget -nv -O ./DEBIAN/control https://gist.githubusercontent.com/lehner/a0feb168a9cb2068e0345a94b2df2eb9/raw/79dd47ef34aa7166191c7d8293372bcb4b9a5533/deb.general.control | |
sed -e 's/%pkgname%/python-gpt/g' \ | |
-e "s/%version%/${{ steps.python-gpt-version.outputs.version }}/g" \ | |
-e "s/%size%/$(du -sk .|grep --color=never -E '[0-9]+' -o)/g" \ | |
-e 's/%maintainer%/GPT Dev Team/g' -e 's/%description%/gpt/g' -i ./DEBIAN/control | |
cd - | |
dpkg-deb --build $PKGDIR | |
- name: Create artifact for python-gpt package | |
uses: actions/upload-artifact@v3 | |
with: | |
path: python-gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb | |
name: python-gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ steps.python-gpt-version.outputs.version }} | |
test-gpt: | |
needs: [build-grid, build-gpt] | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.6', '3.7', '3.8'] | |
compiler: ['gcc', 'clang'] | |
mpi: ['none', 'mpich', 'openmpi'] | |
steps: | |
- name: Report Hardware | |
run: | | |
cat /proc/cpuinfo | |
- name: Install Ubuntu packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang-9 libmpfr-dev libgmp-dev libssl-dev zlib1g-dev libmpich-dev libopenmpi-dev libfftw3-dev | |
- name: Set compiler alternatives to clang-9 | |
if: matrix.compiler == 'clang' | |
run: | | |
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-9 1 | |
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-9 1 | |
sudo update-alternatives --set cc /usr/bin/clang-9 | |
sudo update-alternatives --set c++ /usr/bin/clang++-9 | |
- name: Set MPI alternatives to mpich | |
if: matrix.mpi == 'mpich' | |
run: | | |
sudo update-alternatives --set mpi /usr/bin/mpicc.mpich | |
sudo update-alternatives --set mpirun /usr/bin/mpirun.mpich | |
sudo update-alternatives --set mpi-x86_64-linux-gnu /usr/include/x86_64-linux-gnu/mpich | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: Setup python dependencies | |
run: | | |
pip install numpy coverage | |
- name: Download prebuild python-gpt | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ needs.build-gpt.outputs.python-gpt-version }} | |
- name: Install python-gpt | |
run: | | |
sudo dpkg -i python-gpt-${{ runner.os }}-python-${{ matrix.python-version }}-${{ matrix.compiler }}-${{ matrix.mpi }}.deb | |
- name: Clone gpt | |
uses: actions/checkout@v3 | |
with: | |
path: gpt | |
- name: Run tests | |
if: matrix.mpi == 'none' | |
run: | | |
cd gpt | |
export PYTHONPATH=/usr/local/lib/python${{ matrix.python-version}}/site-packages:/usr/local/lib64/python${{ matrix.python-version}}/site-packages | |
export WORK_DIR=$(mktemp -d) | |
./tests/run "coverage run" "--mpi_split 1.1.1.1" | |
- name: Run tests | |
if: matrix.mpi == 'openmpi' | |
env: | |
LD_PRELOAD: libmpi.so | |
run: | | |
cd gpt | |
export PYTHONPATH=/usr/local/lib/python${{ matrix.python-version}}/site-packages:/usr/local/lib64/python${{ matrix.python-version}}/site-packages | |
export WORK_DIR=$(mktemp -d) | |
mpirun -np 2 -mca btl ^openib -bind-to core python tests/core/scalar.py --mpi 1.1.1.2 | |
./tests/run "mpirun -np 1 -mca btl ^openib coverage run" "--mpi_split 1.1.1.1" | |
./tests/run "mpirun -np 2 -bind-to core -mca btl ^openib coverage run" "--mpi 1.1.1.2 --mpi 1.1.2 --mpi 2 --mpi_split 1.1.1.1 --shm 256" | |
- name: Run tests | |
if: matrix.mpi == 'mpich' | |
run: | | |
export PYTHONPATH=/usr/local/lib/python${{ matrix.python-version}}/site-packages:/usr/local/lib64/python${{ matrix.python-version}}/site-packages | |
cd gpt | |
export WORK_DIR=$(mktemp -d) | |
./tests/run "mpirun -np 1 coverage run" "--mpi_split 1.1.1.1" | |
./tests/run "mpirun -np 2 -bind-to core coverage run" "--mpi 1.1.1.2 --mpi 1.1.2 --mpi 2 --mpi_split 1.1.1.1 --shm 256" | |
- name: Coverage report | |
run: | | |
cd gpt | |
coverage combine | |
coverage report -m # Print coverage report to screen | |
coverage xml # Export coverage report as XML file, for codecov.io | |
- name: Upload coverage to Codecov | |
env: | |
PYTHON_VERSION: python${{ matrix.python-version }} | |
COMPILER: ${{ matrix.compiler }} | |
MPI: ${{ matrix.mpi }} | |
CODECOV_ENV: PYTHON_VERSION,COMPILER,MPI | |
run: | | |
cd gpt | |
if [ "${{ secrets.CODECOV_USERNAME }}" != "" ] \ | |
&& [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/master" ] | |
then | |
bash <(curl -s https://codecov.io/bash) \ | |
-f ./coverage.xml | |
else | |
echo "Skip uploading code coverage since we are not upstream" | |
fi | |
build-gpt-doc: | |
needs: [build-grid, build-gpt] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Install Ubuntu packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang-9 libmpfr-dev libgmp-dev libssl-dev zlib1g-dev libmpich-dev libopenmpi-dev | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
architecture: x64 | |
- name: Setup python dependencies | |
run: | | |
pip install numpy sphinx ipython sphinxcontrib-napoleon | |
- name: Download prebuild python-gpt | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-gpt-${{ runner.os }}-python-3.8-gcc-none-${{ needs.build-gpt.outputs.python-gpt-version }} | |
- name: Install python-gpt | |
run: | | |
sudo dpkg -i python-gpt-${{ runner.os }}-python-3.8-gcc-none.deb | |
- name: Clone gpt | |
uses: actions/checkout@v3 | |
with: | |
path: gpt | |
- name: Build documentation | |
id: build-documentation | |
env: | |
PYTHONPATH: /usr/local/lib/python3.8/site-packages:/usr/local/lib64/python3.8/site-packages | |
run: | | |
cd gpt/documentation | |
make html | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: documentation | |
path: gpt/documentation/build | |
build-gpt-docker-base: | |
needs: [build-grid, build-gpt, test-gpt] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check for rebuild | |
id: check-build | |
run: | | |
if [ "${{ secrets.DOCKER_USERNAME }}" != "" ] && [ "${{ secrets.DOCKER_PASSWORD }}" != "" ] \ | |
&& [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/master" ] | |
then | |
echo "build=1" >> $GITHUB_OUTPUT | |
else | |
echo "Skipping docker build." | |
fi | |
- name: Clone gpt | |
if: ${{ steps.check-build.outputs.build }} | |
uses: actions/checkout@v3 | |
- name: Build docker gpt/base image | |
if: ${{ steps.check-build.outputs.build }} | |
uses: docker/build-push-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: ${{ secrets.DOCKER_USERNAME }}/base | |
tags: latest | |
push: true | |
path: docker/base | |
build-gpt-docker: | |
needs: [build-grid, build-gpt, test-gpt, build-gpt-docker-base] | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: ['gcc', 'clang'] | |
# TODO: add other mpi flavors: 'mpich', 'openmpi' | |
mpi: ['none'] | |
steps: | |
- name: Check for rebuild | |
id: check-build | |
run: | | |
if [ "${{ secrets.DOCKER_USERNAME }}" != "" ] && [ "${{ secrets.DOCKER_PASSWORD }}" != "" ] \ | |
&& [ "${{ github.event_name }}" == "push" ] && [ "${{ github.ref }}" == "refs/heads/master" ] | |
then | |
echo "build=1" >> $GITHUB_OUTPUT | |
else | |
echo "Skipping docker build." | |
fi | |
- name: Clone gpt | |
if: ${{ steps.check-build.outputs.build }} | |
uses: actions/checkout@v3 | |
- name: Download prebuild python-gpt | |
if: ${{ steps.check-build.outputs.build }} | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-gpt-${{ runner.os }}-python-3.8-${{ matrix.compiler }}-${{ matrix.mpi }}-${{ needs.build-gpt.outputs.python-gpt-version }} | |
- name: Move python-gpt package to docker folder | |
if: ${{ steps.check-build.outputs.build }} | |
run: | | |
mv python-gpt-${{ runner.os }}-python-3.8-${{ matrix.compiler }}-${{ matrix.mpi }}.deb docker/shell/gpt-packages | |
cp -r documentation/tutorials/ docker/notebook | |
cp -r tests/ benchmarks/ applications/ docker/shell | |
- name: Get Tags | |
if: ${{ steps.check-build.outputs.build }} | |
id: get-docker-tags | |
run: | | |
tags="${{ matrix.compiler }}-${{ matrix.mpi }}" | |
# reset this to clang at a later time | |
[ "${{ matrix.compiler }}-${{ matrix.mpi }}" == "gcc-none" ] && tags="${tags},latest" | |
echo "Image Tags: ${tags}" | |
echo "tags=${tags}" >> $GITHUB_OUTPUT | |
- name: Build docker gpt/shell image | |
if: ${{ steps.check-build.outputs.build }} | |
uses: docker/build-push-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: ${{ secrets.DOCKER_USERNAME }}/shell | |
build_args: BASE_IMAGE=${{ secrets.DOCKER_USERNAME }}/base,COMPILER=${{ matrix.compiler }},MPI=${{ matrix.mpi }} | |
tags: ${{ steps.get-docker-tags.outputs.tags }} | |
push: true | |
path: docker/shell | |
always_pull: true | |
- name: Build docker gpt/notebook image | |
if: ${{ steps.check-build.outputs.build }} | |
uses: docker/build-push-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
repository: ${{ secrets.DOCKER_USERNAME }}/notebook | |
build_args: BASE_IMAGE=${{ secrets.DOCKER_USERNAME }}/shell,COMPILER=${{ matrix.compiler }},MPI=${{ matrix.mpi }} | |
tags: ${{ steps.get-docker-tags.outputs.tags }} | |
push: true | |
path: docker/notebook | |
always_pull: true |