From 994366833fdf66c1a854a223bcededaa6103dd78 Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Wed, 13 May 2026 15:39:30 +0100 Subject: [PATCH 1/8] 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 ee8f86f4a7..16ddf89779 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 @@ -3289,8 +3290,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 5847a2749805338f5f91a416e71bc584410d909c Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Thu, 14 May 2026 13:24:22 +0100 Subject: [PATCH 2/8] 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 077f6c802ceb8f50c864beccd0cb36e42b17d4e8 Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Thu, 14 May 2026 15:52:40 +0100 Subject: [PATCH 3/8] 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 e39b789c613d2a4ddc87369cac80f9640aafa39e Mon Sep 17 00:00:00 2001 From: mloubout Date: Thu, 14 May 2026 09:17:08 -0400 Subject: [PATCH 4/8] 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 80d20335f8343ad617b12028d9ea30781f14fc7e Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Fri, 15 May 2026 12:43:46 +0100 Subject: [PATCH 5/8] 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 1742bdb496..dd3ebeb947 100644 --- a/tests/test_dle.py +++ b/tests/test_dle.py @@ -1057,6 +1057,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 d923bd84390a8e569e977d1607d1006dfad80406 Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Wed, 1 Jul 2026 19:50:20 +0100 Subject: [PATCH 6/8] 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 63311db3813bc9fb05d2af9588743fe144574433 Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Fri, 3 Jul 2026 13:46:16 +0100 Subject: [PATCH 7/8] 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) From 24582988da3ce7a15b12ee6ce6002e1f9f53015b Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Mon, 20 Jul 2026 16:36:30 +0100 Subject: [PATCH 8/8] misc: Change name of new parameter --- devito/__init__.py | 14 +++++++------- devito/arch/archinfo.py | 2 +- devito/parameters.py | 2 +- tests/test_data.py | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/devito/__init__.py b/devito/__init__.py index d401a436a3..753f85b730 100644 --- a/devito/__init__.py +++ b/devito/__init__.py @@ -112,13 +112,6 @@ def reinit_compiler(val): # optimisations. configuration.add('safe-math', 0, [0, 1], preprocessor=bool, callback=reinit_compiler) -# 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) - # Enable/disable automatic padding for allocated data def _preprocess_autopadding(v): @@ -135,6 +128,13 @@ def _preprocess_autopadding(v): [False, True, 0, 1, np.float16, np.float32, np.float64], preprocessor=_preprocess_autopadding) +# Use any GPU present on the node to set parameters such as the autopadding +# value. This can be disabled by setting this parameter to , but should not be +# toggled. By setting the value to 'cpu-only' 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('autopadding-mode', None, [None, 'cpu-only']) + # Select target device configuration.add('deviceid', -1, preprocessor=int, impacts_jit=False) diff --git a/devito/arch/archinfo.py b/devito/arch/archinfo.py index ff88994fce..cc546d89b4 100644 --- a/devito/arch/archinfo.py +++ b/devito/arch/archinfo.py @@ -1246,7 +1246,7 @@ def node_max_mem_trans_nbytes(platform): if isinstance(platform, Cpu64): gpu_info = get_gpu_info() - if not configuration['gpu'] or not gpu_info: + if configuration['autopadding-mode'] == 'cpu-only' 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 e9b022754d..ad9f841b82 100644 --- a/devito/parameters.py +++ b/devito/parameters.py @@ -141,11 +141,11 @@ def _signature_items(self): env_vars_mapper = { 'DEVITO_ARCH': 'compiler', + 'DEVITO_AUTOPADDING_MODE': 'autopadding-mode', 'DEVITO_AUTOTUNING': 'autotuning', 'DEVITO_DEVELOP': 'develop-mode', 'DEVITO_DEVICEID': 'deviceid', 'DEVITO_FIRST_TOUCH': 'first-touch', - 'DEVITO_GPU': 'gpu', 'DEVITO_IGNORE_UNKNOWN_PARAMS': 'ignore-unknowns', 'DEVITO_JIT_BACKDOOR': 'jit-backdoor', 'DEVITO_LANGUAGE': 'language', diff --git a/tests/test_data.py b/tests/test_data.py index 7a39dbf1fa..b37505b5e0 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -364,7 +364,7 @@ def test_w_halo_wo_padding(self): # 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') + @switchconfig(autopadding_mode='cpu-only', 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)