[comparator] extract elasped time from coarse step
This commit is contained in:
+54
-23
@@ -267,32 +267,50 @@ class Comparator(Aggregator, HDF5Container):
|
|||||||
series["fine_step"][run].append(fine_step)
|
series["fine_step"][run].append(fine_step)
|
||||||
series["dt"][run].append(dt)
|
series["dt"][run].append(dt)
|
||||||
series["a"][run].append(a)
|
series["a"][run].append(a)
|
||||||
series["mempc1"][run].append(mempc1)
|
series["mem_cells"][run].append(mempc1)
|
||||||
series["mempc2"][run].append(mempc2)
|
series["mem_parts"][run].append(mempc2)
|
||||||
return series
|
return series
|
||||||
|
|
||||||
def _extract_coarse_step_from_log(self, series, log_filename, run):
|
def _extract_coarse_step_from_log(self, series, log_filename, run):
|
||||||
rism = self.pp_params.input.ramses_ism
|
rism = self.pp_params.input.ramses_ism
|
||||||
nlines = 2 + int(rism) # Number of useful lines
|
nlines = 2 + int(rism) # Number of useful lines
|
||||||
cmd_grep = "grep 'Main step' {} -A {}".format(log_filename, nlines - 1)
|
cmd_grep = "grep 'Main step\\|coarse step' {} -A {}".format(
|
||||||
|
log_filename, nlines - 1
|
||||||
|
)
|
||||||
content = os.popen(cmd_grep).readlines()
|
content = os.popen(cmd_grep).readlines()
|
||||||
for i in range(0, len(content), nlines + 1):
|
for j in range(0, len(content), 2 * (nlines + 1)):
|
||||||
series["time"][run].append(
|
i = j + nlines + 1 # Index for the "Main step" grep
|
||||||
np.float(content[i + nlines - 1].split("=")[2].split()[0])
|
|
||||||
)
|
if i + nlines - 1 < len(content):
|
||||||
series["step"][run].append(np.int(content[i].split("=")[1].split()[0]))
|
series["time"][run].append(
|
||||||
series["mcons"][run].append(np.float(content[i].split("=")[2].split()[0]))
|
np.float(content[i + nlines - 1].split("=")[2].split()[0])
|
||||||
series["econs"][run].append(np.float(content[i].split("=")[3].split()[0]))
|
)
|
||||||
series["epot"][run].append(np.float(content[i].split("=")[4].split()[0]))
|
series["step"][run].append(np.int(content[i].split("=")[1].split()[0]))
|
||||||
series["ekin"][run].append(np.float(content[i].split("=")[5].split()[0]))
|
series["mcons"][run].append(
|
||||||
if rism:
|
np.float(content[i].split("=")[2].split()[0])
|
||||||
eint = np.float(content[i].split("=")[6].split()[0])
|
)
|
||||||
emag = np.float(content[i + 1].split("=")[1].split()[0])
|
series["econs"][run].append(
|
||||||
else:
|
np.float(content[i].split("=")[3].split()[0])
|
||||||
eint = 0.0
|
)
|
||||||
emag = 0.0
|
series["epot"][run].append(
|
||||||
series["eint"][run].append(eint)
|
np.float(content[i].split("=")[4].split()[0])
|
||||||
series["emag"][run].append(emag)
|
)
|
||||||
|
series["ekin"][run].append(
|
||||||
|
np.float(content[i].split("=")[5].split()[0])
|
||||||
|
)
|
||||||
|
if rism:
|
||||||
|
eint = np.float(content[i].split("=")[6].split()[0])
|
||||||
|
emag = np.float(content[i + 1].split("=")[1].split()[0])
|
||||||
|
else:
|
||||||
|
eint = 0.0
|
||||||
|
emag = 0.0
|
||||||
|
series["eint"][run].append(eint)
|
||||||
|
series["emag"][run].append(emag)
|
||||||
|
series["elapsed"][run].append(
|
||||||
|
np.float(content[j].split(":")[1].split()[0])
|
||||||
|
)
|
||||||
|
series["memory"][run].append(content[j + 1].split(":")[1])
|
||||||
|
|
||||||
return series
|
return series
|
||||||
|
|
||||||
def _extract_rms_from_log(self, series, log_filename, run):
|
def _extract_rms_from_log(self, series, log_filename, run):
|
||||||
@@ -580,7 +598,18 @@ class Comparator(Aggregator, HDF5Container):
|
|||||||
self,
|
self,
|
||||||
partial(
|
partial(
|
||||||
self._from_log,
|
self._from_log,
|
||||||
["time", "step", "mcons", "econs", "epot", "ekin", "eint", "emag"],
|
[
|
||||||
|
"time",
|
||||||
|
"step",
|
||||||
|
"mcons",
|
||||||
|
"econs",
|
||||||
|
"epot",
|
||||||
|
"ekin",
|
||||||
|
"eint",
|
||||||
|
"emag",
|
||||||
|
"elapsed",
|
||||||
|
"memory",
|
||||||
|
],
|
||||||
self._extract_coarse_step_from_log,
|
self._extract_coarse_step_from_log,
|
||||||
),
|
),
|
||||||
group="/series",
|
group="/series",
|
||||||
@@ -593,6 +622,8 @@ class Comparator(Aggregator, HDF5Container):
|
|||||||
"ekin": U.none,
|
"ekin": U.none,
|
||||||
"eint": U.none,
|
"eint": U.none,
|
||||||
"emag": U.none,
|
"emag": U.none,
|
||||||
|
"elapsed": U.s,
|
||||||
|
"memory": U.none,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
"fine_step_from_log": Rule(
|
"fine_step_from_log": Rule(
|
||||||
@@ -608,8 +639,8 @@ class Comparator(Aggregator, HDF5Container):
|
|||||||
"fine_step": U.none,
|
"fine_step": U.none,
|
||||||
"dt": "unit_time",
|
"dt": "unit_time",
|
||||||
"a": U.none,
|
"a": U.none,
|
||||||
"mempc1": U.none,
|
"mem_cells": U.none,
|
||||||
"mempc2": U.none,
|
"mem_parts": U.none,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
"turb_power": Rule(
|
"turb_power": Rule(
|
||||||
|
|||||||
+13
-3
@@ -196,6 +196,7 @@ class Plotter(Aggregator, BaseProcessor):
|
|||||||
nml = self.comp.namelist[run]
|
nml = self.comp.namelist[run]
|
||||||
name = simu_fmt.format(run=run, tag=tag, nml=nml)
|
name = simu_fmt.format(run=run, tag=tag, nml=nml)
|
||||||
exec_time = str(datetime.datetime.fromtimestamp(os.stat(pp.path).st_ctime))
|
exec_time = str(datetime.datetime.fromtimestamp(os.stat(pp.path).st_ctime))
|
||||||
|
exec_time = exec_time.split(".")[0]
|
||||||
description = descr_fmt.format(run=run, tag=tag, nml=nml)
|
description = descr_fmt.format(run=run, tag=tag, nml=nml)
|
||||||
simu = Simulation(
|
simu = Simulation(
|
||||||
simu_code=ramses,
|
simu_code=ramses,
|
||||||
@@ -1739,12 +1740,21 @@ class Plotter(Aggregator, BaseProcessor):
|
|||||||
dependencies=[group],
|
dependencies=[group],
|
||||||
)
|
)
|
||||||
|
|
||||||
for name in ["step", "mcons", "econs", "epot", "ekin", "eint", "emag"]:
|
for name in [
|
||||||
|
"step",
|
||||||
|
"mcons",
|
||||||
|
"econs",
|
||||||
|
"epot",
|
||||||
|
"ekin",
|
||||||
|
"eint",
|
||||||
|
"emag",
|
||||||
|
"elapsed",
|
||||||
|
]:
|
||||||
self._gen_from_log("coarse_step_from_log", name)
|
self._gen_from_log("coarse_step_from_log", name)
|
||||||
|
|
||||||
for name in ["fine_step", "dt", "a", "mempc1", "mempc2"]:
|
for name in ["fine_step", "dt", "a", "mem_cells", "mem_parts"]:
|
||||||
self._gen_from_log("fine_step_from_log", name)
|
self._gen_from_log("fine_step_from_log", name)
|
||||||
for name in ["time", "dt", "a", "mempc1", "mempc2"]:
|
for name in ["time", "dt", "a", "mem_cells", "mem_parts"]:
|
||||||
self._gen_from_log("fine_step_from_log", name_y=name, name_x="fine_step")
|
self._gen_from_log("fine_step_from_log", name_y=name, name_x="fine_step")
|
||||||
|
|
||||||
# Dict of overlays
|
# Dict of overlays
|
||||||
|
|||||||
Reference in New Issue
Block a user