Skip to content

Commit

Permalink
test bind-to-none for mpirun // tests - nd restart tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan committed Feb 9, 2024
1 parent 618c8f6 commit 04d6f73
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 208 deletions.
12 changes: 8 additions & 4 deletions res/cmake/def.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ endif() # clang
set (PHARE_LINK_FLAGS )
set (PHARE_BASE_LIBS )

if(NOT DEFINED PHARE_MPIRUN_POSTFIX)
set (PHARE_MPIRUN_POSTFIX --bind-to none)
endif()

if(PGO_GEN)
if(PGO_USE)
message(FATAL_ERROR "cannot generate and use pgo at the same time.")
Expand Down Expand Up @@ -181,17 +185,17 @@ if (test AND ${PHARE_EXEC_LEVEL_MIN} GREATER 0) # 0 = no tests

if(testMPI)
function(add_phare_test binary directory)
add_test(NAME ${binary} COMMAND mpirun -n ${PHARE_MPI_PROCS} ./${binary} WORKING_DIRECTORY ${directory})
add_test(NAME ${binary} COMMAND mpirun -n ${PHARE_MPI_PROCS} ${PHARE_MPIRUN_POSTFIX} ./${binary} WORKING_DIRECTORY ${directory})
add_phare_test_(${binary} ${directory})
endfunction(add_phare_test)

function(add_python3_test name file directory)
add_test(NAME py3_${name} COMMAND mpirun -n ${PHARE_MPI_PROCS} python3 -u ${file} WORKING_DIRECTORY ${directory})
add_test(NAME py3_${name} COMMAND mpirun -n ${PHARE_MPI_PROCS} ${PHARE_MPIRUN_POSTFIX} python3 -u ${file} WORKING_DIRECTORY ${directory})
set_exe_paths_(py3_${name})
endfunction(add_python3_test)

function(add_mpi_python3_test N name file directory)
add_test(NAME py3_${name}_mpi_n_${N} COMMAND mpirun -n ${N} python3 ${file} WORKING_DIRECTORY ${directory})
add_test(NAME py3_${name}_mpi_n_${N} COMMAND mpirun -n ${N} ${PHARE_MPIRUN_POSTFIX} python3 ${file} WORKING_DIRECTORY ${directory})
set_exe_paths_(py3_${name}_mpi_n_${N})
endfunction(add_mpi_python3_test)

Expand Down Expand Up @@ -254,7 +258,7 @@ if (test AND ${PHARE_EXEC_LEVEL_MIN} GREATER 0) # 0 = no tests
else()
add_test(
NAME py3_${target}_mpi_n_${N}
COMMAND mpirun -n ${N} python3 -u ${file} ${CLI_ARGS}
COMMAND mpirun -n ${N} ${PHARE_MPIRUN_POSTFIX} python3 -u ${file} ${CLI_ARGS}
WORKING_DIRECTORY ${directory})
set_exe_paths_(py3_${target}_mpi_n_${N})
endif()
Expand Down
8 changes: 4 additions & 4 deletions res/cmake/dep/highfive.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ if(HighFive)
set (HIGHFIVE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/subprojects/highfive)

if (NOT EXISTS ${HIGHFIVE_SRC})
execute_process(
COMMAND ${Git} clone https://github.com/BlueBrain/HighFive ${HIGHFIVE_SRC} -b master --depth 1
execute_process( # master API breaks us
COMMAND ${Git} clone https://github.com/BlueBrain/HighFive ${HIGHFIVE_SRC} -b v2.9.0 --depth 1
)

else()
if(devMode)
message("downloading latest HighFive updates")
execute_process(COMMAND ${Git} pull origin master WORKING_DIRECTORY ${HIGHFIVE_SRC})
# message("downloading latest HighFive updates")
# execute_process(COMMAND ${Git} pull origin master WORKING_DIRECTORY ${HIGHFIVE_SRC})
endif(devMode)
endif()

Expand Down
41 changes: 23 additions & 18 deletions tests/simulator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import unittest

from copy import deepcopy


from datetime import datetime
import pyphare.pharein as ph, numpy as np
from pyphare.pharein import ElectronModel


def parse_cli_args(pop_from_sys=True):
Expand Down Expand Up @@ -30,31 +33,33 @@ def basicSimulatorArgs(dim: int, interp: int, **kwargs):
from pyphare.pharein.simulation import valid_refined_particle_nbr
from pyphare.pharein.simulation import check_patch_size

args = deepcopy(kwargs)

cells = kwargs.get("cells", [20 for i in range(dim)])
if not isinstance(cells, (list, tuple)):
cells = [cells] * dim

_, smallest_patch_size = check_patch_size(dim, interp_order=interp, cells=cells)
dl = [1.0 / v for v in cells]
b0 = [[3] * dim, [8] * dim]

args = {
"interp_order": interp,
"smallest_patch_size": smallest_patch_size,
"largest_patch_size": [20] * dim,
"time_step_nbr": 1000,
"final_time": 1.0,
"time_step": 0.001,
"boundary_types": ["periodic"] * dim,
"cells": cells,
"dl": dl,
"refinement_boxes": {"L0": {"B0": b0}},
"dl": [1.0 / v for v in cells],
"refined_particle_nbr": valid_refined_particle_nbr[dim][interp][0],
"diag_options": {},
"nesting_buffer": 0,
"strict": True,
# "strict": True,
}
for k, v in kwargs.items():
if k in args:
args[k] = v
args.update(deepcopy(kwargs))

if "refinement" not in kwargs and "refinement_boxes" not in kwargs:
b0 = [[3] * dim, [8] * dim]
args["refinement_boxes"] = {"L0": {"B0": b0}}

return args

Expand Down Expand Up @@ -139,20 +144,20 @@ def makeBasicModel(extra_pops={}):
)


def populate_simulation(dim, interp, **input):
def populate_simulation(ndim=1, interp=1, model_fn=None, diags_fn=None, **simInput):
ph.global_vars.sim = None
simulation = ph.Simulation(**basicSimulatorArgs(dim, interp, **input))
simulation = ph.Simulation(**basicSimulatorArgs(ndim, interp, **simInput))
extra_pops = {}
if "populations" in input:
for pop, vals in input["populations"].items():
if "populations" in simInput:
for pop, vals in simInput["populations"].items():
extra_pops[pop] = defaultPopulationSettings()
extra_pops[pop].update(vals)

model = makeBasicModel(extra_pops)
if "diags_fn" in input:
input["diags_fn"](model)
model = model_fn() if model_fn else makeBasicModel(extra_pops)
if diags_fn:
diags_fn(model)

ElectronModel(closure="isothermal", Te=0.12)
ph.ElectronModel(closure="isothermal", Te=0.12)

return simulation

Expand Down
77 changes: 0 additions & 77 deletions tests/simulator/test_python_concurrent.py

This file was deleted.

Loading

0 comments on commit 04d6f73

Please sign in to comment.