Skip to content
Open
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
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pyop2-clean = "pyop2.compilation:clear_compiler_disk_cache"

[project.optional-dependencies]
check = [
"mpi-pytest>=2025.7",
"mpi-pytest @ git+https://github.com/firedrakeproject/mpi-pytest.git@main",
"pytest",
]
docs = [
Expand Down Expand Up @@ -111,7 +111,7 @@ ci = [
"ipympl", # needed for notebook testing
"jax",
"matplotlib",
"mpi-pytest>=2025.7",
"mpi-pytest @ git+https://github.com/firedrakeproject/mpi-pytest.git@main",
"nbval",
"networkx",
# TODO RELEASE
Expand All @@ -132,7 +132,7 @@ ci = [
docker = [ # Used in firedrake-vanilla container
"ipympl", # needed for notebook testing
"matplotlib",
"mpi-pytest>=2025.7",
"mpi-pytest @ git+https://github.com/firedrakeproject/mpi-pytest.git@main",
"nbval",
"networkx",
"pdf2image",
Expand Down
64 changes: 36 additions & 28 deletions scripts/firedrake-run-split-tests
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
#!/usr/bin/env bash

# Script for running a pytest test suite in parallel across multiple jobs.
#
# Only the tests that use the given number of processors are selected from the suite. This list of tests is distributed between multiple jobs and each job outputs its own log file.
#
# Usage:
#
# firedrake-run-split-tests <nprocs> <njobs> <pytest_args...>
#
# where:
# * <nprocs> is the number of ranks used in each test
# * <njobs> is the number of different jobs
# * <pytest_args...> are additional arguments that are passed to pytest
#
# Example:
#
# firedrake-run-split-tests 3 4 tests/unit --verbose
#
# will run all of the parallel[3] tests inside tests/unit verbosely
# and split between 4 different jobs.
#
# Requires:
#
# * pytest
# * pytest-split
# * mpi-pytest
# * GNU parallel
HELP_MSG="\
Script for running a pytest test suite in parallel across multiple jobs.

Only the tests that use the given number of processors are selected from the suite. This list of tests is distributed between multiple jobs and each job outputs its own log file.

Usage:

firedrake-run-split-tests <nprocs> <njobs> <pytest_args...>

where:
* <nprocs> is the number of ranks used in each test
* <njobs> is the number of different jobs
* <pytest_args...> are additional arguments that are passed to pytest

Example:

firedrake-run-split-tests 3 4 tests/unit --verbose

will run all of the parallel[3] tests inside tests/unit verbosely
and split between 4 different jobs.

Run with [no arguments | -h | --help] to print this help message.

Requires:

* pytest
* pytest-split
* mpi-pytest
* GNU parallel"

# Print out help message with no arguments or "-h" or "--help"
if [[ "$#" -eq "0" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then
echo -e "${HELP_MSG}"
exit
fi

num_procs=$1
num_jobs=$2
Expand All @@ -38,10 +47,9 @@ if [ $num_procs = 1 ]; then
else
pytest_exec="mpiexec -n ${num_procs} python3 -m pytest"
fi
marker_spec="parallel[${num_procs}]"
pytest_cmd="${pytest_exec} -v \
--splits ${num_jobs} --group {#} \
-m ${marker_spec} ${extra_args}"
-m parallel[match] ${extra_args}"

log_file_prefix="pytest_nprocs${num_procs}_job"

Expand Down
Loading