Class LoadBalancer<DIM> provides load balancing routines for AMR hierarchy levels based on either uniform or non-uniform workload estimates.
More...
|
| | LoadBalancer (const LoadBalancer< DIM > &) |
| |
| void | operator= (const LoadBalancer< DIM > &) |
| |
| void | getFromInput (tbox::Pointer< tbox::Database > db) |
| |
| void | chopUniformSingleBox (hier::BoxArray< DIM > &out_boxes, tbox::Array< double > &out_workloads, const hier::Box< DIM > &in_box, const hier::IntVector< DIM > &min_size, const hier::IntVector< DIM > &max_size, const hier::IntVector< DIM > &cut_factor, const hier::IntVector< DIM > &bad_interval, const hier::BoxArray< DIM > &physical_domain) const |
| |
| void | chopBoxesWithUniformWorkload (hier::BoxArray< DIM > &out_boxes, tbox::Array< double > &out_workloads, const hier::BoxList< DIM > &in_boxes, const tbox::Pointer< hier::PatchHierarchy< DIM > > hierarchy, int level_number, const hier::IntVector< DIM > &min_size, const hier::IntVector< DIM > &max_size, const hier::IntVector< DIM > &cut_factor, const hier::IntVector< DIM > &bad_interval, const hier::BoxArray< DIM > &physical_domain) const |
| |
| void | chopBoxesWithNonuniformWorkload (hier::BoxArray< DIM > &out_boxes, tbox::Array< double > &out_workloads, const hier::BoxList< DIM > &in_boxes, const tbox::Pointer< hier::PatchHierarchy< DIM > > hierarchy, int level_number, const hier::IntVector< DIM > &ratio_to_coarsest_hierarchy_level, int wrk_indx, const hier::IntVector< DIM > &min_size, const hier::IntVector< DIM > &max_size, const hier::IntVector< DIM > &cut_factor, const hier::IntVector< DIM > &bad_interval, const hier::BoxArray< DIM > &physical_domain) const |
| |
| void | binPackBoxes (hier::BoxArray< DIM > &boxes, hier::ProcessorMapping &mapping, tbox::Array< double > &workloads, const std::string &bin_pack_method) const |
| |
| int | getWorkloadDataId (int level_number) const |
| |
| double | getMaxWorkloadFactor (int level_number) const |
| |
| double | getWorkloadTolerance (int level_number) const |
| |
| std::string | getBinPackMethod (int level_number) const |
| |
template<int DIM>
class SAMRAI::mesh::LoadBalancer< DIM >
This class is derived from the abstract base class LoadBalanceStrategy<DIM>; thus, it is a concrete implementation of the load balance Strategy pattern interface.
Load balancing operations, whether based on uniform or non-uniform workloads, can be specified for each level in the hierarchy individually or for the entire hierarchy. Basic load balance parameters can be set from an input file, while more complex behavior can be set at run-time via member functions, including dynamic reconfiguration of balance operations.
Required input keys: NONE
Optional input keys, data types, and defaults:
processor_layout Integer array (length = DIM) indicating the way in which the domain should be chopped when a level can be described as a single parallelepiped region (i.e., a box). If no input value is provided, or if the product of these entries does not equal the number of processors, then the processor layout computed will be computed from the dimensions of the domain box and the number of processors in use if necessary.
NOTE: The largest patch size constraint specified in the input for the GriddingAlgorithm<DIM> object takes precedence over the processor layout specification. That is, if the processor layout indicates that the resulting level patches would be larger than the largest patch size, the layout will be ignored and boxes obeying the patch size constrint will result.
- bin_pack_method String value indicating the type of bin packing to use to map patches to processors. Currently, two options are supported: "GREEDY", "SPATIAL". The "GREEDY" process simply maps each patch (box) to the first processor (bin), in ascending tbox::MPI process number, whose difference between the average workload and its current workload is less than the workload of the patch in question. The "SPATIAL" process first constructs an ordering of the patches (boxes) by passing a Morton-type curve through the center of each box. Then, it attempts to map the patches to processors by assigning patches that are near each other on the curve to the same processor. If no input value is specified, a default value of "SPATIAL" is used. The input value will be used for all levels and will remain so until reset via the setBinPackMethod() member function below.
- max_workload_factor Double array (length = number of levels) used during the box-splitting phase to determine which boxes to split. Specifically, boxes will be chopped if their estimated workload is greater than max_workload_factor * A, where A is the average workload (i.e., A = (total work)/(nume processors)). The default value for this parameter is 1.0. It can be set to any value greater than zero, either in the input file or via the setMaxWorkloadFactor() member function below.
Example input:
max_workload_factor = 0.8
Sets the workload factor to 0.8 for all levels.
max_worklaod_factor = 0.8 , 0.9
Sets the workload factor to 0.8 for level 0 and 0.9 for all other levels.
NOTE: If a length is less than max levels then finest value specified is use for finer levels. If length is greater than max levels, the values are ignored.
NOTE: Setting this value > 1.0 increases the splitting threshold which effectively reduces the total number of boxes generated. Setting it less than 1.0 decreases the splitting threshold and will generally increase the total number of boxes.
- workload_tolerance Double array (length = number of levels) used during the box-splitting phase to determine which boxes to split. The tolerance value can be use to prevent splitting of boxes when the computed box workload is close to the computed ideal workload. A box is split if:
( box_workload <= ( (1. + workload_tolerance) * ideal_workload ) )
Tolerance values should be greater than or equal to 0.0 and less then 1.0. Large values will probably have undesirable results. The default value for this parameter is 0.0. It can be set to either in the input file or via the setWorkloadTolerance() member function below.
NOTE: If a length is less than max levels then finest value specified is use for finer levels. If length is greater than max levels, the values are ignored.
- ignore_level_box_union_is_single_box Boolean flag to control chopping of level boxes when the union of the input boxes passed to the loadBalanceBoxes() routine is a single box. The default value is false, which means that the domain will be chopped to make patch boxes based on the (single box) union of the boxes describing the level regardless of the input boxes. When the value is set to true, either via the setIgnoreLevelDomainIsSingleBox() function or an input file, the domain will be chopped by chopping each of the input boxes.
A sample input file entry might look like:
*
* processor_layout = 4 , 4 , 4 // number of processors is 64
* bin_pack = "GREEDY"
* max_workload_factor = 0.9
* ignore_level_box_union_is_single_box = TRUE
*
*
- See also
- mesh::LoadBalanceStrategy