Skip to content

Complex API

Complex API #1623

# This workflow will install Python dependencies and run tests with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Run tests
on:
push:
branches: [ devel ]
pull_request:
branches: [ devel ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: 3.7
- os: ubuntu-latest
python-version: 3.8
- os: ubuntu-latest
python-version: 3.9
- os: ubuntu-latest
python-version: '3.10'
- os: macos-latest
python-version: 3.9
name: ${{ matrix.os }} / Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install non-Python dependencies on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install gfortran
sudo apt-get install openmpi-bin libopenmpi-dev
sudo apt-get install libhdf5-openmpi-dev
- name: Install non-Python dependencies on macOS
if: matrix.os == 'macos-latest'
run: |
brew install open-mpi
brew install hdf5-mpi
brew install libomp
if [[ ! -f "/usr/local/bin/gfortran" ]]; then
gfort=$(ls /usr/local/bin/gfortran-* | tail -n 1)
ln -s ${gfort} /usr/local/bin/gfortran
fi
echo "MPI_OPTS=--oversubscribe" >> $GITHUB_ENV
- name: Print information on MPI and HDF5 libraries
run: |
ompi_info
h5pcc -showconfig -echo || true
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
# - name: Get pip cache dir
# id: pip-cache-dir
# run: |
# echo "::set-output name=dir::$(python -m pip cache dir)"
#
# - name: pip cache
# uses: actions/cache@v2
# id: pip-cache
# with:
# path: ${{ steps.pip-cache-dir.outputs.dir }}
# key: ${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements.txt') }}
# restore-keys: |
# ${{ matrix.os }}-${{ matrix.python-version }}-pip-
- name: Determine directory of parallel HDF5 library
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
export HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/openmpi
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
export HDF5_DIR=$((h5pcc -showconfig -echo || true) | grep "Installation point:" | cut -d ":" -f2 | tr -d " ")
fi
echo $HDF5_DIR
- name: Install Python dependencies
run: |
export CC="mpicc" HDF5_MPI="ON"
python -m pip install -r requirements.txt
python -m pip install -r requirements_extra.txt --no-build-isolation
python -m pip list
# - name: Install Python dependencies
## if: steps.pip-cache.outputs.cache-hit != 'true'
# run: |
# export CC="mpicc"
# export HDF5_MPI="ON"
# if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
# export HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/openmpi
# elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
# export HDF5_DIR=$((h5pcc -showconfig -echo || true) | grep "Installation point:" | cut -d ":" -f2 | tr -d " ")
# fi
# python -m pip install -v Cython>=0.25 "numpy>=1.16,<1.22" pkgconfig mpi4py>=3.0.0
# python -m pip list
# python -m pip install --no-build-isolation -r requirements.txt
# python -m pip install --no-build-isolation -r requirements_extra.txt
# python -m pip list
- name: Check h5py installation
run: |
python3 -c "from h5py import File; print(File)"
- name: Install project
run: |
python -m pip install .
pyccel psydac/core/kernels.py --language fortran
pyccel psydac/core/bsplines_pyccel.py --language fortran
python -m pip freeze
- name: Initialize test directory
run: |
mkdir pytest
cp mpi_tester.py pytest
- name: Test with pytest
working-directory: ./pytest
run: |
export PSYDAC_MESH_DIR=$GITHUB_WORKSPACE/mesh
python -m pytest --pyargs psydac -m "not parallel"
python mpi_tester.py --pyargs psydac -m "parallel and not petsc"
- name: Remove test directory
if: ${{ always() }}
run: |
rm -rf pytest