Skip to content

Commit 7c04af7

Browse files
committed
fix: include estimable irregular arrays in the memory budget
1 parent b8ca579 commit 7c04af7

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

‎devito/operator/operator.py‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -690,9 +690,7 @@ def _prepare_arguments(self, autotune=None, estimate_memory=False, **kwargs):
690690

691691
# An ArgumentsMap carries additional metadata that may be used by
692692
# the subsequent phases of the arguments processing
693-
args = kwargs['args'] = self._make_arguments_map(
694-
args, grid, discretizations, estimate_memory=estimate_memory
695-
)
693+
args = kwargs['args'] = ArgumentsMap(args, grid, self, discretizations)
696694

697695
if estimate_memory:
698696
# No need to do anything more if only checking the memory
@@ -756,9 +754,6 @@ def _prepare_arguments(self, autotune=None, estimate_memory=False, **kwargs):
756754

757755
return args
758756

759-
def _make_arguments_map(self, args, grid, discretizations, estimate_memory=False):
760-
return ArgumentsMap(args, grid, self, discretizations)
761-
762757
def _postprocess_errors(self, retval, comm=None):
763758
if retval == 0:
764759
return
@@ -1449,10 +1444,7 @@ def _get_nbytes(self, i):
14491444
# to nbytes, as it is typically zero
14501445
nbytes = obj.nbytes
14511446

1452-
return self._evaluate_nbytes(nbytes)
1453-
1454-
def _evaluate_nbytes(self, nbytes):
1455-
"""Resolve a symbolic allocation size against the bound arguments."""
1447+
# Could nominally have symbolic nbytes at this point
14561448
if isinstance(nbytes, sympy.Basic):
14571449
return subs_op_args(nbytes, self)
14581450

@@ -1593,7 +1585,7 @@ def nbytes_consumed_arrays(self):
15931585
nbytes = i.nbytes if i.is_regular else i.nbytes_max
15941586
except NotImplementedError:
15951587
continue
1596-
v = self._evaluate_nbytes(nbytes)
1588+
v = subs_op_args(nbytes, self) if isinstance(nbytes, sympy.Basic) else nbytes
15971589
if not is_integer(v):
15981590
# E.g. the Arrays used to store the MPI halo exchanges
15991591
continue

0 commit comments

Comments
 (0)