Skip to content

Merge pull request #126 from cindytsai/fix #88

Merge pull request #126 from cindytsai/fix

Merge pull request #126 from cindytsai/fix #88

# Test if example can run on multiplatform and both in serial (gcc) and parallel (openmpi)
name: amr example
permissions:
contents: read
on:
push:
branches: [ main ]
paths-ignore:
- 'doc/**'
- '**.md'
pull_request:
branches: [ main ]
paths-ignore:
- 'doc/**'
- '**.md'
workflow_dispatch:
jobs:
example-parallel-test-run:
name: parallel
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']
build_pybind11_option: ['-DUSE_PYBIND11=ON', '-DUSE_PYBIND11=OFF']
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 \
${{ matrix.build_pybind11_option }}
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-parallel-codecov:
name: parallel
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 lcov']
build_pybind11_option: ['-DUSE_PYBIND11=ON', '-DUSE_PYBIND11=OFF']
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: Configure and Build
run: |
cd ${{ github.workspace }}
rm -rf build
cmake -B build -S . -DINTERACTIVE_MODE=ON -DJUPYTER_KERNEL=ON -DCODE_COVERAGE=ON \
${{ matrix.build_pybind11_option }}
cmake --build build
- name: End-to-End Test - AMR Example - MPI Size 3
working-directory: ${{ github.workspace }}/build/example/amr-example
run: |
OMPI_MCA_osc=sm,pt2pt mpirun -np 3 ./example
- name: Generate code coverage report
working-directory: ${{ github.workspace }}/build/src/CMakeFiles/yt.dir
run: |
lcov --directory . --capture --ignore-errors mismatch --output-file coverage.info
lcov --extract coverage.info "*/libyt/src/*" "*/libyt/include/*" -o coverage-project-only.info
- name: Upload code coverage report to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ github.workspace }}/build/src/CMakeFiles/yt.dir/coverage-project-only.info
verbose: true
example-serial-test-run:
name: serial
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']
build_pybind11_option: ['-DUSE_PYBIND11=ON', '-DUSE_PYBIND11=OFF']
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 \
${{ matrix.build_pybind11_option }}
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
example-serial-codecov:
name: serial
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 lcov']
build_pybind11_option: ['-DUSE_PYBIND11=ON', '-DUSE_PYBIND11=OFF']
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: Configure and Build
run: |
cd ${{ github.workspace }}
rm -rf build
cmake -B build -S . -DINTERACTIVE_MODE=ON -DJUPYTER_KERNEL=ON -DSERIAL_MODE=ON -DCODE_COVERAGE=ON \
${{ matrix.build_pybind11_option }}
cmake --build build
- name: End-to-End Test - AMR Example - Serial
working-directory: ${{ github.workspace }}/build/example/amr-example
run: |
./example
- name: Generate code coverage report
working-directory: ${{ github.workspace }}/build/src/CMakeFiles/yt.dir
run: |
lcov --directory . --capture --ignore-errors mismatch --output-file coverage.info
lcov --extract coverage.info "*/libyt/src/*" "*/libyt/include/*" -o coverage-project-only.info
- name: Upload code coverage report to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ github.workspace }}/build/src/CMakeFiles/yt.dir/coverage-project-only.info
verbose: true