Miind
Public Member Functions | Private Member Functions | Static Private Attributes | Friends | List of all members
MPILib::utilities::MPIProxy_ Class Reference

#include <libs/MPILib/include/utilities/MPIProxy.hpp>

Collaboration diagram for MPILib::utilities::MPIProxy_:
Collaboration graph

Public Member Functions

virtual ~MPIProxy_ ()
 
void barrier ()
 
template<typename T >
void broadcast (T &, int)
 
int getRank () const
 
int getSize () const
 
template<typename T >
void irecv (int, int, T &) const
 
template<typename T >
void isend (int, int, const T &) const
 
void waitAll ()
 

Private Member Functions

 MPIProxy_ ()
 

Static Private Attributes

static int _rank = 0
 
static int _size = 1
 

Friends

class Singleton< MPIProxy_ >
 

Detailed Description

A class to handle all MPI related code. It also provides works if MPI is disabled.

MIIND relies on BOOST.MPI to simplify MPI calling.This class encapsulate all MPI related code. The class also works if MPI is not enabled, so that the code does not depend on whether MPI is enabled or not. At the moment only in the main method the MPI environment needs to be generated, i.e. the main program requires an mpi::environment instance to communicate run parameters, such as the number of processors to the program. Consult the largeNetwork program for an example on its definition. All other MPI calls are handled by this class, which encapsulates the mpi::world object. MIIND uses broadcasts and blocking irecv and isend calls for point-to-point calls.

Definition at line 51 of file MPIProxy.hpp.

Constructor & Destructor Documentation

MPILib::utilities::MPIProxy_::~MPIProxy_ ( )
virtual

destructor

Definition at line 41 of file MPIProxy.cpp.

MPILib::utilities::MPIProxy_::MPIProxy_ ( )
private

constructor sets the MPI rank and size

Definition at line 33 of file MPIProxy.cpp.

References _rank, and _size.

Member Function Documentation

void MPILib::utilities::MPIProxy_::barrier ( )

wrapper for mpi barrier

Definition at line 52 of file MPIProxy.cpp.

Referenced by MPILib::MPINetwork< WeightValue, NodeDistribution >::addNode().

template<typename T >
void MPILib::utilities::MPIProxy_::broadcast ( T &  value,
int  root 
)

Broadcast the value from root

Parameters
valueThe value to be broadcast
rootThe root process

Definition at line 136 of file MPIProxy.hpp.

Referenced by MPILib::MPINetwork< WeightValue, NodeDistribution >::getMaxNodeId().

int MPILib::utilities::MPIProxy_::getRank ( ) const
int MPILib::utilities::MPIProxy_::getSize ( ) const

wrapper method to return the size, if MPI is disabled it returns 1

Returns

Definition at line 48 of file MPIProxy.cpp.

References _size.

Referenced by MPILib::utilities::CircularDistribution::getResponsibleProcessor(), MPILib::utilities::ParallelException::ParallelException(), and MPILib::utilities::Log::writeReport().

template<typename T >
void MPILib::utilities::MPIProxy_::irecv ( int  source,
int  tag,
T &  value 
) const

asynchronous receive operation the mpi status is stored in _mpiStatus

Parameters
sourceThe source of the message
tagThe tag of the message
valueThe value received

Definition at line 144 of file MPIProxy.hpp.

References LOG, and MPILib::utilities::logDEBUG4.

Referenced by MPILib::MPINode< Weight, NodeDistribution >::receiveData().

template<typename T >
void MPILib::utilities::MPIProxy_::isend ( int  dest,
int  tag,
const T &  value 
) const

asynchronous send operation the mpi status is stored in _mpiStatus

Parameters
destThe destination of the message
tagThe tag of the message
valueThe value sended

Definition at line 156 of file MPIProxy.hpp.

References LOG, and MPILib::utilities::logDEBUG4.

Referenced by MPILib::MPINode< Weight, NodeDistribution >::sendOwnActivity().

void MPILib::utilities::MPIProxy_::waitAll ( )

waits until all requests stored in the vector _mpiStatus are finished

Definition at line 59 of file MPIProxy.cpp.

References LOG, and MPILib::utilities::logDEBUG4.

Referenced by MPILib::MPINode< Weight, NodeDistribution >::waitAll().

Friends And Related Function Documentation

friend class Singleton< MPIProxy_ >
friend

Declare the Singleton class a friend to allow construction of the MPIProxy_ class

Definition at line 111 of file MPIProxy.hpp.

Member Data Documentation

int MPILib::utilities::MPIProxy_::_rank = 0
staticprivate

storage of the rank to avoid function calls

Definition at line 127 of file MPIProxy.hpp.

Referenced by getRank(), and MPIProxy_().

int MPILib::utilities::MPIProxy_::_size = 1
staticprivate

storage of the size to avoid function calls

Definition at line 132 of file MPIProxy.hpp.

Referenced by getSize(), and MPIProxy_().


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