Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions .github/actions/install/psydac-req/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
name: Install prerequisites

runs:
using: composite
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
pyproject.toml
requirements.txt

- name: Install non-Python dependencies on Ubuntu
if: matrix.os == 'ubuntu-latest'
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: gfortran openmpi-bin libopenmpi-dev libhdf5-openmpi-dev g++ liblapack3 cmake cmake-curses-gui zlib1g-dev libnetcdf-dev libnetcdff-dev
version: 1.0
execute_install_scripts: true

# When loading cached apt packages, the default MPI compiler isn't set.
# Workaround is to 'reinstall' openmpi-bin, which doesn't actually perform
# installation (since openmpi-bin already exists), but instead reruns
# `update-alternatives` which fixes the symlinks to mpicc/mpif90.
- name: Reconfigure non-Python dependencies on Ubuntu
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
sudo apt-get update
sudo apt-get install --reinstall openmpi-bin libhdf5-openmpi-dev liblapack-dev libblas-dev

- name: Install non-Python dependencies on macOS
if: matrix.os == 'macos-14'
shell: bash
run: |
brew install make
brew install open-mpi
brew install hdf5-mpi
brew install libomp
brew update
brew install python3
brew install gcc
brew install openblas
brew install lapack
brew install git
brew install pandoc
brew install cmake
brew install netcdf-fortran
brew install pkgconf
GFORTRAN_HOME=$(which gfortran || true)
echo "GFORTRAN_HOME : $GFORTRAN_HOME"
if [[ ! -f "$GFORTRAN_HOME" ]]; then
gfort=$(find ${PATH//:/\/ } -name 'gfortran-*' -exec basename {} \; | sort | tail -n 1 || true)
echo "Found $gfort"
gfort_path=$(which ${gfort})
folder=$(dirname ${gfort_path})
ln -s ${gfort_path} ${folder}/gfortran
fi
echo "MPI_OPTS=--oversubscribe" >> $GITHUB_ENV
echo "/opt/homebrew/opt/make/libexec/gnubin" >> $GITHUB_PATH

- name: Print information on MPI and HDF5 libraries
shell: bash
run: |
ompi_info
h5pcc -showconfig -echo || true

- name: Upgrade pip
shell: bash
run: |
python -m pip install --upgrade pip

- name: Determine directory of parallel HDF5 library
shell: bash
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
HDF5_DIR=$(dpkg -L libhdf5-openmpi-dev | grep libhdf5.so | xargs dirname)
elif [[ "${{ matrix.os }}" == "macos-14" ]]; then
HDF5_DIR=$(brew list hdf5-mpi | grep "libhdf5.dylib" | xargs dirname | xargs dirname)
fi
echo $HDF5_DIR
echo "HDF5_DIR=$HDF5_DIR" >> $GITHUB_ENV

- name: Cache PETSc
uses: actions/cache@v4
id: cache-petsc
env:
cache-name: cache-PETSc
with:
path: "./petsc"
key: petsc-${{ matrix.os }}-${{ matrix.python-version }}

- if: steps.cache-petsc.outputs.cache-hit != 'true'
name: Download a specific release of PETSc
shell: bash
run: |
git clone --depth 1 --branch v3.23.3 https://gitlab.com/petsc/petsc.git

- if: steps.cache-petsc.outputs.cache-hit != 'true'
name: Install PETSc with complex support
working-directory: ./petsc
shell: bash
run: |
export PETSC_DIR=$(pwd)
export PETSC_ARCH=petsc-cmplx
./configure --with-scalar-type=complex --with-fortran-bindings=0 --have-numpy=1 --download-fblaslapack=1
make all
echo "PETSC_DIR=$PETSC_DIR" > petsc.env
echo "PETSC_ARCH=$PETSC_ARCH" >> petsc.env

# This step is not really necessary and could be combined with PETSc install
# step; however it's good to verify if the cached PETSc installation really works!
- name: Test PETSc installation
working-directory: ./petsc
shell: bash
run: |
source petsc.env
make check
echo "PETSC_DIR=$PETSC_DIR" >> $GITHUB_ENV
echo "PETSC_ARCH=$PETSC_ARCH" >> $GITHUB_ENV

- name: Install petsc4py
working-directory: ./petsc
shell: bash
run: |
python -m pip install wheel Cython numpy
python -m pip install src/binding/petsc4py

# - name: Check parallel h5py installation
# run: |
# python -c "
# from mpi4py import MPI
# import h5py
# # This particular instantiation of h5py.File will fail if parallel h5py isn't installed
# f = h5py.File('parallel_test.hdf5', 'w', driver='mpio', comm=MPI.COMM_WORLD)
# print(f)"
67 changes: 67 additions & 0 deletions .github/workflows/compile-with-pyccel-devel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Compile psydac w. pyccel devel

on:
pull_request:
branches: [devel-tiny]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
compile-with-pyccel-devel:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
# TODO: Make sure that struphy works with python > 3.11, keep the lower bound to 3.10
python-version: [ '3.10', '3.12', '3.13' ]
compile_language: ['c', 'fortran']
isMerge:
- ${{ github.event_name == 'push' && github.ref == 'refs/heads/devel' }}
# exclude:
# - { isMerge: false, python-version: '3.10' }
# - { isMerge: false, python-version: '3.11' }
# include:
# - os: macos-14
# python-version: '3.10'
# - os: macos-14
# python-version: '3.13'

name: Compile psydac w. pyccel devel on ${{ matrix.os }} / Python ${{ matrix.python-version }} / ${{ matrix.compile_language }}

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install prerequisites
uses: ./.github/actions/install/psydac-req

- name: Install project
run: |
python -m pip install ".[test]" --no-cache-dir
python -m pip freeze

- name: Set up environment variables
run: |
echo "PSYDAC_DIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "PYCCEL_DIR=$GITHUB_WORKSPACE/pyccel" >> $GITHUB_ENV

- name: Clone pyccel from Github (devel branch)
run: |
git clone --recurse-submodules https://github.com/pyccel/pyccel.git $PYCCEL_DIR

- name: Install pyccel
working-directory: ${{ env.PYCCEL_DIR }}
run: |
echo "Pyccel location for this branch"
pip show pyccel
pip uninstall pyccel -y
python -m pip install ".[test]" --no-cache-dir
echo "Pyccel location after reinstalling"
pip show pyccel

- name: Compile psydac kernels
run: |
psydac-accelerate --language ${{ matrix.compile_language }}
65 changes: 0 additions & 65 deletions .github/workflows/documentation.yml.disabled

This file was deleted.

99 changes: 99 additions & 0 deletions .github/workflows/test-psydac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Test psydac

on:
pull_request:
branches: [devel-tiny]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test_psydac:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
# TODO: Make sure that struphy works with python > 3.11, keep the lower bound to 3.10
python-version: [ '3.10', '3.12', '3.13' ]
compile_language: ['c', 'fortran']
isMerge:
- ${{ github.event_name == 'push' && github.ref == 'refs/heads/devel' }}
# exclude:
# - { isMerge: false, python-version: '3.10' }
# - { isMerge: false, python-version: '3.11' }
# include:
# - os: macos-14
# python-version: '3.10'
# - os: macos-14
# python-version: '3.13'

name: Test Psydac on ${{ matrix.os }} / Python ${{ matrix.python-version }} / ${{ matrix.compile_language }}

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install prerequisites
uses: ./.github/actions/install/psydac-req

- name: Install project without mpi
run: |
python -m pip install ".[test]" --no-cache-dir
python -m pip freeze

- name: Compile psydac kernels
run: |
psydac-accelerate --language ${{ matrix.compile_language }}

# - name: Test Pyccel optimization flags
# run: |
# pytest --pyargs psydac -m pyccel --capture=no

- name: Initialize test directory
run: |
mkdir pytest
cp mpi_tester.py pytest

- name: Run coverage tests on macOS
if: matrix.os == 'macos-14'
working-directory: ./pytest
run: >-
python -m pytest -n auto
--cov psydac
--cov-config $GITHUB_WORKSPACE/pyproject.toml
--cov-report xml
--pyargs psydac -m "not parallel and not petsc"

- name: Run single-process tests with Pytest on Ubuntu
if: matrix.os == 'ubuntu-latest'
working-directory: ./pytest
run: |
python -m pytest -n auto --pyargs psydac -m "not parallel and not petsc"

- name: Run single-process PETSc tests with Pytest
working-directory: ./pytest
run: |
python -m pytest -n auto --pyargs psydac -m "not parallel and petsc"

- name: Install project with mpi
run: |
python -m pip install ".[mpi]"
python -m pip freeze

- name: Run MPI tests with Pytest
working-directory: ./pytest
run: |
python mpi_tester.py --mpirun="mpiexec -n 4 ${MPI_OPTS}" --pyargs psydac -m "parallel and not petsc"

- name: Run MPI PETSc tests with Pytest
working-directory: ./pytest
run: |
python mpi_tester.py --mpirun="mpiexec -n 4 ${MPI_OPTS}" --pyargs psydac -m "parallel and petsc"

- name: Remove test directory
if: always()
run: |
rm -rf pytest

Loading