Skip to content

Commit 2f62f1d

Browse files
committed
test from remote storage
1 parent 2f33d72 commit 2f62f1d

File tree

2 files changed

+6
-31
lines changed

2 files changed

+6
-31
lines changed

tests/simulator/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,12 @@ if(HighFive)
2525

2626
# doesn't make sense in serial
2727
phare_mpi_python3_exec(9 3 load_balancing test_load_balancing.py ${CMAKE_CURRENT_BINARY_DIR})
28+
phare_mpi_python3_exec(9 3 initing test_init_from_restart.py ${CMAKE_CURRENT_BINARY_DIR})
2829

2930
endif(testMPI)
3031

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

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()
3734

3835
endif()
3936

tests/simulator/test_init_from_restart.py

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import subprocess
55
import numpy as np
66
import pyphare.pharein as ph
7-
7+
from pathlib import Path
88

99
from pyphare.simulator.simulator import Simulator
1010
from pyphare.pharesee.hierarchy.patchdata import FieldData, ParticleData
@@ -19,10 +19,10 @@
1919
time_step = 0.001
2020
time_step_nbr = 5
2121
final_time = time_step_nbr * time_step
22-
first_mpi_size = 4
22+
first_mpi_size = 5
2323
ppc = 100
2424
cells = 200
25-
first_out = "phare_outputs/reinit/first"
25+
first_out = "test_init_from_restart"
2626
secnd_out = "phare_outputs/reinit/secnd"
2727
timestamps = np.arange(0, final_time + time_step, time_step)
2828
restart_idx = Z = 2
@@ -77,30 +77,8 @@ def test_reinit(self):
7777
self.assertTrue(hierarchy_compare(*ds, atol=1e-12))
7878

7979

80-
def run_first_sim():
81-
"""uses params from tests_restarts.py"""
82-
simput = copy.deepcopy(test_restarts.simArgs)
83-
simput["restart_options"]["dir"] = first_out
84-
simput["restart_options"]["timestamps"] = timestamps
85-
simput["diag_options"]["options"]["dir"] = first_out
86-
sim = ph.Simulation(**simput)
87-
dump_all_diags(test_restarts.setup_model().populations, timestamps=timestamps)
88-
Simulator(sim).run()
89-
90-
91-
def launch():
92-
"""Launch secondary process to run first simulation to avoid initalizing MPI now"""
93-
94-
cmd = f"mpirun -n {first_mpi_size} python3 -O {__file__} lol"
95-
try:
96-
p = subprocess.run(cmd.split(" "), check=True, capture_output=True)
97-
except subprocess.CalledProcessError as e:
98-
print("CalledProcessError", e)
99-
100-
10180
if __name__ == "__main__":
102-
if len(sys.argv) == 1:
103-
launch()
81+
if Path("test_init_from_restart").exists():
10482
unittest.main()
10583
else:
106-
run_first_sim()
84+
print("No source data found - see tools/test_data_gen.py ")

0 commit comments

Comments
 (0)