Skip to content

Commit

Permalink
Merge pull request #2295 from devitocodes/data-init
Browse files Browse the repository at this point in the history
data: Prevent allocator info to be lost  at finalize
  • Loading branch information
mloubout authored Jan 13, 2024
2 parents d8ca72f + d57cd7b commit 8a28bc7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions devito/data/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def __array_finalize__(self, obj):
self._is_distributed = False
self._modulo = tuple(False for i in range(self.ndim))
self._decomposition = (None,)*self.ndim
self._allocator = ALLOC_ALIGNED
elif obj._index_stash is not None:
# From `__getitem__`
self._is_distributed = obj._is_distributed
Expand All @@ -125,9 +126,11 @@ def __array_finalize__(self, obj):
else:
decomposition.append(dec.reshape(i))
self._decomposition = tuple(decomposition)
self._allocator = obj._allocator
else:
self._is_distributed = obj._is_distributed
self._distributor = obj._distributor
self._allocator = obj._allocator
if self.ndim == obj.ndim:
# E.g., from a ufunc, such as `np.add`
self._modulo = obj._modulo
Expand Down

0 comments on commit 8a28bc7

Please sign in to comment.