Skip to content

Commit

Permalink
even more
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan committed Jun 7, 2024
1 parent fe6973b commit 9b81fa8
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 27 deletions.
10 changes: 5 additions & 5 deletions tests/diagnostic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ cmake_minimum_required (VERSION 3.20.1)

project(test-diagnostics)

if(NOT ${PHARE_PROJECT_DIR} STREQUAL ${CMAKE_BINARY_DIR})
file(GLOB PYFILES "*.py")
file(COPY ${PYFILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif()

set(SOURCES_INC
${PROJECT_SOURCE_DIR}/test_diagnostics.hpp
)
Expand Down Expand Up @@ -35,11 +40,6 @@ if(HighFive)
_add_diagnostics_test(test-diagnostics_1d)
_add_diagnostics_test(test-diagnostics_2d)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/job_1d.py.in ${CMAKE_CURRENT_BINARY_DIR}/job_1d.py @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/job_2d.py.in ${CMAKE_CURRENT_BINARY_DIR}/job_2d.py @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_BINARY_DIR}/__init__.py @ONLY)

message(STATUS "diagnostic working directory " ${PHARE_PROJECT_DIR})

endif()

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tests.simulator import basicSimulatorArgs, makeBasicModel
from tests.diagnostic import dump_all_diags

out = "phare_outputs/diags_1d/"
out = "phare_outputs/diags_1d/1"
simInput = {"diag_options": {"format": "phareh5", "options": {"dir": out, "mode" : "overwrite"}}}

ph.Simulation(**basicSimulatorArgs(dim = 1, interp = 1, **simInput))
Expand Down
14 changes: 14 additions & 0 deletions tests/diagnostic/job_1d_2core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python3

import pyphare.pharein as ph
from pyphare.pharein import ElectronModel
from tests.simulator import basicSimulatorArgs, makeBasicModel
from tests.diagnostic import dump_all_diags

out = "phare_outputs/diags_1d/2"
simInput = {"diag_options": {"format": "phareh5", "options": {"dir": out, "mode" : "overwrite"}}}

ph.Simulation(**basicSimulatorArgs(dim = 1, interp = 1, **simInput))
model = makeBasicModel()
ElectronModel(closure="isothermal",Te = 0.12)
dump_all_diags(model.populations)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tests.simulator import basicSimulatorArgs, makeBasicModel
from tests.diagnostic import dump_all_diags

out = "phare_outputs/diags_2d/"
out = "phare_outputs/diags_2d/1"
simInput = {"diag_options": {"format": "phareh5", "options": {"dir": out, "mode" : "overwrite"}}}

ph.Simulation(**basicSimulatorArgs(dim = 2, interp = 1, **simInput))
Expand Down
14 changes: 14 additions & 0 deletions tests/diagnostic/job_2d_2core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env python3

import pyphare.pharein as ph
from pyphare.pharein import ElectronModel
from tests.simulator import basicSimulatorArgs, makeBasicModel
from tests.diagnostic import dump_all_diags

out = "phare_outputs/diags_2d/2"
simInput = {"diag_options": {"format": "phareh5", "options": {"dir": out, "mode" : "overwrite"}}}

ph.Simulation(**basicSimulatorArgs(dim = 2, interp = 1, **simInput))
model = makeBasicModel()
ElectronModel(closure="isothermal",Te = 0.12)
dump_all_diags(model.populations)
18 changes: 11 additions & 7 deletions tests/diagnostic/test-diagnostics_1d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,34 @@

#include "test_diagnostics.ipp"

static std::string const job_file = "job_1d";
void static out_dir()
static std::string const job_file()
{
return std::string{"phare_outputs/diags_2d/" + std::to_string() PHARE::core::mpi::rank()};
return "job_1d_" + std::to_string(PHARE::core::mpi::size()) + "core";
}
static std::string const out_dir()
{
return "phare_outputs/diags_1d/" + std::to_string(PHARE::core::mpi::size());
}


TYPED_TEST(Simulator1dTest, fluid)
{
fluid_test(TypeParam{job_file}, out_dir());
fluid_test(TypeParam{job_file()}, out_dir());
}

TYPED_TEST(Simulator1dTest, particles)
{
particles_test(TypeParam{job_file}, out_dir());
particles_test(TypeParam{job_file()}, out_dir());
}

TYPED_TEST(Simulator1dTest, electromag)
{
electromag_test(TypeParam{job_file}, out_dir());
electromag_test(TypeParam{job_file()}, out_dir());
}

TYPED_TEST(Simulator1dTest, allFromPython)
{
allFromPython_test(TypeParam{job_file}, out_dir());
allFromPython_test(TypeParam{job_file()}, out_dir());
}


Expand Down
26 changes: 14 additions & 12 deletions tests/diagnostic/test-diagnostics_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,34 @@

#include "test_diagnostics.ipp"

static std::string const job_file = "job_2d";

void static out_dir()
static std::string const job_file()
{
return "job_2d_" + std::to_string(PHARE::core::mpi::size()) + "core";
}
static std::string const out_dir()
{
return std::string{"phare_outputs/diags_2d/" + std::to_string() PHARE::core::mpi::rank()};
return "phare_outputs/diags_2d/" + std::to_string(PHARE::core::mpi::size());
}


TYPED_TEST(Simulator2dTest, fluid)
TYPED_TEST(Simulator1dTest, fluid)
{
fluid_test(TypeParam{job_file}, out_dir());
fluid_test(TypeParam{job_file()}, out_dir());
}

TYPED_TEST(Simulator2dTest, particles)
TYPED_TEST(Simulator1dTest, particles)
{
particles_test(TypeParam{job_file}, out_dir());
particles_test(TypeParam{job_file()}, out_dir());
}

TYPED_TEST(Simulator2dTest, electromag)
TYPED_TEST(Simulator1dTest, electromag)
{
electromag_test(TypeParam{job_file}, out_dir());
electromag_test(TypeParam{job_file()}, out_dir());
}

TYPED_TEST(Simulator2dTest, allFromPython)
TYPED_TEST(Simulator1dTest, allFromPython)
{
allFromPython_test(TypeParam{job_file}, out_dir());
allFromPython_test(TypeParam{job_file()}, out_dir());
}


Expand Down
2 changes: 1 addition & 1 deletion tools/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def write_local_cmake_file(mpi_results):
if mpi_type == "OMPI":
# work around for https://github.com/open-mpi/ompi/issues/10761#issuecomment-1236909802
file.write(
"""set (PHARE_MPIRUN_POSTFIX "${PHARE_MPIRUN_POSTFIX} --bind-to none -quiet")
"""set (PHARE_MPIRUN_POSTFIX "${PHARE_MPIRUN_POSTFIX} --bind-to none ")
"""
)

Expand Down

0 comments on commit 9b81fa8

Please sign in to comment.