Skip to content

Commit 10ab882

Browse files
Implement num_bytes
1 parent cb3b7aa commit 10ab882

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

pyop2/base.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3537,8 +3537,21 @@ def num_flops(self):
35373537

35383538
@cached_property
35393539
def num_bytes(self):
3540-
# Fake number serving as place holder
3541-
return 1e7
3540+
# Measuring Streaming data footprint
3541+
n_bytes = 0
3542+
for arg in self.args:
3543+
n_bytes += arg.data.nbytes
3544+
if arg.access is not READ:
3545+
# Writing access counts as 2 accesses
3546+
n_bytes += arg.data.nbytes
3547+
for map_ in arg.map_tuple:
3548+
if map_ is not None:
3549+
for m in map_:
3550+
n_bytes += m._values.nbytes
3551+
if self.iterset.size == 0:
3552+
return 0
3553+
else:
3554+
return n_bytes/self.iterset.size
35423555

35433556
def log_flops(self, flops):
35443557
pass

0 commit comments

Comments
 (0)