Skip to content

Commit f00ec9c

Browse files
committed
tests: Fix tests with CXX backends
1 parent 3fce82b commit f00ec9c

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

devito/operator/operator.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,8 @@ def estimate_memory(self, human_readable=True, **kwargs):
896896
fhost = str(humanbytes(mem[host_layer])).center(10)
897897
fdevice = str(humanbytes(mem[device_layer])).center(10)
898898

899+
# TODO: There is nominally a table generator in pytools which is a dependency
900+
# of a dependency and thus in the env anyway
899901
info(
900902
"\n"
901903
f"{headline}\n"
@@ -1410,28 +1412,29 @@ def get_nbytes(obj):
14101412

14111413
# Filter out arrays, aliases and non-AbstractFunction objects
14121414
op_symbols = [i for i in op_symbols if i.is_AbstractFunction
1413-
and not i.is_Array and not i.alias]
1415+
and not i.is_ArrayBasic and not i.alias]
14141416

14151417
for i in op_symbols:
14161418
# FIXME: Probably wrong for streamed functions
1419+
# TODO: Need a hook for PRO here
14171420
# Will overreport memory usage currently
14181421
try:
14191422
# TODO: is _obj even needed?
14201423
v = get_nbytes(self[i.name]._obj)
14211424
except AttributeError:
14221425
v = get_nbytes(self.get(i.name, i))
14231426

1424-
if i._mem_host:
1427+
print(i, humanbytes(v))
1428+
1429+
if i._mem_host or i._mem_mapped:
1430+
# No need to add to device , as it will be counted
1431+
# by nbytes_consumed_memmapped
14251432
host += v
14261433
elif i._mem_local:
14271434
if isinstance(self.platform, Device):
14281435
device += v
14291436
else:
14301437
host += v
1431-
elif i._mem_mapped:
1432-
# No need to add to device, as it will be counted
1433-
# by nbytes_consumed_memmapped
1434-
host += v
14351438

14361439
return {disk_layer: 0, host_layer: host, device_layer: device}
14371440

@@ -1459,6 +1462,8 @@ def nbytes_consumed_array(self):
14591462
# E.g. the Arrays used to store the MPI halo exchanges
14601463
continue
14611464

1465+
print(i, humanbytes(v))
1466+
14621467
if i._mem_host:
14631468
host += v
14641469
elif i._mem_local:

tests/test_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2066,7 +2066,7 @@ def test_indirection(self):
20662066
class TestEstimateMemory:
20672067
"""Tests for the Operator.estimate_memory() utility"""
20682068

2069-
_array_temp = "r0[x][y]"
2069+
_array_temp = "r0L0(x, y)" if "CXX" in configuration['language'] else "r0[x][y]"
20702070

20712071
def parse_output(self, output, expected):
20722072
"""Parse estimate_memory machine-readable output"""

0 commit comments

Comments
 (0)