Skip to content

Commit

Permalink
changed SPARTA rollup script to be based on no. of MPI ranks instead …
Browse files Browse the repository at this point in the history
…of ranks per domain
  • Loading branch information
amagela committed Dec 13, 2023
1 parent 0bf2e3e commit d6745b3
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions doc/sphinx/08_sparta/sparta_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,31 @@ def __init__(self):
"-f",
"--file",
type=str,
default="ats3--all.csv",
default="metrics_rollup.csv",
help="file name to read",
)

self.parser.add_argument(
"-m",
"--figureOfMerit",
type=str,
default="FOM",
default="FOM (M-particle-steps/sec/node)",
help="header to compute statistics for",
)

self.parser.add_argument(
"-r",
"--ranksPerDomain",
"--ranks",
type=str,
default="RanksPerDomain",
help="header that stores the ranks per domain information",
default="No. Ranks",
help="header that stores the no. of MPI ranks",
)

self.parser.add_argument(
"-p",
"--PPC",
type=str,
default="PPC",
default="Particles Per Cell [PPC]",
help="header that stores the particles per cell (PPC) information",
)

Expand Down Expand Up @@ -133,7 +133,7 @@ def __init__(self, **kwargs):
"is_all",
"header_fom",
"header_ppc",
"header_ranksperdomain",
"header_ranks",
]
needed_attr = [item for item in required_attr if not hasattr(self, item)]
assert len(needed_attr) == 0, (
Expand Down Expand Up @@ -169,7 +169,7 @@ def _get_data(self):

col_fom = None
col_ppc = None
col_ranksperdomain = None
col_ranks = None
self.cache_fom = {}
with open(self.file_name, newline="") as csvfile:
csvfilereader = csv.reader(csvfile, delimiter=",", quotechar='"')
Expand All @@ -184,25 +184,28 @@ def _get_data(self):
col_ppc = row.index(self.header_ppc)
except ValueError:
pass
if col_ranksperdomain is None:
if col_ranks is None:
try:
col_ranksperdomain = row.index(self.header_ranksperdomain)
col_ranks = row.index(self.header_ranks)
except ValueError:
pass
if None in (col_fom, col_ppc, col_ranksperdomain):
if None in (col_fom, col_ppc, col_ranks):
continue
if str(row[col_fom]) == self.header_fom:
continue

key = (
str(row[col_ppc]).zfill(3)
+ "|"
+ str(row[col_ranksperdomain]).zfill(2)
+ str(row[col_ranks]).zfill(2)
)
self.logger.debug("key = {}".format(key))
if key not in self.cache_fom:
self.cache_fom[key] = []
self.cache_fom[key].append(float(row[col_fom]))
try:
self.cache_fom[key].append(float(row[col_fom]))
except ValueError:
self.logger.critical("Bad value: '{}':'{}' (column {})".format(key, row[col_fom], col_fom))

def _compute_stats(self):
"""Compute the stats."""
Expand Down Expand Up @@ -259,7 +262,7 @@ def run(self):
is_all=cl_args.all,
header_fom=cl_args.figureOfMerit,
header_ppc=cl_args.PPC,
header_ranksperdomain=cl_args.ranksPerDomain,
header_ranks=cl_args.ranks,
)

# do work
Expand Down

0 comments on commit d6745b3

Please sign in to comment.