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
52 changes: 33 additions & 19 deletions .github/workflows/ngsPETSc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,48 @@ jobs:
timeout-minutes: 30

steps:
- name: Check out repository code
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
# Download ngsPETSc into a subdirectory not called 'ngsPETSc' to make sure
# that the package installs correctly. Otherwise 'import ngsPETSc' may
# work even if the installation failed because it is a subdirectory.
path: ngspetsc-repo

- name: Create virtual environment
# pass '--system-site-packages' so ngsolve can be found
run: python3 -m venv --system-site-packages venv-ngspetsc

- name: Install ngsPETSc
run: |
python -m pip install .
. venv-ngspetsc/bin/activate
pip install --no-deps './ngspetsc-repo'
pip list

- name: Run test suite in serial
run: |
pytest -v tests/test_env.py
pytest -v tests/test_vec.py
pytest -v tests/test_mat.py
pytest -v tests/test_plex.py
pytest -v tests/test_ksp.py
pytest -v tests/test_pc.py
pytest -v tests/test_eps.py
pytest -v tests/test_snes.py
. venv-ngspetsc/bin/activate
cd ngspetsc-repo
python -m pytest -v tests/test_env.py
python -m pytest -v tests/test_vec.py
python -m pytest -v tests/test_mat.py
python -m pytest -v tests/test_plex.py
python -m pytest -v tests/test_ksp.py
python -m pytest -v tests/test_pc.py
python -m pytest -v tests/test_eps.py
python -m pytest -v tests/test_snes.py

- name: Run test suite in parallel
run: |
mpirun --allow-run-as-root -n 2 pytest -v --with-mpi tests/test_env.py
mpirun --allow-run-as-root -n 2 pytest -v --with-mpi tests/test_vec.py
mpirun --allow-run-as-root -n 2 pytest -v --with-mpi tests/test_mat.py
mpirun --allow-run-as-root -n 2 pytest -v --with-mpi tests/test_plex.py
mpirun --allow-run-as-root -n 2 pytest -v --with-mpi tests/test_ksp.py
mpirun --allow-run-as-root -n 2 pytest -v --with-mpi tests/test_pc.py
mpirun --allow-run-as-root -n 2 pytest -v --with-mpi tests/test_eps.py
mpirun --allow-run-as-root -n 2 pytest -v --with-mpi tests/test_snes.py
. venv-ngspetsc/bin/activate
cd ngspetsc-repo
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_env.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_vec.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_mat.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_plex.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_ksp.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_pc.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_eps.py
mpirun --allow-run-as-root -n 2 python -m pytest -v --with-mpi tests/test_snes.py

firedrake:
runs-on: ubuntu-latest
Expand Down
22 changes: 15 additions & 7 deletions tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,37 @@
In particular it will test for: petsc4py, PETSc, NGSolve and Netgen
'''

import petsc4py
from petsc4py import PETSc

import ngsolve as ngs
from netgen.geom2d import unit_square
from ngsolve import x,y

def test_petsc4py():
'''
Testing that petsc4py can be imported correctly
'''
import petsc4py
assert petsc4py.get_config() != ""


def test_petsc():
'''
Testing that PETSc can be imported correctly
'''
from petsc4py import PETSc
assert PETSc.DECIDE == -1


def test_netgen():
'''
Testing that NGSolve can be imported correctly
'''
from netgen.geom2d import unit_square
unit_square.GenerateMesh(maxh=0.1)


def test_ngs():
'''
Testing that NGSolve can be imported correctly
'''
from netgen.geom2d import unit_square
import ngsolve as ngs
from ngsolve import x,y
mesh = ngs.Mesh(unit_square.GenerateMesh(maxh=0.1))
coefficientFunction = x*(1-y)
mip = mesh(0.2, 0.2)
Expand Down
Loading