Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## latest

- Refactored interaction with preCICE and domain decomposition into `CouplingHandler`, `Profiler` and `DomainDecomposition` hierarchy [#289](https://github.com/precice/micro-manager/pull/289)
- Refactored and generalized the methods in `p2p.py`. Added `MPIHandler` to manage all MPI related aspects. [#287](https://github.com/precice/micro-manager/pull/287)
- Applied fixes for previously missed test cases due to #290 [#291](https://github.com/precice/micro-manager/pull/291)
- Fixed non-visible CI test cases on PR interface [#290](https://github.com/precice/micro-manager/pull/290)
Expand Down
4 changes: 2 additions & 2 deletions micro_manager/adaptivity/adaptivity_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
def create_adaptivity_calculator(
config,
sim_container,
participant,
profiler,
logger,
mpi,
micro_problem_cls,
Expand All @@ -28,7 +28,7 @@ def create_adaptivity_calculator(
return GlobalAdaptivityCalculator(
config,
sim_container,
participant,
profiler,
logger,
mpi,
micro_problem_cls,
Expand Down
38 changes: 17 additions & 21 deletions micro_manager/adaptivity/global_adaptivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from micro_manager.config import Config
from micro_manager.tools.logging_wrapper import Logger
from micro_manager.tools.mpi_handler import MPIHandler, MPI
from micro_manager.tools.profiling import Profiler
from micro_manager.micro_simulation import MicroSimulationClass
from micro_manager.model_manager import ModelManager
from micro_manager.interpolation import RBF_PU
Expand All @@ -24,7 +25,7 @@ def __init__(
self,
config: Config,
sim_container: SimulationContainer,
participant,
profiler: Profiler,
base_logger: Logger,
mpi: MPIHandler,
micro_problem_cls: MicroSimulationClass,
Expand All @@ -39,8 +40,8 @@ def __init__(
Object which has getter functions to get parameters defined in the configuration file.
sim_container : SimulationContainer
Simulation container object.
participant : object of class Participant
Object of the class Participant using which the preCICE API is called.
profiler : Profiler
Profiling object.
base_logger : object of class Logger
Logger object to log messages.
mpi : MPIHandler
Expand All @@ -61,7 +62,7 @@ def __init__(
)

self._interpolation = RBF_PU(base_logger, mpi)
self._precice_participant = participant
self._profiler = profiler

buffer_size = self._sim_container.global_num_sims**2
array_buffer, mpi_node = self._mpi.create_node_buffer(MPI.FLOAT, buffer_size)
Expand Down Expand Up @@ -225,24 +226,19 @@ def get_full_field_micro_output(
micro_output : list
List of dicts having individual output of each simulation. Active and inactive simulation outputs are entered.
"""
self._precice_participant.start_profiling_section(
with self._profiler.measure(
"micro_manager.global_adaptivity.get_full_field_micro_output"
)

micro_sims_output = deepcopy(micro_output)
num_active = np.sum(self._is_sim_active)
if num_active == self._is_sim_active.shape[0]:
self._precice_participant.stop_last_profiling_section()
return micro_sims_output

self._communicate_micro_output(micro_sims_output)
if num_active <= self._interp_min:
self._precice_participant.stop_last_profiling_section()
return micro_sims_output
):
micro_sims_output = deepcopy(micro_output)
num_active = np.sum(self._is_sim_active)
if num_active == self._is_sim_active.shape[0]:
return micro_sims_output

self._interpolate_output(micro_input, micro_sims_output)
self._communicate_micro_output(micro_sims_output)
if num_active <= self._interp_min:
return micro_sims_output

self._precice_participant.stop_last_profiling_section()
self._interpolate_output(micro_input, micro_sims_output)

return micro_sims_output

Expand Down Expand Up @@ -469,7 +465,7 @@ def _update_inactive_sims(self) -> None:
else:
to_be_activated_map[assoc_active_gid] = [to_be_activated_lid]

self._precice_participant.start_profiling_section(
self._profiler.begin(
"micro_manager.global_adaptivity.update_inactive_sims.communication"
)

Expand Down Expand Up @@ -512,7 +508,7 @@ def _update_inactive_sims(self) -> None:
self._sim_container[lid].destroy()
self._sim_container[lid] = None

self._precice_participant.stop_last_profiling_section()
self._profiler.end()

self._sim_is_associated_to = np.copy(_sim_is_associated_to_updated)

Expand Down
2 changes: 1 addition & 1 deletion micro_manager/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ def write_data_names(self) -> List[str]:
pass

@config_entry
def macro_domain_bounds(self) -> List[List[float]]:
def macro_domain_bounds(self) -> List[float]:
"""
Get the upper and lower bounds of the macro domain.

Expand Down
Loading