|
Peano
|
Functions | |
| assign_trees_to_ranks_round_Robin (int number_of_subtrees, int max_ranks) | |
| Take the trees and assign them to the ranks in a round-robin fashion. | |
| _format_initialisation_lists (parent_trees, subpartition_sizes, destination_ranks) | |
| Turn the enumerated splits into the C++ initialiser lists of Hardcoded. | |
| _markers_from_flags (bottom_up_flags) | |
| Translate the per-split flags of extract_split_instructions() into markers. | |
| _normalise_markers (modes, number_of_splits) | |
| Turn the user's modes argument into one marker per split. | |
| _format_modes (markers) | |
| Turn the markers into the C++ mode argument of Hardcoded. | |
| _normalise_destination_ranks (destination_ranks, subtrees) | |
| Normalise destination rank input to one rank per split instruction. | |
| _validate_round_robin (subtrees, destination_ranks, number_of_ranks=None) | |
| Ensure that the subtrees are assigned to the ranks round robin. | |
| tuple[str, str] | create_constructor_initialisation_string ("Tree" peano_tree, list[int] destination_ranks, bool verbose=False, modes=None, int|None number_of_ranks=None) |
| Construct the constructor arguments for an instance of Hardcoded. | |
Variables | |
| str | TopDown = "top-down" |
| str | BottomUp = "bottom-up" |
| dict | _CppModes |
|
protected |
Turn the enumerated splits into the C++ initialiser lists of Hardcoded.
Entry k of each list describes the kth split.
| parent_trees | [int] Tree which splits in the kth split. |
| subpartition_sizes | [int] Number of cells that the kth split hands over. |
| destination_ranks | [int] Rank which receives the new tree of the kth split. |
Definition at line 41 of file Hardcoded.py.
Referenced by api.output.Hardcoded.create_constructor_initialisation_string().

|
protected |
Turn the markers into the C++ mode argument of Hardcoded.
The result is a single mode if all splits share the same mode, and an initialiser list with one mode per split otherwise.
| markers | [str] One marker per split. |
Definition at line 117 of file Hardcoded.py.
Referenced by api.output.Hardcoded.create_constructor_initialisation_string().

|
protected |
Translate the per-split flags of extract_split_instructions() into markers.
| bottom_up_flags | [bool] True means that the corresponding split is a bottom-up split. |
Definition at line 75 of file Hardcoded.py.
Referenced by api.output.Hardcoded.create_constructor_initialisation_string().

|
protected |
Normalise destination rank input to one rank per split instruction.
Accepted input formats:
Definition at line 134 of file Hardcoded.py.
Referenced by api.output.Hardcoded.create_constructor_initialisation_string().

|
protected |
Turn the user's modes argument into one marker per split.
| modes | str or [str] Either a single marker which holds for all splits, or a sequence with one marker per split. Each marker is TopDown ("top-down") or BottomUp ("bottom-up"). |
| number_of_splits | int Number of splits that the markers have to describe. |
Definition at line 85 of file Hardcoded.py.
Referenced by api.output.Hardcoded.create_constructor_initialisation_string().

|
protected |
Ensure that the subtrees are assigned to the ranks round robin.
Peano's tree numbers encode the rank which hosts a tree: peano4::parallel::Node::getId() gives the nth tree on rank r the number n*R+r for R ranks, and peano4::parallel::Node::getRank() hence maps tree number t onto rank tR. The offline plan refers to the trees through its subtree numbers, i.e. a split of subtree s is meant to split the tree with number s in Peano. This only holds if subtree s lives on rank sR, which is exactly what assign_trees_to_ranks_round_Robin() yields.
| subtrees | [int] Subtree created by the kth split. |
| destination_ranks | [int] Rank which receives the subtree of the kth split. |
| number_of_ranks | int or None Number of ranks R. None derives R from the largest destination rank. |
Definition at line 159 of file Hardcoded.py.
Referenced by api.output.Hardcoded.create_constructor_initialisation_string().

| api.output.Hardcoded.assign_trees_to_ranks_round_Robin | ( | int | number_of_subtrees, |
| int | max_ranks | ||
| ) |
Take the trees and assign them to the ranks in a round-robin fashion.
Round robin is the only assignment that the offline load balancing supports, as Peano numbers its trees round robin, too: Tree t always lives on rank tR for R ranks. See _validate_round_robin() and the documentation of toolbox::loadbalancing::strategies::Hardcoded.
Note that we implicitly assume that the first tree remains on rank 0, so we really only assign number_of_subtrees-1 entries.
Definition at line 18 of file Hardcoded.py.
| tuple[str, str] api.output.Hardcoded.create_constructor_initialisation_string | ( | "Tree" | peano_tree, |
| list[int] | destination_ranks, | ||
| bool | verbose = False, |
||
modes = None, |
|||
| int | None | number_of_ranks = None |
||
| ) |
Construct the constructor arguments for an instance of Hardcoded.
The routine extracts the enumerated splits from the split tree, i.e. a sequence of splits where the kth split reads "tree t hands n cells over to a new tree on rank r and uses mode m to select these cells". toolbox::loadbalancing::strategies::Hardcoded decides itself when it issues the kth split.
By default, the mode of each split is inferred (see image below):
AggressiveTopDown: all subtrees assigned to rank k start on the same level l.BottomUp: subtrees assigned to rank k start on different levels.
You can overwrite the inferred modes through modes.
| peano_tree | toolbox.loadbalancing.api.Tree.Tree Tree after the split, i.e. after SplitTrees.split_tree(). |
| destination_ranks | [int] Either one rank per split or one rank per subtree excluding subtree 0. |
| verbose | bool Print the extracted splits. |
| modes | None, str or [str] None infers the mode of each split. Otherwise, pass a single marker TopDown ("top-down") or BottomUp ("bottom-up") which holds for all splits, or a sequence with one marker per split. |
| number_of_ranks | int or None Number of MPI ranks. None derives it from the largest destination rank. See _validate_round_robin() for why we need it. |
(hardcoded_config, hardcoded_mode) where hardcoded_config is the complete constructor argument string and hardcoded_mode is the mode argument within this string. Definition at line 193 of file Hardcoded.py.
References api.output.Hardcoded._format_initialisation_lists(), api.output.Hardcoded._format_modes(), api.output.Hardcoded._markers_from_flags(), api.output.Hardcoded._normalise_destination_ranks(), api.output.Hardcoded._normalise_markers(), and api.output.Hardcoded._validate_round_robin().

|
protected |
Definition at line 12 of file Hardcoded.py.
| str api.output.Hardcoded.BottomUp = "bottom-up" |
Definition at line 10 of file Hardcoded.py.
| str api.output.Hardcoded.TopDown = "top-down" |
Definition at line 9 of file Hardcoded.py.