Skip to content

Commit 2cda656

Browse files
committed
mpi: Fixup deterministic MPI code generation
1 parent cfd4d78 commit 2cda656

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

devito/mpi/halo_scheme.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,14 @@ class HaloSchemeEntry(EnrichedTuple):
3131

3232
__rargs__ = ('loc_indices', 'loc_dirs', 'halos', 'dims')
3333

34-
def __init__(self, loc_indices, loc_dirs, halos, dims, getters=None):
35-
self.loc_indices = frozendict(loc_indices)
36-
self.loc_dirs = frozendict(loc_dirs)
37-
self.halos = frozenset(halos)
38-
self.dims = frozenset(dims)
34+
def __new__(cls, loc_indices, loc_dirs, halos, dims, getters=None):
35+
items = [frozendict(loc_indices), frozendict(loc_dirs),
36+
frozenset(halos), frozenset(dims)]
37+
kwargs = dict(zip(cls.__rargs__, items))
38+
return super().__new__(cls, *items, getters=cls.__rargs__, **kwargs)
3939

4040
def __hash__(self):
41-
return hash((self.loc_indices,
42-
self.loc_dirs,
43-
self.halos,
44-
self.dims))
41+
return hash((self.loc_indices, self.loc_dirs, self.halos, self.dims))
4542

4643
def union(self, other):
4744
"""

0 commit comments

Comments
 (0)