Skip to content

Commit

Permalink
++
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan committed Sep 28, 2024
1 parent 62c04ab commit 4a4fdc7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
5 changes: 3 additions & 2 deletions pyphare/pyphare/cpp/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,12 @@ def log_runtime_config():
git_hash=get_git_hash(),
)

rank_info_dir = DOT_PHARE_DIR / "rank_info"
if cpp_lib.mpi_rank() == 0:
DOT_PHARE_DIR.mkdir(exist_ok=True, parents=True)
rank_info_dir.mkdir(exist_ok=True, parents=True)
cpp_lib.mpi_barrier()

rank_dir = DOT_PHARE_DIR / f"rank_{cpp_lib.mpi_rank()}"
rank_dir = rank_info_dir / f"{cpp_lib.mpi_rank()}"
rank_dir.mkdir(exist_ok=True)

with open(rank_dir / "runtime_config.json", "w") as f:
Expand Down
11 changes: 7 additions & 4 deletions pyphare/pyphare/simulator/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
import time as timem
import numpy as np
import pyphare.pharein as ph
from pathlib import Path
from . import monitoring as mon


life_cycles = {}
PHARE_SIM_MON = os.getenv("PHARE_SIM_MON", "False").lower() in ("true", "1", "t")
SIM_MONITOR = os.getenv("PHARE_SIM_MON", "False").lower() in ("true", "1", "t")
SCOPE_TIMING = os.getenv("PHARE_SCOPE_TIMING", "False").lower() in ("true", "1", "t")


@atexit.register
Expand All @@ -27,6 +29,9 @@ def simulator_shutdown():
def make_cpp_simulator(dim, interp, nbrRefinedPart, hier):
from pyphare.cpp import cpp_lib

if SCOPE_TIMING:
Path(".phare/timings").mkdir(exist_ok=True)

make_sim = f"make_simulator_{dim}_{interp}_{nbrRefinedPart}"
return getattr(cpp_lib(), make_sim)(hier)

Expand Down Expand Up @@ -180,7 +185,7 @@ def run(self, plot_times=False, monitoring=None):
self._check_init()

if monitoring is None: # check env
monitoring = PHARE_SIM_MON
monitoring = SIM_MONITOR

if self.simulation.dry_run:
return self
Expand Down Expand Up @@ -281,6 +286,4 @@ def _log_to_file(self):
from pyphare.cpp import cpp_lib

if os.environ["PHARE_LOG"] != "NONE" and cpp_lib().mpi_rank() == 0:
from pathlib import Path

Path(".log").mkdir(exist_ok=True)
2 changes: 1 addition & 1 deletion tools/python3/phloping.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def write_root_as_csv(scope_timer_file, outfile, headers=None, regex=None):
print_root_as_csv(scope_timer_file, headers, regex)


def print_root_as_csv(scope_timer_file, headers=None, regex=None, n_parts):
def print_root_as_csv(scope_timer_file, n_parts, headers=None, regex=None):
stf = scope_timer_file # alias
stf = file_parser(stf) if isinstance(stf, str) else stf

Expand Down
2 changes: 1 addition & 1 deletion tools/python3/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def plot_run_timer_data(diag_dir=None, rank=0):
parser.add_argument("-d", "--dir", default=".", help="Diagnostics directory")
diag_dir = parser.parse_args().dir
run = Run(diag_dir)
res = phloping.file_parser(run, rank, Path(f".phare_times.{rank}.txt"))
res = phloping.file_parser(run, rank, Path(f".phare/timings/rank.{rank}.txt"))
fig, ax = plt.subplots()
L0X = res.time_steps_for_L(0)
ax.plot(L0X, res.normalised_times_for_L(0), ":", label="L0 times", color="black")
Expand Down

0 comments on commit 4a4fdc7

Please sign in to comment.