Skip to content

Commit

Permalink
better timing directory creation (#914)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan authored Oct 24, 2024
1 parent c262a75 commit 296f0f8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions pyphare/pyphare/simulator/monitoring.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#
#
#

import os
from pathlib import Path

from pyphare.logger import getLogger

logger = getLogger(__name__)


def have_phlop():
from importlib.util import find_spec
Expand Down Expand Up @@ -46,3 +55,11 @@ def monitoring_shutdown(cpplib):

if _globals.stats_man:
_globals.stats_man.kill().join()


def timing_setup(cpplib):
if cpplib.mpi_rank() == 0:
try:
Path(".phare/timings").mkdir(parents=True, exist_ok=True)
except FileNotFoundError:
logger.error(f"Couldn't find timing dir from {os.getcwd() }")
2 changes: 1 addition & 1 deletion pyphare/pyphare/simulator/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def make_cpp_simulator(dim, interp, nbrRefinedPart, hier):
from pyphare.cpp import cpp_lib

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

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

0 comments on commit 296f0f8

Please sign in to comment.