From 930c4774d2eb8b95db9f0427a965daffdd92eb73 Mon Sep 17 00:00:00 2001 From: Anthony Agelastos Date: Mon, 4 Mar 2024 10:37:42 -0700 Subject: [PATCH] updated scripts for post processing --- doc/sphinx/07_miniem/metrics_compute.sh | 2 +- doc/sphinx/07_miniem/miniem_fom2.py | 42 +++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/doc/sphinx/07_miniem/metrics_compute.sh b/doc/sphinx/07_miniem/metrics_compute.sh index e2a719c1..b76a2ff1 100755 --- a/doc/sphinx/07_miniem/metrics_compute.sh +++ b/doc/sphinx/07_miniem/metrics_compute.sh @@ -2,6 +2,6 @@ export DIR_BASE=` pwd -P ` find . -name "output-srun*.log" -type f -print0 \ - | xargs -0 -I file ./miniem_fom.py -f file + | xargs -0 -I file ./miniem_fom2.py -f file exit 0 diff --git a/doc/sphinx/07_miniem/miniem_fom2.py b/doc/sphinx/07_miniem/miniem_fom2.py index f478a399..882153d0 100755 --- a/doc/sphinx/07_miniem/miniem_fom2.py +++ b/doc/sphinx/07_miniem/miniem_fom2.py @@ -223,6 +223,47 @@ def _run_try(self): self.metrics_cache['Try'] = emtry self.logger.info("Try = {}".format(emtry)) + def _run_size(self): + """Extract the size.""" + self.logger.debug("Extracting the size...") + file_name_input = "maxwell-large.xml" + emsize = None + empath = os.path.abspath(self.file_name) + empath = os.path.dirname(empath) + empath = os.path.join(empath, file_name_input) + + # + # + # + # + # + try: + tree = ET.parse(empath) + root = tree.getroot() + for c1 in root: + if c1.attrib['name'] == 'Mesh': + for c2 in c1: + if c2.attrib['name'] == 'Inline Mesh': + for c3 in c2: + if c3.attrib['name'] \ + == 'Mesh Factory Parameter List': + for c4 in c3: + if c4.attrib['name'] \ + == 'X Elements': + emsizex = int(c4.attrib['value']) + if c4.attrib['name'] \ + == 'Y Elements': + emsizey = int(c4.attrib['value']) + if c4.attrib['name'] \ + == 'Z Elements': + emsizez = int(c4.attrib['value']) + emsize = int(round(pow(emsizex * emsizey * emsizez, 1/3), 1)) + except: + self.logger.critical("Cannot parse {}!".format(file_name_input)) + + self.metrics_cache['Size'] = emsize + self.logger.info("Size = {}".format(emsize)) + def _run_csv(self): """Put stuff into CSV file.""" file_csv = self.file_name.replace('.log', '.csv') @@ -238,6 +279,7 @@ def run(self): """Extract the FOM.""" self._run_fom() self._run_try() + self._run_size() self.metrics_cache['File'] = os.path.abspath(self.file_name) self._run_csv()