MADNESS 0.10.1
madness::LoadBalanceDeux< NDIM > Class Template Reference

#include <lbdeux.h>

Collaboration diagram for madness::LoadBalanceDeux< NDIM >:

Classes

struct  add_op
struct  CostPerProc

Public Member Functions

 LoadBalanceDeux (World &world)
template<typename T, typename costT>
void add_tree (const Function< T, NDIM > &f, const costT &costfn, bool fence=false)
 Accumulates cost from a function.
std::shared_ptr< WorldDCPmapInterface< keyT > > load_balance (double fac=1.0, bool printstuff=false)
 Actually does the partitioning of the tree.
void print_cost_per_rank (const std::string &label, const std::shared_ptr< WorldDCPmapInterface< keyT > > &pmap, std::ostream &os=std::cout)
void print_tree (const keyT &key=keyT(0))
 Printing for the curious.

Private Types

typedef treeT::const_iterator const_iteratorT
typedef treeT::iterator iteratorT
typedef Key< NDIM > keyT
typedef LBNodeDeux< NDIM > nodeT
typedef WorldContainer< keyT, nodeT > treeT

Private Member Functions

double sum ()
 Sums costs up the tree returning to everyone the total cost.

Static Private Member Functions

static bool compare (const std::pair< keyT, double > &a, const std::pair< keyT, double > &b)
 Used to sort results into descending order.

Private Attributes

treeT tree
World & world

Member Typedef Documentation

◆ const_iteratorT

template<std::size_t NDIM>
typedef treeT::const_iterator madness::LoadBalanceDeux< NDIM >::const_iteratorT
private

◆ iteratorT

template<std::size_t NDIM>
typedef treeT::iterator madness::LoadBalanceDeux< NDIM >::iteratorT
private

◆ keyT

template<std::size_t NDIM>
typedef Key<NDIM> madness::LoadBalanceDeux< NDIM >::keyT
private

◆ nodeT

template<std::size_t NDIM>
typedef LBNodeDeux<NDIM> madness::LoadBalanceDeux< NDIM >::nodeT
private

◆ treeT

template<std::size_t NDIM>
typedef WorldContainer<keyT,nodeT> madness::LoadBalanceDeux< NDIM >::treeT
private

Constructor & Destructor Documentation

◆ LoadBalanceDeux()

template<std::size_t NDIM>
madness::LoadBalanceDeux< NDIM >::LoadBalanceDeux ( World & world)
inline

Member Function Documentation

◆ add_tree()

◆ compare()

template<std::size_t NDIM>
bool madness::LoadBalanceDeux< NDIM >::compare ( const std::pair< keyT, double > & a,
const std::pair< keyT, double > & b )
inlinestaticprivate

Used to sort results into descending order.

References a, and b.

Referenced by load_balance().

◆ load_balance()

◆ print_cost_per_rank()

template<std::size_t NDIM>
void madness::LoadBalanceDeux< NDIM >::print_cost_per_rank ( const std::string & label,
const std::shared_ptr< WorldDCPmapInterface< keyT > > & pmap,
std::ostream & os = std::cout )
inline

Per-rank cost bar chart under the given pmap.

Walks the aggregator tree locally; each entry that is not deleted contributes its total_cost to bucket pmap->owner(key). Buckets are summed across ranks and rank 0 prints a horizontal bar chart with total/avg/max/avg/max/min ratios.

Call BEFORE load_balance() with the old pmap to see the per-key distribution that the partitioner is about to act on; call AFTER with the returned pmap to see how the bin-packed subtrees fell out. Both invocations sum to the same total work, so the bars are directly comparable.

References c, madness::FunctionDefaults< NDIM >::pmap, nproc, p(), tree, and world.

◆ print_tree()

template<std::size_t NDIM>
void madness::LoadBalanceDeux< NDIM >::print_tree ( const keyT & key = keyT(0))
inline

Printing for the curious.

References madness::Future< T >::get(), madness::print(), print_tree(), and tree.

Referenced by print_tree().

◆ sum()

template<std::size_t NDIM>
double madness::LoadBalanceDeux< NDIM >::sum ( )
inlineprivate

Member Data Documentation

◆ tree

template<std::size_t NDIM>
treeT madness::LoadBalanceDeux< NDIM >::tree
private

◆ world

template<std::size_t NDIM>
World& madness::LoadBalanceDeux< NDIM >::world
private

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