9 Inform the load balancing about the end of a grid sweep
11 Add this action set to every solver step that should drive the load
12 balancing. Its unprepareTraversal() calls finishStep() on the strategy
13 that is currently installed in
14 toolbox::loadbalancing::LoadBalancingService. As unprepareTraversal()
15 is invoked once per traversal per rank (and not per tree), the strategy
16 is informed exactly once after each grid sweep.
18 The action set does not install a strategy itself. Some other code, the
19 main routine typically, hands one over via
20 toolbox::loadbalancing::LoadBalancingService::setLoadBalancing(). If
21 no strategy is installed, i.e. getLoadBalancing() returns nullptr, the
22 action set does nothing.
24 If constructed with enable_load_balancing=True, the action set first
25 switches the strategy on (enable(true)) and then calls finishStep(). The
26 time stepping schemes use this variant in their last mesh sweep, as they
27 switch the load balancing off throughout the time step
28 (toolbox.loadbalancing.api.actionsets.ToggleLoadBalancing).
32 def __init__(self, enable_load_balancing: bool =
False):
35 @param enable_load_balancing: bool
36 Switch the load balancing on right before finishStep() is called.
39 super(LoadBalancing, self).
__init__(descend_invocation_order=0, parallel=
False)
53 " ::toolbox::loadbalancing::LoadBalancingService::getInstance().getLoadBalancing()->enable(true);\n"
58 if (::toolbox::loadbalancing::LoadBalancingService::getInstance().getLoadBalancing() != nullptr) {{
59{enable} ::toolbox::loadbalancing::LoadBalancingService::getInstance().getLoadBalancing()->finishStep();
67 return __name__.replace(
".py",
"").replace(
".",
"_")
77#include "toolbox/loadbalancing/AbstractLoadBalancing.h"
78#include "toolbox/loadbalancing/LoadBalancingService.h"
Inform the load balancing about the end of a grid sweep.
get_action_set_name(self)
Return unique action set name.
get_body_of_operation(self, operation_name)
Return actual C++ code snippets to be inserted into C++ code.
get_body_of_unprepareTraversal(self)
get_body_of_prepareTraversal(self)
__init__(self, bool enable_load_balancing=False)
get_destructor_body(self)
get_includes(self)
Return include statements that you need.
get_constructor_body(self)
Define a tailored constructor body.
user_should_modify_template(self)
Is the user allowed to modify the output.
get_attributes(self)
Return attributes as copied and pasted into the generated class.
Action set (reactions to events)