From 578d31cf388888fb2843809b7b50b59d1ffeb86b Mon Sep 17 00:00:00 2001 From: Eike Mueller Date: Wed, 31 Aug 2016 10:41:38 +0100 Subject: [PATCH] Count FLOPs separate in each grid cell --- pyop2/base.py | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/pyop2/base.py b/pyop2/base.py index ff13800f1..be8e75ff1 100644 --- a/pyop2/base.py +++ b/pyop2/base.py @@ -4187,7 +4187,7 @@ def nbytes(arg, self): return DataVolume(loads=loads, stores=stores, bytes=total_bytes) @property - def total_flops(self): + def flops_per_cell(self): """Return an estimate of the total flops executed by this :class:`ParLoop` @@ -4202,16 +4202,6 @@ def total_flops(self): """ if (not self._measure_flops): return 0 - iterset = self.iterset - size = iterset.size - if self.needs_exec_halo: - size = iterset.exec_size - if self.is_indirect and iterset._extruded: - region = self.iteration_region - if region is ON_INTERIOR_FACETS: - size *= iterset.layers - 2 - elif region not in [ON_TOP, ON_BOTTOM]: - size *= iterset.layers - 1 parameters = '' definitions = '' deallocations = '' @@ -4273,7 +4263,24 @@ def total_flops(self): func = compilation.load(s,'cpp','count_flops',restype=np.int32, cppargs=cppargs) flops = func() - return flops * size + return flops + + @property + def total_flops(self): + """Return an estimate for the total number of FLOPs executed + (i.e. flops_per_cell x mesh size) + """ + iterset = self.iterset + size = iterset.size + if self.needs_exec_halo: + size = iterset.exec_size + if self.is_indirect and iterset._extruded: + region = self.iteration_region + if region is ON_INTERIOR_FACETS: + size *= iterset.layers - 2 + elif region not in [ON_TOP, ON_BOTTOM]: + size *= iterset.layers - 1 + return self.flops_per_cell * size @property def arithmetic_intensity(self):