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 6f46dd1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 3 additions & 1 deletion tests/simulator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ phare_python3_exec(9 data-wrangler data_wrangler.py ${CMAKE_CURREN
phare_python3_exec(9 sim-refineParticlNbr refined_particle_nbr.py ${CMAKE_CURRENT_BINARY_DIR})
add_no_mpi_python3_test(periodicity test_init_periodicity.py ${CMAKE_CURRENT_BINARY_DIR})

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

if(HighFive)
## These test use dump diagnostics so require HighFive!
phare_python3_exec(9 diagnostics test_diagnostics.py ${CMAKE_CURRENT_BINARY_DIR}) # serial or n = 2
Expand All @@ -26,7 +29,6 @@ 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})
Expand Down
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 6f46dd1

Please sign in to comment.