Skip to content

Commit 04238f6

Browse files
committed
++
1 parent a457c66 commit 04238f6

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

tests/simulator/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,19 @@ if(HighFive)
2626
# doesn't make sense in serial
2727
phare_mpi_python3_exec(9 3 load_balancing test_load_balancing.py ${CMAKE_CURRENT_BINARY_DIR})
2828

29-
phare_mpi_python3_exec(9 2 initing test_init_from_restart.py ${CMAKE_CURRENT_BINARY_DIR})
3029
endif(testMPI)
3130

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

33+
if(NOT lowResourceTests)
34+
# has to be serial, to run secondary mpirun internally
35+
add_no_mpi_python3_test(initing test_init_from_restart.py ${CMAKE_CURRENT_BINARY_DIR})
36+
endif()
37+
3438
endif()
3539

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

3842
add_subdirectory(initialize)
3943
add_subdirectory(refinement)
4044
add_subdirectory(advance)
41-

tests/simulator/test_init_from_restart.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,16 @@
22
import copy
33
import unittest
44
import subprocess
5-
import numpy as np
65
import pyphare.pharein as ph
76

87
from pyphare.simulator.simulator import Simulator
9-
from pyphare.core import phare_utilities as phut
108
from pyphare.pharesee.hierarchy.fromh5 import get_all_available_quantities_from_h5
11-
from pyphare.pharesee.particles import single_patch_per_level_per_pop_from
12-
from pyphare.pharesee.hierarchy.hierarchy_utils import (
13-
flat_finest_field,
14-
single_patch_for_LO,
15-
hierarchy_compare,
16-
)
17-
9+
from pyphare.pharesee.hierarchy.hierarchy_utils import single_patch_for_LO
10+
from pyphare.pharesee.hierarchy.hierarchy_utils import hierarchy_compare
1811
from tests.simulator import SimulatorTest, test_restarts
1912
from tests.diagnostic import dump_all_diags
2013

14+
2115
timestep = 0.001
2216
time_step_nbr = 1
2317
first_mpi_size = 4
@@ -88,9 +82,13 @@ def run_first_sim():
8882

8983
def launch():
9084
"""Launch secondary process to run first simulation to avoid initalizing MPI now"""
91-
cmd = f"mpirun -n {first_mpi_size} python3 -O tests/simulator/test_init_from_restart.py lol"
92-
proc = subprocess.run(cmd.split(" "), check=True, capture_output=True)
93-
return (proc.stdout + proc.stderr).decode().strip()
85+
86+
cmd = f"mpirun -n {first_mpi_size} python3 -O {__file__} lol"
87+
try:
88+
p = subprocess.run(cmd.split(" "), check=True, capture_output=True)
89+
print(p.stdout, p.stderr)
90+
except subprocess.CalledProcessError as e:
91+
print("CalledProcessError", e)
9492

9593

9694
if __name__ == "__main__":

0 commit comments

Comments
 (0)