From 215ebb0410f23f653b819d94cbecff6cc7d483f6 Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Wed, 13 May 2026 15:39:30 +0100 Subject: [PATCH 1/7] tests: Fix test_mpi.py::TestOperatorAdvanced::test_interpolation_at_uforward[1] --- tests/test_mpi.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_mpi.py b/tests/test_mpi.py index a9b464aef0..ab47dce7e8 100644 --- a/tests/test_mpi.py +++ b/tests/test_mpi.py @@ -21,6 +21,7 @@ from devito.mpi.distributed import CustomTopology from devito.mpi.routines import ComputeCall, HaloUpdateCall, HaloUpdateList, MPICall from devito.tools import Bunch +from devito.types.dimension import ModuloDimension from examples.seismic.acoustic import acoustic_setup @@ -3249,8 +3250,9 @@ def test_interpolation_at_uforward(self, mode): calls, _ = check_halo_exchanges(op, 2, 1) args = calls[0].arguments - assert args[-2].name == 't2' - assert args[-2].origin == t + 1 + t2 = next(filter(lambda a: isinstance(a, ModuloDimension), args)) + assert t2.name == 't2' + assert t2.origin == t + 1 def gen_serial_norms(shape, so): From 9f3c56725c427ded2c71fa23e5dd2f7b83c34286 Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Thu, 14 May 2026 13:24:22 +0100 Subject: [PATCH 2/7] tests: Fix tests/test_autotuner.py (multiple) and update conftest.py --- conftest.py | 26 ++++++++++++++++++++------ tests/test_autotuner.py | 3 ++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/conftest.py b/conftest.py index b2d49697fb..f33942d528 100644 --- a/conftest.py +++ b/conftest.py @@ -8,9 +8,9 @@ from sympy.printing import sstr from devito import Eq, Revolver, configuration # noqa -from devito.arch import Arm, Cpu64, Device, get_advisor_path, sniff_mpi_distro +from devito.arch import Arm, Cpu64, Device, Power, get_advisor_path, sniff_mpi_distro from devito.arch.compiler import ( - IntelCompiler, NvidiaCompiler, OneapiCompiler, compiler_registry + GNUCompiler, IntelCompiler, NvidiaCompiler, OneapiCompiler, compiler_registry ) from devito.checkpointing import NoopRevolver from devito.finite_differences.differentiable import EvalDerivative @@ -35,10 +35,19 @@ def skipif(items, whole_module=False): items = as_tuple(items) # Sanity check accepted = set() - accepted.update({'device', 'device-C', 'device-openmp', 'device-openacc', - 'device-aomp', 'cpu64-icc', 'cpu64-icx', 'cpu64-nvc', - 'noadvisor', 'cpu64-arm', 'cpu64-icpx', 'chkpnt'}) - accepted.update({'nodevice', 'noomp'}) + accepted.update({ + # GPU (device-language) + 'device', 'device-C', 'device-openmp', 'device-openacc', 'device-aomp', + # CPU (cpu64-instruction set) + 'cpu64-icc', 'cpu64-icx', 'cpu64-nvc', 'cpu64-icpx', + # CPU (cpu64-architecture) + 'cpu64-arm', + # CPU (cpu64-architecture-compiler) + 'cpu64-power-gcc', + # Miscellaneous + 'chkpnt' + }) + accepted.update({'noadvisor', 'nodevice', 'noomp'}) unknown = sorted(set(items) - accepted) if unknown: raise ValueError(f"Illegal skipif argument(s) `{unknown}`") @@ -97,6 +106,11 @@ def skipif(items, whole_module=False): if i == 'cpu64-arm' and isinstance(configuration['platform'], Arm): skipit = "Arm doesn't support x86-specific instructions" break + if i == 'cpu64-power-gcc' and \ + isinstance(configuration['platform'], Power) and \ + isinstance(configuration['compiler'], GNUCompiler): + skipit = "GCC cannot compile these POWER instructions" + break # Skip if pyrevolve not installed if i == 'chkpnt' and Revolver is NoopRevolver: skipit = "pyrevolve not installed" diff --git a/tests/test_autotuner.py b/tests/test_autotuner.py index 86a215e41f..32d4d82562 100644 --- a/tests/test_autotuner.py +++ b/tests/test_autotuner.py @@ -290,6 +290,7 @@ def test_hierarchical_blocking(opt_options): assert len(op._state['autotuning'][1]['tuned']) == 4 +@skipif('cpu64-power-gcc') @switchconfig(platform='cpu64-dummy', develop_mode=True) # `cpu64-dummy `to fix ncores @pytest.mark.parametrize('opt_options', [{'skewing': False}, {'skewing': True}]) def test_multiple_threads(opt_options): @@ -309,7 +310,7 @@ def test_multiple_threads(opt_options): assert len(op._state['autotuning'][0]['tuned']) == 3 -@skipif('cpu64-arm') +@skipif(['cpu64-arm', 'cpu64-power-gcc']) @switchconfig(platform='knl7210', develop_mode=True) # `knl7210` for nested parallelsim def test_nested_nthreads(): grid = Grid(shape=(96, 96, 96)) From 4dffd60924d4a644b7c766c75324534aeab9c5d9 Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Thu, 14 May 2026 15:52:40 +0100 Subject: [PATCH 3/7] tests: Fix TestMetaData::test_w_halo_w_autopadding and add a new environment variable for GPU --- devito/__init__.py | 4 ++++ devito/arch/archinfo.py | 3 ++- devito/parameters.py | 21 +++++++++++---------- tests/test_data.py | 4 +++- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/devito/__init__.py b/devito/__init__.py index bb310e9733..7dee0aea91 100644 --- a/devito/__init__.py +++ b/devito/__init__.py @@ -112,6 +112,10 @@ def reinit_compiler(val): # optimisations. configuration.add('safe-math', 0, [0, 1], preprocessor=bool, callback=reinit_compiler) +# Use any GPU present for parameters such as the padding by default. This can be +# disabled by setting this parameter to `0`, but should not be toggled. +configuration.add('gpu', 1, [0, 1], preprocessor=bool) + # Enable/disable automatic padding for allocated data def _preprocess_autopadding(v): diff --git a/devito/arch/archinfo.py b/devito/arch/archinfo.py index 0eb1bed0fa..ff88994fce 100644 --- a/devito/arch/archinfo.py +++ b/devito/arch/archinfo.py @@ -15,6 +15,7 @@ import psutil from packaging.version import InvalidVersion, parse +from devito import configuration from devito.logger import warning from devito.tools import all_equal, as_tuple, memoized_func @@ -1245,7 +1246,7 @@ def node_max_mem_trans_nbytes(platform): if isinstance(platform, Cpu64): gpu_info = get_gpu_info() - if not gpu_info: + if not configuration['gpu'] or not gpu_info: # This node may simply not have a GPU return mmtb0 diff --git a/devito/parameters.py b/devito/parameters.py index 7fb957ce39..e9b022754d 100644 --- a/devito/parameters.py +++ b/devito/parameters.py @@ -141,20 +141,21 @@ def _signature_items(self): env_vars_mapper = { 'DEVITO_ARCH': 'compiler', - 'DEVITO_PLATFORM': 'platform', - 'DEVITO_PROFILING': 'profiling', + 'DEVITO_AUTOTUNING': 'autotuning', 'DEVITO_DEVELOP': 'develop-mode', - 'DEVITO_OPT': 'opt', - 'DEVITO_MPI': 'mpi', - 'DEVITO_TOPOLOGY': 'topology', 'DEVITO_DEVICEID': 'deviceid', - 'DEVITO_LANGUAGE': 'language', - 'DEVITO_AUTOTUNING': 'autotuning', - 'DEVITO_LOGGING': 'log-level', 'DEVITO_FIRST_TOUCH': 'first-touch', - 'DEVITO_JIT_BACKDOOR': 'jit-backdoor', + 'DEVITO_GPU': 'gpu', 'DEVITO_IGNORE_UNKNOWN_PARAMS': 'ignore-unknowns', - 'DEVITO_SAFE_MATH': 'safe-math' + 'DEVITO_JIT_BACKDOOR': 'jit-backdoor', + 'DEVITO_LANGUAGE': 'language', + 'DEVITO_LOGGING': 'log-level', + 'DEVITO_MPI': 'mpi', + 'DEVITO_OPT': 'opt', + 'DEVITO_PLATFORM': 'platform', + 'DEVITO_PROFILING': 'profiling', + 'DEVITO_SAFE_MATH': 'safe-math', + 'DEVITO_TOPOLOGY': 'topology', } env_vars_deprecated = { diff --git a/tests/test_data.py b/tests/test_data.py index 64e7e8052a..7a39dbf1fa 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -362,7 +362,9 @@ def test_w_halo_wo_padding(self): ) == u2.shape_with_halo assert u2.shape_with_halo == (11, 11, 11) - @switchconfig(autopadding=True, platform='bdw') + # Platform is used to fix the pad value + # GPU is disabled to prevent GPU pad value from being used + @switchconfig(gpu=0, autopadding=True, platform='bdw') def test_w_halo_w_autopadding(self): grid = Grid(shape=(4, 4, 4)) u0 = Function(name='u0', grid=grid, space_order=0) From 1569f5260b10a8d75fe56c1a273afeef123b3aa5 Mon Sep 17 00:00:00 2001 From: mloubout Date: Thu, 14 May 2026 09:17:08 -0400 Subject: [PATCH 4/7] compiler: fix missing parallel omp flag for nested --- devito/passes/iet/parpragma.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devito/passes/iet/parpragma.py b/devito/passes/iet/parpragma.py index 9c4312d023..9e0d218a15 100644 --- a/devito/passes/iet/parpragma.py +++ b/devito/passes/iet/parpragma.py @@ -294,7 +294,7 @@ def _make_partree(self, candidates, nthreads=None): prefix = [] elif nthreads is not None: body = self.HostIteration(schedule='static', - parallel=nthreads is not self.nthreads_nested, + parallel=nthreads is not self.nthreads, ncollapsed=ncollapsed, nthreads=nthreads, **root.args) prefix = [] From 4d4b2dc39c5af9bf320dee98a92d81c675338521 Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Fri, 15 May 2026 12:43:46 +0100 Subject: [PATCH 5/7] tests: Skip test_dle.py::TestNodeParallelism::test_incr_perfect_sparse_outer on POWER architecture --- tests/test_dle.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_dle.py b/tests/test_dle.py index e3edbcad46..7442c127b0 100644 --- a/tests/test_dle.py +++ b/tests/test_dle.py @@ -1026,6 +1026,7 @@ def test_incr_perfect_outer(self): op() assert np.all(w.data == 10) + @skipif('cpu64-power-gcc') def test_incr_perfect_sparse_outer(self): grid = Grid(shape=(3, 3, 3)) From 35c26718fe45648e43df62a81a5757a0a7f5e854 Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Wed, 1 Jul 2026 19:50:20 +0100 Subject: [PATCH 6/7] mpi: Check for COMM_NULL when logging --- devito/logger.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/devito/logger.py b/devito/logger.py index 1efa6f1b9b..bc49f6d96a 100644 --- a/devito/logger.py +++ b/devito/logger.py @@ -93,7 +93,8 @@ def set_log_level(level, comm=None): from devito import configuration if comm is not None and configuration['mpi']: - if comm.rank != 0: + from devito.mpi.distributed import MPI + if comm is not MPI.COMM_NULL and comm.rank != 0: logger.removeHandler(stream_handler) logger.addHandler(logging.NullHandler()) else: From 3fcad9aa7bd77e936466717fab7fae4c133e41bb Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Fri, 3 Jul 2026 13:46:16 +0100 Subject: [PATCH 7/7] misc: Update comment --- devito/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/devito/__init__.py b/devito/__init__.py index 7dee0aea91..d401a436a3 100644 --- a/devito/__init__.py +++ b/devito/__init__.py @@ -112,8 +112,11 @@ def reinit_compiler(val): # optimisations. configuration.add('safe-math', 0, [0, 1], preprocessor=bool, callback=reinit_compiler) -# Use any GPU present for parameters such as the padding by default. This can be -# disabled by setting this parameter to `0`, but should not be toggled. +# Use any GPU present on the node to set parameters such as the autopadding value. +# This can be disabled by setting this parameter to `0`, but should not be toggled. +# By setting the value to zero the user is promising that they will not try to use +# the GPU at any point during the running of their script, this is useful when +# iGPUs, APUs or disabled GPUs are present on a node. configuration.add('gpu', 1, [0, 1], preprocessor=bool)