DistributionMapping Class Reference

: Calculates the distribution of FABs to processors. More...

#include <DistributionMapping.H>

Collaboration diagram for DistributionMapping:

Collaboration graph
[legend]

List of all members.

Public Types

enum  Strategy { ROUNDROBIN, KNAPSACK }
 The distribution strategy: ROUNDROBIN or KNAPSACK. More...

Public Member Functions

 DistributionMapping ()
 The default constructor.
 DistributionMapping (const BoxArray &boxes, int nprocs)
 Build mapping out of BoxArray over nprocs processors.
 DistributionMapping (const DistributionMapping &d1, const DistributionMapping &d2)
 DistributionMapping (const BoxArray &boxes, int nprocs, int *procmapping)
 ~DistributionMapping ()
 The destructor.
void define (const BoxArray &boxes, int nprocs)
 Build mapping out of BoxArray over nprocs processors.
const Array< int > & ProcessorMap () const
 Returns a constant reference to the mapping of boxes in the underlying BoxArray to the CPU that holds the FAB on that Box.
int operator[] (int index) const
 Equivalent to ProcessorMap()[index].
bool operator== (const DistributionMapping &rhs) const
 Are the distributions equal?
bool operator!= (const DistributionMapping &rhs) const
 Are the distributions different?
void RoundRobinProcessorMap (int nboxes, int nprocs)
void KnapSackProcessorMap (const std::vector< long > &boxes, int nprocs)

Static Public Member Functions

static void strategy (Strategy how)
 Set distribution strategy.
static Strategy strategy ()
 Returns the distribution strategy.
static void FlushCache ()
 Flush the cache of processor maps.
static int CacheSize ()
 The size of the cache.
static void AddToCache (const DistributionMapping &dm)
 Append the ProcMap to the Cache. Checks for consistency.
static void CacheStats (std::ostream &os)
 Output some simple cache statistics.
static void Initialize ()
static void Finalize ()


Detailed Description

: Calculates the distribution of FABs to processors.

This class calculates the distribution of FABs to processors in a FabArray in a multi-processor environment. By distribution is meant what CPU in the multi-processor environment owns what FAB. Only the BoxArray on which the FabArray is built is used in determining the distribution. The two types of distributions supported are round-robin and knapsack. In the round-robin distribution FAB `i' is owned by CPU `iN' where N is total number of CPUs. In the knapsack distribution the FABs are partitioned across CPUs such that the total volume of the Boxes in the underlying BoxArray are as equal across CPUs as is possible.


Member Enumeration Documentation

The distribution strategy: ROUNDROBIN or KNAPSACK.

Enumerator:
ROUNDROBIN 
KNAPSACK 


Constructor & Destructor Documentation

DistributionMapping::DistributionMapping (  ) 

The default constructor.

DistributionMapping::DistributionMapping ( const BoxArray boxes,
int  nprocs 
)

Build mapping out of BoxArray over nprocs processors.

References define().

DistributionMapping::DistributionMapping ( const DistributionMapping d1,
const DistributionMapping d2 
)

DistributionMapping::DistributionMapping ( const BoxArray boxes,
int  nprocs,
int *  procmapping 
)

DistributionMapping::~DistributionMapping (  ) 

The destructor.


Member Function Documentation

void DistributionMapping::define ( const BoxArray boxes,
int  nprocs 
)

Build mapping out of BoxArray over nprocs processors.

You need to call this if you built your DistributionMapping with the default constructor.

References ROUNDROBIN, BoxArray::size(), and Array< T >::size().

Referenced by FabArray< FAB >::define(), and DistributionMapping().

const Array< int > & DistributionMapping::ProcessorMap (  )  const

Returns a constant reference to the mapping of boxes in the underlying BoxArray to the CPU that holds the FAB on that Box.

ProcessorMap()[i] is an integer in the interval [0, NCPU) where NCPU is the number of CPUs being used.

Referenced by AddToCache(), DistributionMapping(), VisMF::Header::Header(), operator<<(), and VisMF::Write().

int DistributionMapping::operator[] ( int  index  )  const

Equivalent to ProcessorMap()[index].

void DistributionMapping::strategy ( DistributionMapping::Strategy  how  )  [static]

Set distribution strategy.

References BoxLib::Error(), KNAPSACK, KnapSackProcessorMap(), ROUNDROBIN, and RoundRobinProcessorMap().

DistributionMapping::Strategy DistributionMapping::strategy (  )  [static]

Returns the distribution strategy.

Referenced by Initialize().

void DistributionMapping::FlushCache (  )  [static]

Flush the cache of processor maps.

The processor map cache is only flushed manually. Only call this after a regridding before new MultiFabs are alloc()d.

int DistributionMapping::CacheSize (  )  [static]

The size of the cache.

void DistributionMapping::AddToCache ( const DistributionMapping dm  )  [static]

Append the ProcMap to the Cache. Checks for consistency.

References BL_ASSERT, ParallelDescriptor::MyProc(), ProcessorMap(), and Array< T >::size().

void DistributionMapping::CacheStats ( std::ostream &  os  )  [static]

Output some simple cache statistics.

bool DistributionMapping::operator== ( const DistributionMapping rhs  )  const

Are the distributions equal?

References m_procmap.

Referenced by operator!=().

bool DistributionMapping::operator!= ( const DistributionMapping rhs  )  const

Are the distributions different?

References operator==().

void DistributionMapping::RoundRobinProcessorMap ( int  nboxes,
int  nprocs 
)

void DistributionMapping::KnapSackProcessorMap ( const std::vector< long > &  boxes,
int  nprocs 
)

void DistributionMapping::Initialize (  )  [static]

void DistributionMapping::Finalize (  )  [static]

Referenced by BoxLib::Finalize().


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

Generated on Fri Nov 21 10:11:01 2008 for AMRParticlePaths by  doxygen 1.5.5