Skip to content

Support Serial Mode using GCC Compiler #85

Support Serial Mode using GCC Compiler

Support Serial Mode using GCC Compiler #85

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: 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"
python-build-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
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
cd $GITHUB_WORKSPACE
cd ..
git clone https://github.com/data-exp-lab/yt_libyt.git
cd yt_libyt
pip install .
- 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 "MPI_PATH=/usr" >> $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 MPI_PATH="${{ env.MPI_PATH }}"
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 .
sed -i 's/inline_script/DataIOTest/' example.cpp
- 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
- 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 }}" MPI_PATH="${{ env.MPI_PATH }}"
OMPI_MCA_osc=sm,pt2pt mpirun -np 3 ./example