From 2c7deff39e3987a1da7159a7386bd58ba12d6fb3 Mon Sep 17 00:00:00 2001 From: mloubout Date: Sun, 14 Apr 2024 11:07:27 -0400 Subject: [PATCH] ci: tweak mpi setup to allow -s and hide output --- conftest.py | 19 ++++++++++++++----- tests/test_linearize.py | 1 - 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/conftest.py b/conftest.py index bc2526c3d7c..2fa38f94087 100644 --- a/conftest.py +++ b/conftest.py @@ -5,7 +5,7 @@ import pytest from sympy import Add -from devito import Eq, configuration, Revolver # noqa +from devito import Eq, configuration, Revolver, switchconfig # noqa from devito.checkpointing import NoopRevolver from devito.finite_differences.differentiable import EvalDerivative from devito.arch import Cpu64, Device, sniff_mpi_distro, Arm @@ -141,17 +141,26 @@ def parallel(item, m): else: raise ValueError("Can't run test: unexpected mode `%s`" % m) + # Don't waste time with subprocess for single rank + if nprocs == 1: + with switchconfig(mpi=scheme): + try: + item.runtest() + return True + except: + return False + pyversion = sys.executable + pyarg = item.config.invocation_params.args[0] # Only spew tracebacks on rank 0. # Run xfailing tests to ensure that errors are reported to calling process if item.cls is not None: testname = "%s::%s::%s" % (item.fspath, item.cls.__name__, item.name) else: testname = "%s::%s" % (item.fspath, item.name) - args = ["-n", "1", pyversion, "-m", "pytest", "--runxfail", "-q", testname] - if nprocs > 1: - args.extend([":", "-n", "%d" % (nprocs - 1), pyversion, "-m", "pytest", - "--runxfail", "--tb=no", "-q", testname]) + + args = ["-n", nprocs, pyversion, "-m", "pytest", "--no-summary", pyarg, "--no-cov", + "--runxfail", "-qq", testname] # OpenMPI requires an explicit flag for oversubscription. We need it as some # of the MPI tests will spawn lots of processes if mpi_distro == 'OpenMPI': diff --git a/tests/test_linearize.py b/tests/test_linearize.py index b236170e9df..cd4227a1894 100644 --- a/tests/test_linearize.py +++ b/tests/test_linearize.py @@ -170,7 +170,6 @@ def test_codegen_quality0(mode): # for the efunc args # (the other three obviously are _POSIX_C_SOURCE, START, STOP) assert len(op._headers) == 6 - return "bonjour" def test_codegen_quality1():