Skip to content

Support Jupyter Notebook #14

Support Jupyter Notebook

Support Jupyter Notebook #14

Workflow file for this run

# Test: 1. If project can build successfully with different version of Python or not.
# 2. Can the example run in serial and in parallel.
name: GNU Make Build Test
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ main ]
paths-ignore:
- 'doc/**'
- '**.md'
pull_request:
branches: [ main ]
paths-ignore:
- 'doc/**'
- '**.md'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
# Job name: "python-build-test"
make-build-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout libyt repo
uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }} environment
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
cache: 'pip'
- run: |
python -m pip install --upgrade pip
pip install -r ${{ github.workspace}}/.github/tools/requirements.txt
- name: Setup MPI environment
uses: mpi4py/setup-mpi@v1
with:
mpi: 'openmpi'
- name: Install yt, mpi4py, and yt_libyt
run: |
pip install mpi4py yt
pip install yt-libyt
- name: Update GitHub Environment Variables
run: |
echo "PYTHON_PATH=${{ env.pythonLocation }}" >> $GITHUB_ENV
echo "NUMPY_PATH=${{ env.pythonLocation }}/lib/python${{ matrix.python-version }}/site-packages/numpy" >> $GITHUB_ENV
echo "LIBYT_PARALLEL_INSTALL_PATH=${{ github.workspace }}/libyt_parallel" >> $GITHUB_ENV
echo "LIBYT_SERIAL_INSTALL_PATH=${{ github.workspace }}/libyt_serial" >> $GITHUB_ENV
# setup-python has python3.7m only, idk why.
# So split building libyt into two.
- name: Set PYTHON_PATH, PYTHON_VERSION, NUMPY_PATH
if: ${{ matrix.python-version == '3.7'}}
run: |
cd ${{ github.workspace}}/src
sed -i 's@$(YOUR_PYTHON_PATH)@"${{ env.PYTHON_PATH }}"@' Makefile
sed -i 's@$(YOUR_NUMPY_PATH)@"${{ env.NUMPY_PATH }}"@' Makefile
sed -i 's@$(YOUR_PYTHON_VERSION)@"${{ matrix.python-version }}m"@' Makefile
- name: Set PYTHON_PATH, PYTHON_VERSION, NUMPY_PATH
if: ${{ matrix.python-version != '3.7' }}
run: |
cd ${{ github.workspace}}/src
sed -i 's@$(YOUR_PYTHON_PATH)@"${{ env.PYTHON_PATH }}"@' Makefile
sed -i 's@$(YOUR_NUMPY_PATH)@"${{ env.NUMPY_PATH }}"@' Makefile
sed -i 's@$(YOUR_PYTHON_VERSION)@"${{ matrix.python-version }}"@' Makefile
- name: Build libyt -- Parallel (MPI)
run: |
cd ${{ github.workspace}}/src
make clean
make INSTALL_PREFIX="${{ env.LIBYT_PARALLEL_INSTALL_PATH }}" install
- name: Build libyt -- Serial (GCC)
run: |
cd ${{ github.workspace}}/src
make clean
make OPTIONS="-DSERIAL_MODE"
make INSTALL_PREFIX="${{ env.LIBYT_SERIAL_INSTALL_PATH }}" install
- name: Prepare Test
run: |
cd ${{ github.workspace}}/example
cp ${{ github.workspace}}/.github/tests/test-DataIO/DataIOTest.py .
- name: Generate Density Data for Testing
run: |
cd ${{ github.workspace}}/example
cp ${{ github.workspace}}/.github/tools/generate_density_data.cpp .
g++ -o generate_density_data generate_density_data.cpp
./generate_density_data
- name: Test Run and DataIO Test - example - Serial
run: |
cd ${{ github.workspace}}/example
make clean
make OPTIONS=-DSERIAL_MODE LIBYT_PATH="${{ env.LIBYT_SERIAL_INSTALL_PATH }}"
./example DataIOTest.py
- name: Test Run and DataIO Test - example - Parallel (MPI 3)
run: |
cd ${{ github.workspace}}/example
make clean
make LIBYT_PATH="${{ env.LIBYT_PARALLEL_INSTALL_PATH }}"
OMPI_MCA_osc=sm,pt2pt mpirun -np 3 ./example DataIOTest.py