Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
Implement num_bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewWhitmell committed Jul 21, 2021
1 parent cb3b7aa commit 10ab882
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pyop2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3537,8 +3537,21 @@ def num_flops(self):

@cached_property
def num_bytes(self):
# Fake number serving as place holder
return 1e7
# Measuring Streaming data footprint
n_bytes = 0
for arg in self.args:
n_bytes += arg.data.nbytes
if arg.access is not READ:
# Writing access counts as 2 accesses
n_bytes += arg.data.nbytes
for map_ in arg.map_tuple:
if map_ is not None:
for m in map_:
n_bytes += m._values.nbytes
if self.iterset.size == 0:
return 0
else:
return n_bytes/self.iterset.size

def log_flops(self, flops):
pass
Expand Down

0 comments on commit 10ab882

Please sign in to comment.