Skip to content

Commit

Permalink
compiler: Generate deterministic code for overlap mode
Browse files Browse the repository at this point in the history
compiler: Switch to filter_sorted
  • Loading branch information
georgebisbas committed Feb 13, 2024
1 parent bb7491d commit 4b3df2e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions devito/mpi/halo_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions devito/passes/iet/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down

0 comments on commit 4b3df2e

Please sign in to comment.