From 7821dca87c87ca50b53700c969d0ff0309a7b180 Mon Sep 17 00:00:00 2001 From: deegan Date: Thu, 24 Oct 2024 14:56:18 +0200 Subject: [PATCH 1/7] key error if #896 --- pyphare/pyphare/pharein/simulation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyphare/pyphare/pharein/simulation.py b/pyphare/pyphare/pharein/simulation.py index 5fb41ecc3..3561992df 100644 --- a/pyphare/pyphare/pharein/simulation.py +++ b/pyphare/pyphare/pharein/simulation.py @@ -498,7 +498,7 @@ def check_diag_options(**kwargs): diag_options["options"]["dir"], "diagnostics" ) valid_modes = ["overwrite"] - if "mode" in diag_options["options"]: + if "options" in diag_options and "mode" in diag_options["options"]: mode = diag_options["options"]["mode"] if mode not in valid_modes: raise ValueError( From 07343647cf88c15049b45e77e856ebcb41394ffe Mon Sep 17 00:00:00 2001 From: deegan Date: Thu, 24 Oct 2024 14:56:31 +0200 Subject: [PATCH 2/7] disable test due to numpy shape mismatch --- tests/simulator/refinement/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/simulator/refinement/CMakeLists.txt b/tests/simulator/refinement/CMakeLists.txt index 178fc46e9..d411a11e0 100644 --- a/tests/simulator/refinement/CMakeLists.txt +++ b/tests/simulator/refinement/CMakeLists.txt @@ -10,7 +10,11 @@ endif() if(HighFive) ## These test use dump diagnostics so require HighFive! if(testMPI) - phare_mpi_python3_exec(9 2 simple_2d_refinement test_2d_2_core.py ${CMAKE_CURRENT_BINARY_DIR}) - phare_mpi_python3_exec(11 10 complex_2d_refinement test_2d_10_core.py ${CMAKE_CURRENT_BINARY_DIR}) + + + # phare_mpi_python3_exec(11 10 complex_2d_refinement test_2d_10_core.py ${CMAKE_CURRENT_BINARY_DIR}) endif(testMPI) + + phare_python3_exec(9 simple_2d_refinement test_2d_2_core.py ${CMAKE_CURRENT_BINARY_DIR}) + endif() From 4aac017a21db412b847acd76d77c5c729b60cb7b Mon Sep 17 00:00:00 2001 From: deegan Date: Thu, 24 Oct 2024 16:03:52 +0200 Subject: [PATCH 3/7] mpi functional tests --- tests/functional/harris/CMakeLists.txt | 7 ++++--- tests/functional/harris/harris_2d.py | 9 --------- tests/simulator/refinement/CMakeLists.txt | 3 ++- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/tests/functional/harris/CMakeLists.txt b/tests/functional/harris/CMakeLists.txt index afaf7b4d8..0c11d8b2b 100644 --- a/tests/functional/harris/CMakeLists.txt +++ b/tests/functional/harris/CMakeLists.txt @@ -8,10 +8,11 @@ if(NOT ${PHARE_PROJECT_DIR} STREQUAL ${CMAKE_BINARY_DIR}) endif() if(HighFive AND testMPI) + ## These test use dump diagnostics so require HighFive! - # exec level 11 - # mpirun -n 10 + if(testMPI) - phare_mpi_python3_exec(11 10 harris_2d harris_2d.py ${CMAKE_CURRENT_BINARY_DIR}) + phare_mpi_python3_exec(11 4 harris_2d harris_2d.py ${CMAKE_CURRENT_BINARY_DIR}) endif(testMPI) + endif() diff --git a/tests/functional/harris/harris_2d.py b/tests/functional/harris/harris_2d.py index b9f06ced4..67725dabe 100644 --- a/tests/functional/harris/harris_2d.py +++ b/tests/functional/harris/harris_2d.py @@ -35,8 +35,6 @@ def config(): sim = ph.Simulation( - smallest_patch_size=15, - largest_patch_size=25, time_step_nbr=time_step_nbr, time_step=time_step, # boundary_types="periodic", @@ -155,13 +153,6 @@ def vthz(x, y): def main(): Simulator(config()).run() - try: - from tools.python3 import plotting as m_plotting - - m_plotting.plot_run_timer_data(diag_outputs, cpp.mpi_rank()) - except ImportError: - print("Phlop not found - install with: `pip install phlop`") - cpp.mpi_barrier() if __name__ == "__main__": diff --git a/tests/simulator/refinement/CMakeLists.txt b/tests/simulator/refinement/CMakeLists.txt index d411a11e0..31772ce5d 100644 --- a/tests/simulator/refinement/CMakeLists.txt +++ b/tests/simulator/refinement/CMakeLists.txt @@ -11,8 +11,9 @@ if(HighFive) ## These test use dump diagnostics so require HighFive! if(testMPI) - + # disabled due to https://github.com/PHAREHUB/PHARE/issues/853 # phare_mpi_python3_exec(11 10 complex_2d_refinement test_2d_10_core.py ${CMAKE_CURRENT_BINARY_DIR}) + endif(testMPI) phare_python3_exec(9 simple_2d_refinement test_2d_2_core.py ${CMAKE_CURRENT_BINARY_DIR}) From 8c8909de3ca84b27cc01ed0f1eba428db77f6f1b Mon Sep 17 00:00:00 2001 From: PhilipDeegan Date: Thu, 24 Oct 2024 22:16:01 +0200 Subject: [PATCH 4/7] balancing harris by default --- tests/functional/harris/CMakeLists.txt | 2 +- tests/functional/harris/harris_2d_lb.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/harris/CMakeLists.txt b/tests/functional/harris/CMakeLists.txt index 0c11d8b2b..afe727b06 100644 --- a/tests/functional/harris/CMakeLists.txt +++ b/tests/functional/harris/CMakeLists.txt @@ -12,7 +12,7 @@ if(HighFive AND testMPI) ## These test use dump diagnostics so require HighFive! if(testMPI) - phare_mpi_python3_exec(11 4 harris_2d harris_2d.py ${CMAKE_CURRENT_BINARY_DIR}) + phare_mpi_python3_exec(11 6 harris_2d harris_2d_lb.py ${CMAKE_CURRENT_BINARY_DIR}) endif(testMPI) endif() diff --git a/tests/functional/harris/harris_2d_lb.py b/tests/functional/harris/harris_2d_lb.py index 1153b6e8b..26f791986 100644 --- a/tests/functional/harris/harris_2d_lb.py +++ b/tests/functional/harris/harris_2d_lb.py @@ -15,7 +15,7 @@ mpl.use("Agg") -SCOPE_TIMING = os.getenv("PHARE_SCOPE_TIMING", "True").lower() in ("true", "1", "t") +SCOPE_TIMING = os.getenv("PHARE_SCOPE_TIMING", "False").lower() in ("true", "1", "t") LOAD_BALANCE = os.getenv("LOAD_BALANCE", "True").lower() in ("true", "1", "t") cpp = cpp_lib() From f65a09ca3a2f5dda2e2cd63c063482184450e117 Mon Sep 17 00:00:00 2001 From: deegan Date: Fri, 25 Oct 2024 11:15:28 +0200 Subject: [PATCH 5/7] allow import error --- tests/functional/harris/harris_2d_lb.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/functional/harris/harris_2d_lb.py b/tests/functional/harris/harris_2d_lb.py index 26f791986..465d51ea9 100644 --- a/tests/functional/harris/harris_2d_lb.py +++ b/tests/functional/harris/harris_2d_lb.py @@ -10,8 +10,8 @@ from pyphare.pharesee.run import Run from pyphare.simulator.simulator import Simulator, startMPI + from tests.simulator import SimulatorTest -from tools.python3 import plotting as m_plotting mpl.use("Agg") @@ -184,6 +184,15 @@ def plot(diag_dir): ) +def plot_runtimer(diag_dir, rank): + try: + from tools.python3 import plotting as m_plotting + + m_plotting.plot_run_timer_data(diag_dir, cpp.mpi_rank()) + except ImportError: + print("phlop not found - or phare src dir not in pythonpath") + + class HarrisTest(SimulatorTest): def __init__(self, *args, **kwargs): super(HarrisTest, self).__init__(*args, **kwargs) @@ -202,7 +211,7 @@ def test_run(self): if cpp.mpi_rank() == 0: plot(diag_dir) if SCOPE_TIMING: - m_plotting.plot_run_timer_data(diag_dir, cpp.mpi_rank()) + plot_runtimer(diag_dir, cpp.mpi_rank()) cpp.mpi_barrier() return self From da81ff93b16325b2f43533ac66bf6317e99474f4 Mon Sep 17 00:00:00 2001 From: PhilipDeegan Date: Sun, 10 Nov 2024 15:57:51 +0100 Subject: [PATCH 6/7] more cores for harris --- tests/functional/harris/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/harris/CMakeLists.txt b/tests/functional/harris/CMakeLists.txt index afe727b06..7939ba208 100644 --- a/tests/functional/harris/CMakeLists.txt +++ b/tests/functional/harris/CMakeLists.txt @@ -12,7 +12,7 @@ if(HighFive AND testMPI) ## These test use dump diagnostics so require HighFive! if(testMPI) - phare_mpi_python3_exec(11 6 harris_2d harris_2d_lb.py ${CMAKE_CURRENT_BINARY_DIR}) + phare_mpi_python3_exec(11 10 harris_2d harris_2d_lb.py ${CMAKE_CURRENT_BINARY_DIR}) endif(testMPI) endif() From 4158b7e8ab32d774454b83724fff7ff2e565432c Mon Sep 17 00:00:00 2001 From: PhilipDeegan Date: Sun, 10 Nov 2024 15:58:48 +0100 Subject: [PATCH 7/7] Update CMakeLists.txt --- tests/simulator/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/simulator/CMakeLists.txt b/tests/simulator/CMakeLists.txt index 86274d16f..edef7be5f 100644 --- a/tests/simulator/CMakeLists.txt +++ b/tests/simulator/CMakeLists.txt @@ -25,9 +25,12 @@ if(HighFive) # doesn't make sense in serial phare_mpi_python3_exec(9 3 load_balancing test_load_balancing.py ${CMAKE_CURRENT_BINARY_DIR}) - endif(testMPI) - phare_python3_exec(11, test_diagnostic_timestamps test_diagnostic_timestamps.py ${CMAKE_CURRENT_BINARY_DIR}) + else() + phare_python3_exec(11 test_diagnostic_timestamps test_diagnostic_timestamps.py ${CMAKE_CURRENT_BINARY_DIR}) + + endif(testMPI) + endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.py ${CMAKE_CURRENT_BINARY_DIR}/config.py @ONLY)