Skip to content

Refactor

Refactor #45

# Test if example can run on multiplatform and both in serial (gcc) and parallel (openmpi)
name: AMR Example Test Run
on:
push:
branches: [ main ]
paths-ignore:
- 'doc/**'
- '**.md'
pull_request:
branches: [ main ]
paths-ignore:
- 'doc/**'
- '**.md'
workflow_dispatch:
jobs:
example-parallel-test-run:
name: AMR Example (MPI)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
mpi_compiler: ['openmpi']
python_version: ['3.10']
install_dep_command: ['sudo apt-get install -y libreadline-dev uuid-dev']
steps:
- uses: actions/checkout@v4
- name: Setup MPI ${{ matrix.mpi_compiler }} environment
uses: mpi4py/setup-mpi@v1
with:
mpi: ${{ matrix.mpi_compiler }}
- name: Setup Python ${{ matrix.python_version }} environment
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
cache: 'pip'
- run: |
python -m pip install --upgrade pip
pip install numpy mpi4py yt yt_libyt pandas
- name: Install other dependencies
run: |
${{ matrix.install_dep_command }}
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "install=${{ github.workspace }}/libyt-install" >> "$GITHUB_OUTPUT"
- name: Build libyt
run: |
cd ${{ github.workspace }}
rm -rf build
cmake -B build -S . -DINTERACTIVE_MODE=ON -DJUPYTER_KERNEL=ON
cmake --build build
cmake --install build --prefix "${{ steps.strings.outputs.install }}"
- name: Prepare Test
run: |
cd ${{ github.workspace }}/example/amr-example
cp ${{ github.workspace }}/.github/tests/test-DataIO/DataIOTest.py .
cd ${{ github.workspace }}/example/amr-example
cp ${{ github.workspace }}/.github/tools/generate_density_data.cpp .
g++ -o generate_density_data generate_density_data.cpp
./generate_density_data
- name: End-to-End Test - AMR Example (DataIOTest.py) - MPI Size 3
run: |
cd ${{ github.workspace }}/example/amr-example
make clean
make LIBYT_PATH="${{ steps.strings.outputs.install }}"
OMPI_MCA_osc=sm,pt2pt mpirun -np 3 ./example DataIOTest.py
example-serial-test-run:
name: AMR Example (GCC)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
python_version: ['3.10']
install_dep_command: ['sudo apt-get install -y libreadline-dev uuid-dev']
steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python_version }} environment
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
cache: 'pip'
- run: |
python -m pip install --upgrade pip
pip install numpy yt yt_libyt pandas
- name: Install other dependencies
run: |
${{ matrix.install_dep_command }}
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "install=${{ github.workspace }}/libyt-install" >> "$GITHUB_OUTPUT"
- name: Build libyt
run: |
cd ${{ github.workspace }}
rm -rf build
cmake -B build -S . -DINTERACTIVE_MODE=ON -DJUPYTER_KERNEL=ON -DSERIAL_MODE=ON
cmake --build build
cmake --install build --prefix "${{ steps.strings.outputs.install }}"
- name: Prepare Test
run: |
cd ${{ github.workspace }}/example/amr-example
cp ${{ github.workspace }}/.github/tests/test-DataIO/DataIOTest.py .
cd ${{ github.workspace }}/example/amr-example
cp ${{ github.workspace }}/.github/tools/generate_density_data.cpp .
g++ -o generate_density_data generate_density_data.cpp
./generate_density_data
- name: End-to-End Test - AMR Example (DataIOTest.py) - Serial
run: |
cd ${{ github.workspace }}/example/amr-example
make clean
make OPTIONS=-DSERIAL_MODE LIBYT_PATH="${{ steps.strings.outputs.install }}"
./example DataIOTest.py