Update and Fix Timer #82
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: Set PYTHON_PATH, NUMPY_PATH, MPI_PATH, LIBYT_INSTALL_PATH | |
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_INSTALL_PATH=$GITHUB_WORKSPACE/libyt_test" >> $GITHUB_ENV | |
# setup-python has python3.7m only, idk why. | |
# So split building libyt into two. | |
- name: Build libyt | |
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_MPI_PATH)@"${{ env.MPI_PATH }}"@' Makefile | |
sed -i 's@$(YOUR_PYTHON_VERSION)@"${{ matrix.python-version }}m"@' Makefile | |
sed -i 's@$(YOUR_INSTALL_PREFIX)@"${{ env.LIBYT_INSTALL_PATH }}"@' Makefile | |
make clean | |
make | |
make install | |
- name: Build libyt | |
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_MPI_PATH)@"${{ env.MPI_PATH }}"@' Makefile | |
sed -i 's@$(YOUR_PYTHON_VERSION)@"${{ matrix.python-version }}"@' Makefile | |
sed -i 's@$(YOUR_INSTALL_PREFIX)@"${{ env.LIBYT_INSTALL_PATH }}"@' Makefile | |
make clean | |
make | |
make install | |
- name: Prepare Test | |
run: | | |
cd $GITHUB_WORKSPACE/example | |
cp $GITHUB_WORKSPACE/.github/tests/test-DataIO/DataIOTest.py . | |
sed -i 's@$(YOUR_MPI_PATH)@"${{ env.MPI_PATH }}"@' Makefile | |
sed -i 's@$(YOUR_LIBYT_PATH)@"${{ env.LIBYT_INSTALL_PATH }}"@' Makefile | |
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 - MPI 1 | |
run: | | |
cd $GITHUB_WORKSPACE/example | |
make clean | |
make | |
mpirun -np 1 ./example | |
- name: Test Run and DataIO Test - example - MPI 3 | |
run: | | |
cd $GITHUB_WORKSPACE/example | |
make clean | |
make | |
OMPI_MCA_osc=sm,pt2pt mpirun -np 3 ./example |