From 4b3df2e64450a34da2809ac09afb7bc929b5b1e5 Mon Sep 17 00:00:00 2001 From: George Bisbas Date: Tue, 6 Feb 2024 17:10:38 +0000 Subject: [PATCH] compiler: Generate deterministic code for overlap mode compiler: Switch to filter_sorted --- devito/mpi/halo_scheme.py | 6 ++++-- devito/passes/iet/misc.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/devito/mpi/halo_scheme.py b/devito/mpi/halo_scheme.py index 549995f3e9f..0952e91904f 100644 --- a/devito/mpi/halo_scheme.py +++ b/devito/mpi/halo_scheme.py @@ -11,7 +11,7 @@ from devito.ir.support import Forward, Scope from devito.symbolics.manipulation import _uxreplace_registry from devito.tools import (Reconstructable, Tag, as_tuple, filter_ordered, flatten, - frozendict, is_integer) + frozendict, is_integer, filter_sorted) from devito.types import Grid __all__ = ['HaloScheme', 'HaloSchemeEntry', 'HaloSchemeException', 'HaloTouch'] @@ -287,7 +287,9 @@ def omapper(self): ranks*, so the output of this method is guaranteed to be consistent across *all MPI ranks*. """ - items = [((d, CENTER), (d, LEFT), (d, RIGHT)) for d in self.dimensions] + + items = [((d, CENTER), (d, LEFT), (d, RIGHT)) + for d in filter_sorted(self.dimensions)] processed = [] for item in product(*items): diff --git a/devito/passes/iet/misc.py b/devito/passes/iet/misc.py index e4db2c41c91..e2ecce110fb 100644 --- a/devito/passes/iet/misc.py +++ b/devito/passes/iet/misc.py @@ -138,6 +138,8 @@ def relax_incr_dimensions(iet, options=None, **kwargs): def generate_macros(iet): applications = FindApplications().visit(iet) headers = set().union(*[_generate_macros(i) for i in applications]) + # Sort for deterministic code generation + headers = sorted(headers) return iet, {'headers': headers}