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

Commit

Permalink
Count FLOPs separate in each grid cell
Browse files Browse the repository at this point in the history
  • Loading branch information
eikehmueller committed Aug 31, 2016
1 parent bd3ed08 commit 578d31c
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions pyop2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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 = ''
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 578d31c

Please sign in to comment.