ug4
|
Parallel bisection partitioner. More...
#include <partitioner_dynamic_bisection.h>
Classes | |
struct | ElemList |
struct | Entry |
struct | TreeNode |
Public Types | |
typedef Grid::VertexAttachmentAccessor< apos_t > | aapos_t |
typedef Attachment< vector_t > | apos_t |
typedef IPartitioner | base_class |
typedef TElem | elem_t |
typedef GridLayoutMap::Types< elem_t >::Layout::LevelLayout | layout_t |
typedef TElem::side | side_t |
typedef MathVector< dim > | vector_t |
Public Member Functions | |
virtual ConstSPProcessHierarchy | current_process_hierarchy () const |
void | enable_longest_split_axis (bool enable) |
enables automatical determination of split-axis by longest geometry extension More... | |
void | enable_split_axis (int axis, bool enable) |
enable or disable splits along a certain axis. More... | |
void | enable_static_partitioning (bool enable) |
virtual SubsetHandler & | get_partitions () |
virtual const std::vector< int > * | get_process_map () const |
returns the processes map. Updated during partitioning. may be NULL. More... | |
virtual ConstSPProcessHierarchy | next_process_hierarchy () const |
int | num_split_improvement_iterations () const |
the maximum number of iterations performed to find a good split plane More... | |
virtual bool | partition (size_t baseLvl, size_t elementThreshold) |
Partitioner_DynamicBisection () | |
virtual void | set_balance_weights (SPBalanceWeights balanceWeights) |
void | set_grid (MultiGrid *mg, Attachment< MathVector< dim > > aPos) |
virtual void | set_next_process_hierarchy (SPProcessHierarchy procHierarchy) |
void | set_num_split_improvement_iterations (int num) |
virtual void | set_partition_post_processor (SPPartitionPostProcessor ppp) |
virtual void | set_partition_pre_processor (SPPartitionPreProcessor ppp) |
void | set_start_split_axis (int axis) |
sets the axis with which bisection is started. More... | |
void | set_subset_handler (SmartPtr< SubsetHandler > sh) |
allows to optionally specify a subset-handler on which the balancer shall operate More... | |
void | set_tolerance (number tol) |
sets the tolerance threshold. 1: no tolerance, 0: full tolerance. More... | |
bool | static_partitioning_enabled () const |
virtual bool | supports_balance_weights () const |
virtual bool | supports_connection_weights () const |
virtual bool | supports_repartitioning () const |
virtual | ~Partitioner_DynamicBisection () |
Public Member Functions inherited from ug::IPartitioner | |
IPartitioner () | |
virtual bool | problems_occurred () |
indicates whether problems occurred during the last partitioning More... | |
virtual void | set_communication_weights (SPCommunicationWeights commWeights) |
void | set_verbose (bool verbose) |
virtual bool | supports_communication_weights () const |
bool | verbose () const |
virtual | ~IPartitioner () |
virtual void | enable_clustered_siblings (bool bEnable) |
virtual bool | clustered_siblings_enabled () |
Private Types | |
enum | constants { UNCLASSIFIED = 0 , LEFT = 1 , RIGHT = 1 << 1 , CUTTING = LEFT | RIGHT , CUTTING_CENTER_LEFT , CUTTING_CENTER_RIGHT , TOTAL , NUM_CONSTANTS } |
Private Member Functions | |
void | bisect_elements (std::vector< TreeNode > &childNodesOut, std::vector< TreeNode > &parentNodes, ANumber aWeight, number maxChildWeight, pcl::ProcessCommunicator &com, int cutRecursion, int splitAxis) |
void | calculate_global_dimensions (std::vector< TreeNode > &treeNodes, number maxChildWeight, ANumber aWeight, pcl::ProcessCommunicator &com) |
int | classify_elem (elem_t *e, int splitAxis, number splitValue) |
void | control_bisection (ISubsetHandler &partitionSH, std::vector< TreeNode > &treeNodes, ANumber aWeight, number maxChildWeight, pcl::ProcessCommunicator &com) |
void | copy_partitions_to_children (ISubsetHandler &partitionSH, int lvl) |
void | gather_weights_from_level (int baseLvl, int childLvl, ANumber aWeight, bool copyToVMastersOnBaseLvl, bool markedElemsOnly) |
int | get_next_split_axis () |
returns the next valid split axis to m_lastSplitAxis. More... | |
int | get_next_split_axis (int lastAxis) const |
returns the next valid split axis to the specified one More... | |
void | improve_split_values (std::vector< TreeNode > &treeNodes, size_t maxIterations, ANumber aWeight, pcl::ProcessCommunicator &com) |
void | perform_bisection (int numTargetProcs, int minLvl, int maxLvl, int partitionLvl, ANumber aWeight, pcl::ProcessCommunicator com) |
Private Attributes | |
aapos_t | m_aaPos |
apos_t | m_aPos |
SPBalanceWeights | m_balanceWeights |
std::vector< Entry > | m_entries |
int | m_firstSplitAxisEnabled |
int | m_highestRedistLevel |
pcl::InterfaceCommunicator< layout_t > | m_intfcCom |
int | m_lastSplitAxis |
int | m_longestSplitAxisEnabled |
MultiGrid * | m_mg |
SPProcessHierarchy | m_nextProcessHierarchy |
int | m_numSplitAxisEnabled |
SPPartitionPostProcessor | m_partitionPostProcessor |
SPPartitionPreProcessor | m_partitionPreProcessor |
SPProcessHierarchy | m_processHierarchy |
std::vector< int > | m_procMap |
SmartPtr< SubsetHandler > | m_sh |
bool | m_splitAxisEnabled [dim] |
size_t | m_splitImproveIterations |
int | m_startSplitAxis |
bool | m_staticPartitioning |
number | m_tolerance |
Static Private Attributes | |
static const size_t | s_invalidIndex = -1 |
Additional Inherited Members | |
Protected Attributes inherited from ug::IPartitioner | |
bool | m_problemsOccurred |
Parallel bisection partitioner.
The partitioner can be used inside a LoadBalancer or separately. It can operate on serial and parallel multigrids.
The following partition hints provided by a process hierarchy are supported:
typedef Grid::VertexAttachmentAccessor<apos_t> ug::Partitioner_DynamicBisection< TElem, dim >::aapos_t |
typedef Attachment<vector_t> ug::Partitioner_DynamicBisection< TElem, dim >::apos_t |
typedef IPartitioner ug::Partitioner_DynamicBisection< TElem, dim >::base_class |
typedef TElem ug::Partitioner_DynamicBisection< TElem, dim >::elem_t |
typedef GridLayoutMap::Types<elem_t>::Layout::LevelLayout ug::Partitioner_DynamicBisection< TElem, dim >::layout_t |
typedef TElem::side ug::Partitioner_DynamicBisection< TElem, dim >::side_t |
typedef MathVector<dim> ug::Partitioner_DynamicBisection< TElem, dim >::vector_t |
|
private |
ug::Partitioner_DynamicBisection< TElem, dim >::Partitioner_DynamicBisection |
References dim, ug::Partitioner_DynamicBisection< TElem, dim >::m_balanceWeights, ug::Partitioner_DynamicBisection< TElem, dim >::m_numSplitAxisEnabled, ug::Partitioner_DynamicBisection< TElem, dim >::m_processHierarchy, ug::Partitioner_DynamicBisection< TElem, dim >::m_splitAxisEnabled, and make_sp().
|
virtual |
|
private |
if splitAxis is set to -1, then the split-axis is chosen for each node as the axis along which the geometry of the node has the longest extension.
References ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::add(), pcl::ProcessCommunicator::allreduce(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::bisectionComplete, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::boxMax, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::boxMin, ug::CalculateCenter(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::center, ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::clear(), dim, ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::elem(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::elems, ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::first(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::firstChildNode, GDIST_PROFILE_FUNC, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::maxSplitValue, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::minSplitValue, ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::next(), PCL_RO_SUM, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::ratioLeft, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::splitAxis, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::splitValue, and UG_THROW.
|
private |
References pcl::ProcessCommunicator::allreduce(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::boxMax, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::boxMin, ug::CalculateCenter(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::center, dim, ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::elem(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::elems, ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::first(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::firstChildNode, GDIST_PROFILE_FUNC, ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::next(), p, PCL_RO_MAX, PCL_RO_MIN, PCL_RO_SUM, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::totalWeight, ug::VecScaleAdd(), and ug::VecSet().
|
private |
|
private |
References ug::ISubsetHandler::assign_subset(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::bisectionComplete, ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::elem(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::elems, ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::first(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::firstChildNode, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::firstProc, GDIST_PROFILE_FUNC, ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::next(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::numTargetProcs, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::ratioLeft, and ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::set_entry_list().
|
private |
References ug::ISubsetHandler::assign_subset(), ug::MultiGrid::begin(), ug::Grid::distributed_grid_manager(), ug::MultiGrid::end(), GDIST_PROFILE_FUNC, ug::MultiGrid::get_child(), ug::GridLayoutMap::get_layout(), ug::ISubsetHandler::get_subset_index(), ug::DistributedGridManager::grid_layout_map(), ug::GridLayoutMap::has_layout(), ug::INT_V_MASTER, ug::INT_V_SLAVE, ug::Grid::is_parallel(), and ug::MultiGrid::num_children().
|
virtual |
Implements ug::IPartitioner.
|
inline |
enables automatical determination of split-axis by longest geometry extension
disabled by default
References ug::Partitioner_DynamicBisection< TElem, dim >::m_longestSplitAxisEnabled.
void ug::Partitioner_DynamicBisection< TElem, dim >::enable_split_axis | ( | int | axis, |
bool | enable | ||
) |
enable or disable splits along a certain axis.
By default, splits along all axis are enabled.
References dim.
|
virtual |
static partitioning should be used if a globally refined multigrid is is used throughout a simulation. Static partitioning drastically reduces global communication. The drawback is, that static partitioning e.g. can't be used to properly rebalance a distributed adaptive grid.
Reimplemented from ug::IPartitioner.
|
private |
References baseLvl, ug::MultiGrid::begin(), ug::IBalanceWeights::consider_in_level_above(), ug::Grid::distributed_grid_manager(), ug::MultiGrid::end(), GDIST_PROFILE_FUNC, ug::MultiGrid::get_child(), ug::GridLayoutMap::get_layout(), ug::IBalanceWeights::get_refined_weight(), ug::IBalanceWeights::get_weight(), ug::DistributedGridManager::grid_layout_map(), ug::GridLayoutMap::has_layout(), ug::IBalanceWeights::has_level_offsets(), ug::INT_V_MASTER, ug::INT_V_SLAVE, ug::DistributedGridManager::is_ghost(), ug::LIB_GRID, ug::MultiGrid::num_children(), ug::MultiGrid::num_levels(), ug::SetAttachmentValues(), and UG_DLOG.
|
private |
returns the next valid split axis to m_lastSplitAxis.
The method starts from m_startSplitAxis, cycling through all valid split axis.
|
private |
|
virtual |
Implements ug::IPartitioner.
References make_sp().
|
virtual |
returns the processes map. Updated during partitioning. may be NULL.
If NULL is returned, this means that each subset index correspons to a global proc-rank.
Implements ug::IPartitioner.
|
private |
References pcl::ProcessCommunicator::allreduce(), ug::CalculateCenter(), ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::elem(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::elems, ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::first(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::maxSplitValue, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::minSplitValue, ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::next(), PCL_RO_LAND, PCL_RO_SUM, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::ratioLeft, ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::splitAxis, and ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::splitValue.
|
virtual |
Implements ug::IPartitioner.
|
inline |
the maximum number of iterations performed to find a good split plane
References ug::Partitioner_DynamicBisection< TElem, dim >::m_splitImproveIterations.
|
virtual |
If the partitioner returns false, no partition-map has been created and no redistribution should be performed. Note, that returning false is not a sign of an error - it may even be a feature of a particular partitioner.
Implements ug::IPartitioner.
References pcl::ProcessCommunicator::allreduce(), ug::GridSubsetHandler::assign_subset(), ug::Grid::attach_to(), baseLvl, ug::MultiGrid::begin(), ug::ISubsetHandler::clear(), ug::ProcessHierarchy::cluster_procs(), ug::Grid::detach_from(), dim, ug::MultiGrid::end(), GDIST_PROFILE_FUNC, ug::ProcessHierarchy::global_proc_com(), ug::ProcessHierarchy::grid_base_level(), make_sp(), ug::ProcessHierarchy::num_global_procs_involved(), ug::ProcessHierarchy::num_hierarchy_levels(), ug::ISubsetHandler::num_subsets(), ug::ProcessHierarchy::partition_hint(), pcl::PCD_LOCAL, PCL_DEBUG_BARRIER_ALL, PCL_RO_MAX, pcl::ProcRank(), ug::Variant::to_bool(), ug::MultiGrid::top_level(), UG_COND_THROW, UG_LOG, and UG_THROW.
|
private |
References ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::add(), pcl::ProcessCommunicator::allreduce(), ug::GridSubsetHandler::assign_subset(), ug::MultiGrid::begin(), ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::clear(), ug::Grid::distributed_grid_manager(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::elems, pcl::ProcessCommunicator::empty(), ug::MultiGrid::end(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::firstProc, GDIST_PROFILE_FUNC, ug::GridLayoutMap::get_layout(), ug::ISubsetHandler::get_subset_index(), ug::DistributedGridManager::grid_layout_map(), ug::GridLayoutMap::has_layout(), ug::INT_V_MASTER, ug::INT_V_SLAVE, ug::DistributedGridManager::is_ghost(), ug::MultiGrid::num(), ug::Partitioner_DynamicBisection< TElem, dim >::TreeNode::numTargetProcs, PCL_RO_MAX, ug::Partitioner_DynamicBisection< TElem, dim >::ElemList::set_entry_list(), ug::SetAttachmentValues(), UG_ASSERT, and UG_COND_THROW.
|
virtual |
Reimplemented from ug::IPartitioner.
void ug::Partitioner_DynamicBisection< TElem, dim >::set_grid | ( | MultiGrid * | mg, |
Attachment< MathVector< dim > > | aPos | ||
) |
References ug::Grid::assign_grid().
|
virtual |
Implements ug::IPartitioner.
|
inline |
|
virtual |
Reimplemented from ug::IPartitioner.
|
virtual |
Reimplemented from ug::IPartitioner.
|
inline |
sets the axis with which bisection is started.
0 by default.
References ug::Partitioner_DynamicBisection< TElem, dim >::m_startSplitAxis.
|
virtual |
allows to optionally specify a subset-handler on which the balancer shall operate
Reimplemented from ug::IPartitioner.
|
inline |
sets the tolerance threshold. 1: no tolerance, 0: full tolerance.
the tolerance is defaulted to 0.99
References ug::Partitioner_DynamicBisection< TElem, dim >::m_tolerance.
bool ug::Partitioner_DynamicBisection< TElem, dim >::static_partitioning_enabled |
|
virtual |
Reimplemented from ug::IPartitioner.
|
virtual |
|
inlinevirtual |
Reimplemented from ug::IPartitioner.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |