Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends

LibGeoDecomp::StripingSimulator< CELL_TYPE > Class Template Reference

This class aims at providing a very simple, but working parallel simulation facility. More...

#include <stripingsimulator.h>

Inherits LibGeoDecomp::DistributedSimulator< CELL_TYPE >.

Collaboration diagram for LibGeoDecomp::StripingSimulator< CELL_TYPE >:
Collaboration graph
[legend]

List of all members.

Public Types

enum  WaitTags { GENERAL, BALANCELOADS, GHOSTREGION_ALPHA, GHOSTREGION_BETA }
typedef DistributedSimulator
< CELL_TYPE >::Topology 
Topology
typedef LoadBalancer::WeightVec WeightVec
typedef LoadBalancer::LoadVec LoadVec
typedef DisplacedGrid
< CELL_TYPE, Topology
GridType
typedef Steerer< CELL_TYPE >
::SteererFeedback 
SteererFeedback

Public Member Functions

 StripingSimulator (Initializer< CELL_TYPE > *initializer, LoadBalancer *balancer=0, const unsigned &loadBalancingPeriod=1)
virtual ~StripingSimulator ()
virtual void step ()
 performs a single simulation step.
virtual void run ()
 performs step() until the maximum number of steps is reached.
const unsignedgetLoadBalancingPeriod () const
std::vector< ChronometergatherStatistics ()
 Returns histograms which detail how much execution time was spent on which part of the algorithm.

Static Public Attributes

static const int DIM = Topology::DIM
static const bool WRAP_EDGES = Topology::template WrapsAxis<DIM - 1>::VALUE

Private Member Functions

void swapGrids ()
WeightVec partition (unsigned gridHeight, unsigned size) const
 "partition()[i]" is the first row for which node i is responsible, "partition()[i + 1] - 1" is the last one.
void balanceLoad ()
 the methods below are just used to structurize the step() method.
void nanoStep (const unsigned &nanoStep)
void waitForGhostRegions ()
void setIORegions ()
void handleInput (SteererEvent event)
void handleOutput (WriterEvent event)
CoordBox< DIMboundingBox (const unsigned &start, const unsigned &end)
 returns a bounding box with the same dimensions as the whole grid, but the most significant dimension (z in the 3d case or y in the 2d case) runs from start to end.
void updateRegion (const Region< DIM > &region, const unsigned &nanoStep)
void updateInnerGhostRegion (const unsigned &nanoStep)
 the methods below are just used to structurize the nanoStep() method.
void recvOuterGhostRegion (GridType *stripe)
void sendInnerGhostRegion (GridType *stripe)
void updateInside (const unsigned &nanoStep)
Region< DIMfillRegion (const int &startRow, const int &endRow)
void initRegions (const int &startRow, const int &endRow)
void initSimulation ()
 reset initial simulation state, useful after creation and at run()
CoordBox< DIMadaptDimensions (const WeightVec &newPartitions)
 resets various sizes, heights etc.
int lowerNeighbor () const
int upperNeighbor () const
WeightVec partitionsToWorkloads (const WeightVec &partitions) const
WeightVec workloadsToPartitions (const WeightVec &workloads) const
void redistributeGrid (const WeightVec &oldPartitions, const WeightVec &newPartitions)
void validateLoads (const WeightVec &newLoads, const WeightVec &oldLoads) const
 ensures that newLoads and oldLoads have the same size and that the sums of their elements match.
Coord< DIMgridDimensions () const

Private Attributes

MPILayer mpilayer
boost::shared_ptr< LoadBalancerbalancer
unsigned ghostHeightLower
 we need to distinguish four types of rims:

  • the inner rim is sent to neighboring nodes (and lies whithin our own stripe)
  • the outer rim is received from them (and is appended beneath/above our stripe)
  • the lower rim is located at the lower edge of our stripe (where the absolute value of the y-coordinates are higher),
  • the upper rim conversely is at the upper edge (smaller coordinate values)

unsigned ghostHeightUpper
GridTypecurStripe
GridTypenewStripe
Region< DIMregion
Region< DIMinnerRegion
Region< DIMinnerUpperGhostRegion
Region< DIMinnerLowerGhostRegion
Region< DIMouterUpperGhostRegion
Region< DIMouterLowerGhostRegion
Region< DIMregionWithOuterGhosts
WeightVec partitions
unsigned loadBalancingPeriod

Friends

class StripingSimulatorTest
class ParallelStripingSimulatorTest

Detailed Description

template<typename CELL_TYPE>
class LibGeoDecomp::StripingSimulator< CELL_TYPE >

This class aims at providing a very simple, but working parallel simulation facility.

It's not very modular, it's not fast, but it's simple and it actually works.


Member Typedef Documentation

template<typename CELL_TYPE >
typedef DisplacedGrid<CELL_TYPE, Topology> LibGeoDecomp::StripingSimulator< CELL_TYPE >::GridType
template<typename CELL_TYPE >
typedef LoadBalancer::LoadVec LibGeoDecomp::StripingSimulator< CELL_TYPE >::LoadVec
template<typename CELL_TYPE >
typedef Steerer<CELL_TYPE>::SteererFeedback LibGeoDecomp::StripingSimulator< CELL_TYPE >::SteererFeedback
template<typename CELL_TYPE >
typedef DistributedSimulator<CELL_TYPE>::Topology LibGeoDecomp::StripingSimulator< CELL_TYPE >::Topology
template<typename CELL_TYPE >
typedef LoadBalancer::WeightVec LibGeoDecomp::StripingSimulator< CELL_TYPE >::WeightVec

Member Enumeration Documentation

template<typename CELL_TYPE >
enum LibGeoDecomp::StripingSimulator::WaitTags
Enumerator:
GENERAL 
BALANCELOADS 
GHOSTREGION_ALPHA 
GHOSTREGION_BETA 

Constructor & Destructor Documentation

template<typename CELL_TYPE >
LibGeoDecomp::StripingSimulator< CELL_TYPE >::StripingSimulator ( Initializer< CELL_TYPE > *  initializer,
LoadBalancer balancer = 0,
const unsigned loadBalancingPeriod = 1 
) [inline, explicit]
template<typename CELL_TYPE >
virtual LibGeoDecomp::StripingSimulator< CELL_TYPE >::~StripingSimulator (  )  [inline, virtual]

Member Function Documentation

template<typename CELL_TYPE >
CoordBox<DIM> LibGeoDecomp::StripingSimulator< CELL_TYPE >::adaptDimensions ( const WeightVec newPartitions  )  [inline, private]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::balanceLoad (  )  [inline, private]
template<typename CELL_TYPE >
CoordBox<DIM> LibGeoDecomp::StripingSimulator< CELL_TYPE >::boundingBox ( const unsigned start,
const unsigned end 
) [inline, private]

returns a bounding box with the same dimensions as the whole grid, but the most significant dimension (z in the 3d case or y in the 2d case) runs from start to end.

References LibGeoDecomp::StripingSimulator< CELL_TYPE >::DIM, LibGeoDecomp::StripingSimulator< CELL_TYPE >::gridDimensions(), and LibGeoDecomp::max().

Referenced by LibGeoDecomp::StripingSimulator< CELL_TYPE >::adaptDimensions(), and LibGeoDecomp::StripingSimulator< CELL_TYPE >::fillRegion().

template<typename CELL_TYPE >
Region<DIM> LibGeoDecomp::StripingSimulator< CELL_TYPE >::fillRegion ( const int &  startRow,
const int &  endRow 
) [inline, private]
template<typename CELL_TYPE >
std::vector<Chronometer> LibGeoDecomp::StripingSimulator< CELL_TYPE >::gatherStatistics (  )  [inline, virtual]

Returns histograms which detail how much execution time was spent on which part of the algorithm.

Will return one element per rank.

Implements LibGeoDecomp::Simulator< CELL_TYPE >.

References LibGeoDecomp::Simulator< CELL_TYPE >::chronometer, LibGeoDecomp::MPILayer::gather(), and LibGeoDecomp::StripingSimulator< CELL_TYPE >::mpilayer.

template<typename CELL_TYPE >
const unsigned& LibGeoDecomp::StripingSimulator< CELL_TYPE >::getLoadBalancingPeriod (  )  const [inline]
template<typename CELL_TYPE >
Coord<DIM> LibGeoDecomp::StripingSimulator< CELL_TYPE >::gridDimensions (  )  const [inline, private]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::handleInput ( SteererEvent  event  )  [inline, private]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::handleOutput ( WriterEvent  event  )  [inline, private]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::initRegions ( const int &  startRow,
const int &  endRow 
) [inline, private]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::initSimulation (  )  [inline, private]
template<typename CELL_TYPE >
int LibGeoDecomp::StripingSimulator< CELL_TYPE >::lowerNeighbor (  )  const [inline, private]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::nanoStep ( const unsigned nanoStep  )  [inline, private]
template<typename CELL_TYPE >
WeightVec LibGeoDecomp::StripingSimulator< CELL_TYPE >::partition ( unsigned  gridHeight,
unsigned  size 
) const [inline, private]

"partition()[i]" is the first row for which node i is responsible, "partition()[i + 1] - 1" is the last one.

Referenced by LibGeoDecomp::StripingSimulator< CELL_TYPE >::StripingSimulator().

template<typename CELL_TYPE >
WeightVec LibGeoDecomp::StripingSimulator< CELL_TYPE >::partitionsToWorkloads ( const WeightVec partitions  )  const [inline, private]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::recvOuterGhostRegion ( GridType stripe  )  [inline, private]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::redistributeGrid ( const WeightVec oldPartitions,
const WeightVec newPartitions 
) [inline, private]
template<typename CELL_TYPE >
virtual void LibGeoDecomp::StripingSimulator< CELL_TYPE >::run (  )  [inline, virtual]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::sendInnerGhostRegion ( GridType stripe  )  [inline, private]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::setIORegions (  )  [inline, private]
template<typename CELL_TYPE >
virtual void LibGeoDecomp::StripingSimulator< CELL_TYPE >::step (  )  [inline, virtual]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::swapGrids (  )  [inline, private]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::updateInnerGhostRegion ( const unsigned nanoStep  )  [inline, private]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::updateInside ( const unsigned nanoStep  )  [inline, private]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::updateRegion ( const Region< DIM > &  region,
const unsigned nanoStep 
) [inline, private]
template<typename CELL_TYPE >
int LibGeoDecomp::StripingSimulator< CELL_TYPE >::upperNeighbor (  )  const [inline, private]
template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::validateLoads ( const WeightVec newLoads,
const WeightVec oldLoads 
) const [inline, private]

ensures that newLoads and oldLoads have the same size and that the sums of their elements match.

References LibGeoDecomp::sum().

Referenced by LibGeoDecomp::StripingSimulator< CELL_TYPE >::balanceLoad().

template<typename CELL_TYPE >
void LibGeoDecomp::StripingSimulator< CELL_TYPE >::waitForGhostRegions (  )  [inline, private]
template<typename CELL_TYPE >
WeightVec LibGeoDecomp::StripingSimulator< CELL_TYPE >::workloadsToPartitions ( const WeightVec workloads  )  const [inline, private]

Friends And Related Function Documentation

template<typename CELL_TYPE >
friend class ParallelStripingSimulatorTest [friend]
template<typename CELL_TYPE >
friend class StripingSimulatorTest [friend]

Member Data Documentation

template<typename CELL_TYPE >
boost::shared_ptr<LoadBalancer> LibGeoDecomp::StripingSimulator< CELL_TYPE >::balancer [private]
template<typename CELL_TYPE >
GridType* LibGeoDecomp::StripingSimulator< CELL_TYPE >::curStripe [private]
template<typename CELL_TYPE >
const int LibGeoDecomp::StripingSimulator< CELL_TYPE >::DIM = Topology::DIM [static]
template<typename CELL_TYPE >
unsigned LibGeoDecomp::StripingSimulator< CELL_TYPE >::ghostHeightLower [private]

we need to distinguish four types of rims:

  • the inner rim is sent to neighboring nodes (and lies whithin our own stripe)
  • the outer rim is received from them (and is appended beneath/above our stripe)
  • the lower rim is located at the lower edge of our stripe (where the absolute value of the y-coordinates are higher),
  • the upper rim conversely is at the upper edge (smaller coordinate values)

we assume the inner and outer rims to be of the same size. "rim" is the same as "ghost" and "ghost region".

Referenced by LibGeoDecomp::StripingSimulator< CELL_TYPE >::adaptDimensions(), and LibGeoDecomp::StripingSimulator< CELL_TYPE >::initRegions().

template<typename CELL_TYPE >
unsigned LibGeoDecomp::StripingSimulator< CELL_TYPE >::ghostHeightUpper [private]
template<typename CELL_TYPE >
Region<DIM> LibGeoDecomp::StripingSimulator< CELL_TYPE >::innerLowerGhostRegion [private]
template<typename CELL_TYPE >
Region<DIM> LibGeoDecomp::StripingSimulator< CELL_TYPE >::innerRegion [private]
template<typename CELL_TYPE >
Region<DIM> LibGeoDecomp::StripingSimulator< CELL_TYPE >::innerUpperGhostRegion [private]
template<typename CELL_TYPE >
unsigned LibGeoDecomp::StripingSimulator< CELL_TYPE >::loadBalancingPeriod [private]
template<typename CELL_TYPE >
MPILayer LibGeoDecomp::StripingSimulator< CELL_TYPE >::mpilayer [private]
template<typename CELL_TYPE >
GridType* LibGeoDecomp::StripingSimulator< CELL_TYPE >::newStripe [private]
template<typename CELL_TYPE >
Region<DIM> LibGeoDecomp::StripingSimulator< CELL_TYPE >::outerLowerGhostRegion [private]
template<typename CELL_TYPE >
Region<DIM> LibGeoDecomp::StripingSimulator< CELL_TYPE >::outerUpperGhostRegion [private]
template<typename CELL_TYPE >
WeightVec LibGeoDecomp::StripingSimulator< CELL_TYPE >::partitions [private]
template<typename CELL_TYPE >
Region<DIM> LibGeoDecomp::StripingSimulator< CELL_TYPE >::region [private]
template<typename CELL_TYPE >
Region<DIM> LibGeoDecomp::StripingSimulator< CELL_TYPE >::regionWithOuterGhosts [private]
template<typename CELL_TYPE >
const bool LibGeoDecomp::StripingSimulator< CELL_TYPE >::WRAP_EDGES = Topology::template WrapsAxis<DIM - 1>::VALUE [static]

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