Skip to content

Commit

Permalink
++
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan committed Sep 11, 2024
1 parent a457c66 commit 04238f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
7 changes: 5 additions & 2 deletions tests/simulator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,19 @@ if(HighFive)
# doesn't make sense in serial
phare_mpi_python3_exec(9 3 load_balancing test_load_balancing.py ${CMAKE_CURRENT_BINARY_DIR})

phare_mpi_python3_exec(9 2 initing test_init_from_restart.py ${CMAKE_CURRENT_BINARY_DIR})
endif(testMPI)

phare_python3_exec(11, test_diagnostic_timestamps test_diagnostic_timestamps.py ${CMAKE_CURRENT_BINARY_DIR})

if(NOT lowResourceTests)
# has to be serial, to run secondary mpirun internally
add_no_mpi_python3_test(initing test_init_from_restart.py ${CMAKE_CURRENT_BINARY_DIR})
endif()

endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.py ${CMAKE_CURRENT_BINARY_DIR}/config.py @ONLY)

add_subdirectory(initialize)
add_subdirectory(refinement)
add_subdirectory(advance)

22 changes: 10 additions & 12 deletions tests/simulator/test_init_from_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,16 @@
import copy
import unittest
import subprocess
import numpy as np
import pyphare.pharein as ph

from pyphare.simulator.simulator import Simulator
from pyphare.core import phare_utilities as phut
from pyphare.pharesee.hierarchy.fromh5 import get_all_available_quantities_from_h5
from pyphare.pharesee.particles import single_patch_per_level_per_pop_from
from pyphare.pharesee.hierarchy.hierarchy_utils import (
flat_finest_field,
single_patch_for_LO,
hierarchy_compare,
)

from pyphare.pharesee.hierarchy.hierarchy_utils import single_patch_for_LO
from pyphare.pharesee.hierarchy.hierarchy_utils import hierarchy_compare
from tests.simulator import SimulatorTest, test_restarts
from tests.diagnostic import dump_all_diags


timestep = 0.001
time_step_nbr = 1
first_mpi_size = 4
Expand Down Expand Up @@ -88,9 +82,13 @@ def run_first_sim():

def launch():
"""Launch secondary process to run first simulation to avoid initalizing MPI now"""
cmd = f"mpirun -n {first_mpi_size} python3 -O tests/simulator/test_init_from_restart.py lol"
proc = subprocess.run(cmd.split(" "), check=True, capture_output=True)
return (proc.stdout + proc.stderr).decode().strip()

cmd = f"mpirun -n {first_mpi_size} python3 -O {__file__} lol"
try:
p = subprocess.run(cmd.split(" "), check=True, capture_output=True)
print(p.stdout, p.stderr)
except subprocess.CalledProcessError as e:
print("CalledProcessError", e)


if __name__ == "__main__":
Expand Down

0 comments on commit 04238f6

Please sign in to comment.