Skip to content

Commit 578d31c

Browse files
committed
Count FLOPs separate in each grid cell
1 parent bd3ed08 commit 578d31c

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

pyop2/base.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4187,7 +4187,7 @@ def nbytes(arg, self):
41874187
return DataVolume(loads=loads, stores=stores, bytes=total_bytes)
41884188

41894189
@property
4190-
def total_flops(self):
4190+
def flops_per_cell(self):
41914191
"""Return an estimate of the total flops executed by this
41924192
:class:`ParLoop`
41934193
@@ -4202,16 +4202,6 @@ def total_flops(self):
42024202
"""
42034203
if (not self._measure_flops):
42044204
return 0
4205-
iterset = self.iterset
4206-
size = iterset.size
4207-
if self.needs_exec_halo:
4208-
size = iterset.exec_size
4209-
if self.is_indirect and iterset._extruded:
4210-
region = self.iteration_region
4211-
if region is ON_INTERIOR_FACETS:
4212-
size *= iterset.layers - 2
4213-
elif region not in [ON_TOP, ON_BOTTOM]:
4214-
size *= iterset.layers - 1
42154205
parameters = ''
42164206
definitions = ''
42174207
deallocations = ''
@@ -4273,7 +4263,24 @@ def total_flops(self):
42734263
func = compilation.load(s,'cpp','count_flops',restype=np.int32,
42744264
cppargs=cppargs)
42754265
flops = func()
4276-
return flops * size
4266+
return flops
4267+
4268+
@property
4269+
def total_flops(self):
4270+
"""Return an estimate for the total number of FLOPs executed
4271+
(i.e. flops_per_cell x mesh size)
4272+
"""
4273+
iterset = self.iterset
4274+
size = iterset.size
4275+
if self.needs_exec_halo:
4276+
size = iterset.exec_size
4277+
if self.is_indirect and iterset._extruded:
4278+
region = self.iteration_region
4279+
if region is ON_INTERIOR_FACETS:
4280+
size *= iterset.layers - 2
4281+
elif region not in [ON_TOP, ON_BOTTOM]:
4282+
size *= iterset.layers - 1
4283+
return self.flops_per_cell * size
42774284

42784285
@property
42794286
def arithmetic_intensity(self):

0 commit comments

Comments
 (0)