Skip to content

fschlimb CI for sharpy #91

fschlimb CI for sharpy

fschlimb CI for sharpy #91

Workflow file for this run

name: Sharpy CI
run-name: ${{ github.actor }} CI for sharpy
permissions: read-all
on:
push:
branches:
- main
pull_request:
defaults:
run:
shell: bash
env:
IMEX_CACHE_NUMBER: 4 # Increase to reset cache
jobs:
build_and_test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
steps:
- name: Check repo
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup env
# CONDA_ROOT="$(realpath $GITHUB_WORKSPACE/..)/install/miniconda3"
# echo "CONDA_ROOT=$CONDA_ROOT" >> "$GITHUB_ENV"
run: |
INSTALLED_DIR="$(realpath $GITHUB_WORKSPACE)/third_party/install"
echo "INSTALLED_DIR=$INSTALLED_DIR" >> "$GITHUB_ENV"
echo 'IMEX_SHA<<EOF' >> $GITHUB_ENV
cat imex_version.txt >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Restore IMEX cache
id: cache-imex
uses: actions/cache/restore@v3
with:
path: third_party/install/**
key: ${{ runner.os }}-build-imex-${{ env.IMEX_CACHE_NUMBER }}-${{ env.IMEX_SHA }}
- name: Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
# environment-file: etc/example-environment.yml
# - name: Miniconda
# run: |
# env
# rm -rf $CONDA_ROOT
# cd $GITHUB_WORKSPACE/..
# rm -f Miniconda3-*.sh
# CPKG=Miniforge3-Linux-x86_64.sh
# wget -q https://github.com/conda-forge/miniforge/releases/latest/download/$CPKG
# bash $CPKG -u -b -f -p $CONDA_ROOT
# export PATH=$CONDA_ROOT/condabin:$CONDA_ROOT/bin:${PATH}
# eval "$($CONDA_ROOT/bin/python -m conda shell.bash hook)"
# conda install -c conda-forge --override-channels python git-lfs 'conda-build<=24.1.2'
# # aahhhh bug in conda somewhere
# sed -i "s,\#\!/usr/bin/env python,#\!$CONDA_ROOT/bin/python," $CONDA_ROOT/*bin/conda
# conda clean --all -y
- name: Build SHARPY
# export PATH=$CONDA_ROOT/condabin:$CONDA_ROOT/bin:${PATH}
# eval "$($CONDA_ROOT/bin/python -m conda shell.bash hook)"
run: |
env
cd conda-recipe
conda build --numpy 1.26 -c conda-forge --override-channels --no-anaconda-upload --no-test .
- name: Save IMEX cache
uses: actions/cache/save@v3
if: steps.cache-imex.outputs.cache-hit != 'true'
with:
path: third_party/install/**
key: ${{ runner.os }}-build-imex-${{ env.IMEX_CACHE_NUMBER }}-${{ env.IMEX_SHA }}
- name: Install SHARPY
# export PATH=$CONDA_ROOT/condabin:$CONDA_ROOT/bin:${PATH}
# eval "$($CONDA_ROOT/bin/python -m conda shell.bash hook)"
run: |
conda create --use-local -c conda-forge --override-channels -n sharpy -v sharpy pytest pytest-timeout
conda activate sharpy
- name: Test SHARPY (pytest)
# export PATH=$CONDA_ROOT/condabin:$CONDA_ROOT/bin:${PATH}
# eval "$($CONDA_ROOT/bin/python -m conda shell.bash hook)"
run: |
conda activate sharpy
cd test
pytest . -v -s --timeout=30
SHARPY_FORCE_DIST=1 pytest . -v -s --timeout=30
mpirun -n 2 pytest . -v -s --timeout=30
mpirun -n 3 pytest . -v -s --timeout=30
mpirun -n 4 pytest . -v -s --timeout=30
cd -
- name: Run examples
# export PATH=$CONDA_ROOT/condabin:$CONDA_ROOT/bin:${PATH}
# eval "$($CONDA_ROOT/bin/python -m conda shell.bash hook)"
run: |
conda activate sharpy
cd examples
SHARPY_FALLBACK=numpy python -u ./stencil-2d.py 5 1024 star 4
SHARPY_FALLBACK=numpy SHARPY_FORCE_DIST=1 python -u ./stencil-2d.py 5 1024 star 4
mpirun -n 2 -genv SHARPY_FALLBACK=numpy python -u ./stencil-2d.py 5 2048 star 2
mpirun -n 3 -genv SHARPY_FALLBACK=numpy python -u ./stencil-2d.py 5 2048 star 2
mpirun -n 4 -genv SHARPY_FALLBACK=numpy python -u ./stencil-2d.py 5 2048 star 2
python -u ./wave_equation.py -b numpy
python -u ./wave_equation.py -d f32
python -u ./wave_equation.py -d f64
SHARPY_FORCE_DIST=1 python -u ./wave_equation.py
mpirun -n 2 python -u ./wave_equation.py
mpirun -n 3 python -u ./wave_equation.py
mpirun -n 4 python -u ./wave_equation.py
python -u ./shallow_water.py -b numpy
python -u ./shallow_water.py -d f32
python -u ./shallow_water.py -d f64
mpirun -n 2 python -u ./shallow_water.py
mpirun -n 3 python -u ./shallow_water.py
mpirun -n 4 python -u ./shallow_water.py
python -u ./black_scholes.py -b numpy
python -u ./black_scholes.py -d f32
python -u ./black_scholes.py -d f64
SHARPY_FORCE_DIST=1 python -u ./black_scholes.py
mpirun -n 2 python -u ./black_scholes.py
mpirun -n 3 python -u ./black_scholes.py
mpirun -n 4 python -u ./black_scholes.py
cd -