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

LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER > Class Template Reference

#include <hiparsimulator.h>

Inherits LibGeoDecomp::DistributedSimulator< CELL_TYPE >.

Collaboration diagram for LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef DistributedSimulator
< CELL_TYPE >::Topology 
Topology
typedef DistributedSimulator
< CELL_TYPE > 
ParentType
typedef UpdateGroup< CELL_TYPE > UpdateGroupType
typedef ParentType::GridType GridType
typedef ParallelWriterAdapter
< typename
UpdateGroupType::GridType,
CELL_TYPE > 
ParallelWriterAdapterType
typedef SteererAdapter
< typename
UpdateGroupType::GridType,
CELL_TYPE > 
SteererAdapterType

Public Member Functions

 HiParSimulator (Initializer< CELL_TYPE > *initializer, LoadBalancer *balancer=0, unsigned loadBalancingPeriod=1, unsigned ghostZoneWidth=1, MPI_Comm communicator=MPI_COMM_WORLD)
void run ()
 performs step() until the maximum number of steps is reached.
void step ()
 performs a single simulation step.
virtual unsigned getStep () const
 returns the number of the current logical simulation step.
virtual void addSteerer (Steerer< CELL_TYPE > *steerer)
 adds a Steerer which will be called back before simulation steps as specified by the Steerer's period.
virtual void addWriter (ParallelWriter< CELL_TYPE > *writer)
 register writer which will observe the simulation.
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

Private Member Functions

double getCellSpeed (APITraits::FalseType) const
double getCellSpeed (APITraits::TrueType) const
std::vector< std::size_t > initialWeights (std::size_t items, const std::vector< double > rankSpeeds) const
 computes an initial weight distribution of the work items (i.e.
void nanoStep (long s)
void initSimulation ()
 We need to do late/lazy initialization to give the user time to add ParallelWriter objects before calling run().
void initEvents ()
void handleEvents ()
void insertNextLoadBalancingEvent ()
long currentNanoStep () const
long timeToNextEvent () const
 returns the number of nano steps until the next event needs to be handled.
long timeToLastEvent () const
 returns the number of nano steps until simulation end.
void balanceLoad ()

Private Attributes

boost::shared_ptr< LoadBalancerbalancer
unsigned loadBalancingPeriod
unsigned ghostZoneWidth
EventMap events
PartitionManager< TopologypartitionManager
MPILayer mpiLayer
boost::shared_ptr
< UpdateGroupType
updateGroup
UpdateGroupType::PatchProviderVec steererAdaptersGhost
UpdateGroupType::PatchProviderVec steererAdaptersInner
UpdateGroupType::PatchAccepterVec writerAdaptersGhost
UpdateGroupType::PatchAccepterVec writerAdaptersInner

Friends

class HiParSimulatorTest

template<typename CELL_TYPE, typename PARTITION, typename STEPPER = VanillaStepper<CELL_TYPE>>
class LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >


Member Typedef Documentation

template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
typedef ParentType::GridType LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::GridType
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
typedef ParallelWriterAdapter<typename UpdateGroupType::GridType, CELL_TYPE> LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::ParallelWriterAdapterType
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
typedef DistributedSimulator<CELL_TYPE> LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::ParentType
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
typedef SteererAdapter<typename UpdateGroupType::GridType, CELL_TYPE> LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::SteererAdapterType
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
typedef DistributedSimulator<CELL_TYPE>::Topology LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::Topology
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
typedef UpdateGroup<CELL_TYPE> LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::UpdateGroupType

Constructor & Destructor Documentation

template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::HiParSimulator ( Initializer< CELL_TYPE > *  initializer,
LoadBalancer balancer = 0,
unsigned  loadBalancingPeriod = 1,
unsigned  ghostZoneWidth = 1,
MPI_Comm  communicator = MPI_COMM_WORLD 
) [inline, explicit]

Member Function Documentation

template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
virtual void LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::addSteerer ( Steerer< CELL_TYPE > *  steerer  )  [inline, virtual]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
virtual void LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::addWriter ( ParallelWriter< CELL_TYPE > *  writer  )  [inline, virtual]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
void LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::balanceLoad (  )  [inline, private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
long LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::currentNanoStep (  )  const [inline, private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
std::vector<Chronometer> LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::gatherStatistics (  )  [inline, virtual]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
double LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::getCellSpeed ( APITraits::TrueType   )  const [inline, private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
double LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::getCellSpeed ( APITraits::FalseType   )  const [inline, private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
virtual unsigned LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::getStep (  )  const [inline, virtual]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
void LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::handleEvents (  )  [inline, private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
void LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::initEvents (  )  [inline, private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
std::vector<std::size_t> LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::initialWeights ( std::size_t  items,
const std::vector< double >  rankSpeeds 
) const [inline, private]

computes an initial weight distribution of the work items (i.e.

number of cells in the simulation space). rankSpeeds gives an estimate of the relative performance of the different ranks (good when running on heterogeneous systems, e.g. clusters comprised of multiple genrations of nodes or x86 clusters with additional Xeon Phi accelerators).

References LibGeoDecomp::sum().

Referenced by LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::initSimulation().

template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
void LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::initSimulation (  )  [inline, private]

We need to do late/lazy initialization to give the user time to add ParallelWriter objects before calling run().

Writers may only be added savely to an UpdateGroup upon creation because of the way the Stepper handles ghostzone updates. It's a long story... At the end of the day this remains the best compromise of hiding complexity (in the Stepper) and a convenient API of the Simulator on the one hand, and avoiding objects with an uninitialized state on the other.

References LibGeoDecomp::MPILayer::allGather(), LibGeoDecomp::MPILayer::communicator(), LibGeoDecomp::CoordBox< DIM >::dimensions, LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::getCellSpeed(), LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::ghostZoneWidth, LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::initEvents(), LibGeoDecomp::Simulator< CELL_TYPE >::initializer, LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::initialWeights(), LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::mpiLayer, LibGeoDecomp::CoordBox< DIM >::origin, LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::steererAdaptersGhost, LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::steererAdaptersInner, LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::updateGroup, LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::writerAdaptersGhost, and LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::writerAdaptersInner.

Referenced by LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::run(), and LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::step().

template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
void LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::insertNextLoadBalancingEvent (  )  [inline, private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
void LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::nanoStep ( long  s  )  [inline, private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
void LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::run (  )  [inline, virtual]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
void LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::step (  )  [inline, virtual]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
long LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::timeToLastEvent (  )  const [inline, private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
long LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::timeToNextEvent (  )  const [inline, private]

Friends And Related Function Documentation

template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
friend class HiParSimulatorTest [friend]

Member Data Documentation

template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
boost::shared_ptr<LoadBalancer> LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::balancer [private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
const int LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::DIM = Topology::DIM [static]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
EventMap LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::events [private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
unsigned LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::ghostZoneWidth [private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
unsigned LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::loadBalancingPeriod [private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
MPILayer LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::mpiLayer [private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
PartitionManager<Topology> LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::partitionManager [private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
UpdateGroupType::PatchProviderVec LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::steererAdaptersGhost [private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
UpdateGroupType::PatchProviderVec LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::steererAdaptersInner [private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
boost::shared_ptr<UpdateGroupType> LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::updateGroup [private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
UpdateGroupType::PatchAccepterVec LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::writerAdaptersGhost [private]
template<typename CELL_TYPE , typename PARTITION , typename STEPPER = VanillaStepper<CELL_TYPE>>
UpdateGroupType::PatchAccepterVec LibGeoDecomp::HiParSimulator::HiParSimulator< CELL_TYPE, PARTITION, STEPPER >::writerAdaptersInner [private]

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