Peano
Loading...
Searching...
No Matches
grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric Class Reference

Load balancing metric which assigns each cell a value. More...

Inheritance diagram for grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric:
Collaboration diagram for grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric:

Public Member Functions

 __init__ (self, load_balancing_cell_label, initialisation_weight="1.0")
 
 get_action_set_name (self)
 Return unique action set name.
 
 user_should_modify_template (self)
 Is the user allowed to modify the output.
 
 get_body_of_operation (self, operation_name)
 Return actual C++ code snippets to be inserted into C++ code.
 
 get_attributes (self)
 Return attributes as copied and pasted into the generated class.
 
 get_constructor_body (self)
 Define a tailored constructor body.
 
 get_includes (self)
 Return include statements that you need.
 
 create_cell_label (exahype2_project, name="LoadBalancingCostMetric")
 Create a cell label that's then used for the load balancing.
 
- Public Member Functions inherited from peano4.api.solversteps.ActionSet.ActionSet
 get_static_initialisations (self, full_qualified_classname)
 
 get_destructor_body (self)
 
 get_body_of_createGridControlEventsForNextTraversal (self)
 Return the grid control events that this action set wants to trigger.
 
 get_implementation_of_createGridControlEventsForNextTraversal (self)
 Return the C++ implementation of createGridControlEventsForNextTraversal()
 
 get_body_of_prepareTraversal (self)
 
 get_implementation_of_prepareTraversal (self)
 Return the C++ implementation of prepareTraversal()
 
 get_body_of_unprepareTraversal (self)
 
 get_implementation_of_unprepareTraversal (self)
 Return the C++ implementation of unprepareTraversal()
 
 get_guard_of_operation (self, operation_name)
 Return the guard of an operation.
 
 get_implementation_of_operation (self, operation_name)
 Return the C++ implementation of an operation.
 
bool may_run_in_background_task (self)
 May a task graph compiler move touchCellFirstTime() into a task.
 

Data Fields

 load_balancing_cell_label
 
 initialisation_weight
 
- Data Fields inherited from peano4.api.solversteps.ActionSet.ActionSet
 descend_invocation_order
 
 parallel
 

Additional Inherited Members

- Static Public Attributes inherited from peano4.api.solversteps.ActionSet.ActionSet
int descend_invocation_order = 0
 
bool parallel = False
 
str OPERATION_BEGIN_TRAVERSAL = "beginTraversal"
 
str OPERATION_END_TRAVERSAL = "endTraversal"
 
str OPERATION_CREATE_PERSISTENT_VERTEX = "createPersistentVertex"
 
str OPERATION_DESTROY_PERSISTENT_VERTEX = "destroyPersistentVertex"
 
str OPERATION_CREATE_HANGING_VERTEX = "createHangingVertex"
 
str OPERATION_DESTROY_HANGING_VERTEX = "destroyHangingVertex"
 
str OPERATION_CREATE_PERSISTENT_FACE = "createPersistentFace"
 
str OPERATION_DESTROY_PERSISTENT_FACE = "destroyPersistentFace"
 
str OPERATION_CREATE_HANGING_FACE = "createHangingFace"
 
str OPERATION_DESTROY_HANGING_FACE = "destroyHangingFace"
 
str OPERATION_CREATE_CELL = "createCell"
 
str OPERATION_DESTROY_CELL = "destroyCell"
 
str OPERATION_TOUCH_VERTEX_FIRST_TIME = "touchVertexFirstTime"
 
str OPERATION_TOUCH_VERTEX_LAST_TIME = "touchVertexLastTime"
 
str OPERATION_TOUCH_FACE_FIRST_TIME = "touchFaceFirstTime"
 
str OPERATION_TOUCH_FACE_LAST_TIME = "touchFaceLastTime"
 
str OPERATION_TOUCH_CELL_FIRST_TIME = "touchCellFirstTime"
 
str OPERATION_TOUCH_CELL_LAST_TIME = "touchCellLastTime"
 

Detailed Description

Load balancing metric which assigns each cell a value.

To use this metric, you have to do a couple of steps:

  1. Create a new label via create_cell_label(). Capture the result object.
  2. Create a new instance of this class.
  3. Add the metric to the algorithmic step of your choice. A typical set is
    project.add_action_set_to_create_grid( load_balancing_action_set )

So overall, a typical use looks similar to:

load_balancing_cell_label = exahype2.grid.FineGridCellLoadBalancingCostMetric.create_cell_label(project)
load_balancing_action_set = exahype2.grid.FineGridCellLoadBalancingCostMetric(load_balancing_cell_label)
project.add_action_set_to_create_grid( load_balancing_action_set )
project.set_load_balancing(
"toolbox::loadbalancing::strategies::cascade::SpreadOut_SplitOversizedTree",
"new ::exahype2::LoadBalancingConfiguration(0.98, 1, " + str(args.trees) + "), new toolbox::loadbalancing::metrics::CustomCellWeight()",
)

Definition at line 11 of file FineGridCellLoadBalancingCostMetric.py.

Constructor & Destructor Documentation

◆ __init__()

grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric.__init__ (   self,
  load_balancing_cell_label,
  initialisation_weight = "1.0" 
)

Member Function Documentation

◆ create_cell_label()

grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric.create_cell_label (   exahype2_project,
  name = "LoadBalancingCostMetric" 
)

Create a cell label that's then used for the load balancing.

Definition at line 96 of file FineGridCellLoadBalancingCostMetric.py.

◆ get_action_set_name()

grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric.get_action_set_name (   self)

Return unique action set name.

Returns a description (word) for the mapping which is also used as class name for the generated type. As a consequence, the result should be one word (if possible) and uppercase. Also, every subclass should overwrite this routine.

The generator will take the result and construct eventually classes similar to MyStep2Dummy.h and MyStep2Dummy.cpp or similar for the example below, where we return Dummy.

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 49 of file FineGridCellLoadBalancingCostMetric.py.

◆ get_attributes()

grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric.get_attributes (   self)

Return attributes as copied and pasted into the generated class.

Please note that action sets are not persistent, i.e. there is one object creation per grid sweep per tree.

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 77 of file FineGridCellLoadBalancingCostMetric.py.

◆ get_body_of_operation()

grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric.get_body_of_operation (   self,
  operation_name 
)

Return actual C++ code snippets to be inserted into C++ code.

See class' string constants starting with OPERATION_ for possible values of operation_name. The snippet is executed if and only if the guard returned by get_guard_of_operation() holds, i.e. the body should not evaluate the guard itself. See the section "Guard and body" in the class documentation.

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 57 of file FineGridCellLoadBalancingCostMetric.py.

References grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric.initialisation_weight, and grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric.load_balancing_cell_label.

Referenced by peano4.api.solversteps.ActionSet.ActionSet.get_implementation_of_operation().

Here is the caller graph for this function:

◆ get_constructor_body()

grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric.get_constructor_body (   self)

Define a tailored constructor body.

By default, the constructor of an action set is empty. If you you assign attributes to your action set, you however might want to initialise them here. We do not support initialisation lists, to all has to be done via setters unless you create attributes on the heap.

The constructor's signature will look similar to

   EnumerateAndInitSolution2petsc_actionsets_InitVertexDoFs0(int treeNumber);

where the treeNumber is -1 if this is the global instance of the action set owned by a rank, or a number greater or equal 0 if this action set is a clone of the glocal action set that's used by one tree traversal.

See also
get_attributes() to add attributes to your action set

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 83 of file FineGridCellLoadBalancingCostMetric.py.

◆ get_includes()

grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric.get_includes (   self)

Return include statements that you need.

All of these includes will eventually end up in the header of the generated C++ code.

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 89 of file FineGridCellLoadBalancingCostMetric.py.

◆ user_should_modify_template()

grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric.user_should_modify_template (   self)

Is the user allowed to modify the output.

Return whether you expect the user to modify the generated code. If this is the case, then the API places the generated output in the directory actions. Otherwise, it goes into the observer directory and will be overwritten in each and every Python run.

Reimplemented from peano4.api.solversteps.ActionSet.ActionSet.

Definition at line 53 of file FineGridCellLoadBalancingCostMetric.py.

Field Documentation

◆ initialisation_weight

grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric.initialisation_weight

◆ load_balancing_cell_label

grid.FineGridCellLoadBalancingCostMetric.FineGridCellLoadBalancingCostMetric.load_balancing_cell_label

The documentation for this class was generated from the following file: