MADNESS 0.10.1
Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
madness::LoadBalanceDeux< NDIM > Class Template Reference

#include <lbdeux.h>

Collaboration diagram for madness::LoadBalanceDeux< NDIM >:
Collaboration graph
[legend]

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< NDIMkeyT
 
typedef LBNodeDeux< NDIMnodeT
 
typedef WorldContainer< keyT, nodeTtreeT
 

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
 
Worldworld
 

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()

template<std::size_t NDIM>
template<typename T , typename costT >
void madness::LoadBalanceDeux< NDIM >::add_tree ( const Function< T, NDIM > &  f,
const costT costfn,
bool  fence = false 
)
inline

◆ compare()

template<std::size_t NDIM>
static 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 madness::LoadBalanceDeux< NDIM >::load_balance().

◆ load_balance()

template<std::size_t NDIM>
std::shared_ptr< WorldDCPmapInterface< keyT > > madness::LoadBalanceDeux< NDIM >::load_balance ( double  fac = 1.0,
bool  printstuff = false 
)
inline

◆ 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 with total_cost >= 0 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 madness::WorldContainer< keyT, valueT, hashfunT >::begin(), c, madness::WorldContainer< keyT, valueT, hashfunT >::end(), madness::WorldGopInterface::fence(), madness::World::gop, madness::nonlinear_vector_solver(), p(), madness::World::rank(), madness::World::size(), madness::WorldGopInterface::sum(), madness::LoadBalanceDeux< NDIM >::tree, and madness::LoadBalanceDeux< NDIM >::world.

◆ print_tree()

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

◆ 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: