Miind
|
#include <libs/MPILib/include/utilities/MPIProxy.hpp>
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_ > |
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.
|
virtual |
destructor
Definition at line 41 of file MPIProxy.cpp.
|
private |
constructor sets the MPI rank and size
Definition at line 33 of file MPIProxy.cpp.
void MPILib::utilities::MPIProxy_::barrier | ( | ) |
wrapper for mpi barrier
Definition at line 52 of file MPIProxy.cpp.
Referenced by MPILib::MPINetwork< WeightValue, NodeDistribution >::addNode().
void MPILib::utilities::MPIProxy_::broadcast | ( | T & | value, |
int | root | ||
) |
Broadcast the value from root
value | The value to be broadcast |
root | The root process |
Definition at line 136 of file MPIProxy.hpp.
Referenced by MPILib::MPINetwork< WeightValue, NodeDistribution >::getMaxNodeId().
int MPILib::utilities::MPIProxy_::getRank | ( | ) | const |
wrapper method to return the process id, if mpi is disabled it returns 0
Definition at line 44 of file MPIProxy.cpp.
References _rank.
Referenced by MPILib::utilities::FileNameGenerator::FileNameGenerator(), MPILib::utilities::CircularDistribution::isLocalNode(), MPILib::utilities::CircularDistribution::isMaster(), MPILib::utilities::ParallelException::ParallelException(), and MPILib::utilities::Log::writeReport().
int MPILib::utilities::MPIProxy_::getSize | ( | ) | const |
wrapper method to return the size, if MPI is disabled it returns 1
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().
void MPILib::utilities::MPIProxy_::irecv | ( | int | source, |
int | tag, | ||
T & | value | ||
) | const |
asynchronous receive operation the mpi status is stored in _mpiStatus
source | The source of the message |
tag | The tag of the message |
value | The value received |
Definition at line 144 of file MPIProxy.hpp.
References LOG, and MPILib::utilities::logDEBUG4.
Referenced by MPILib::MPINode< Weight, NodeDistribution >::receiveData().
void MPILib::utilities::MPIProxy_::isend | ( | int | dest, |
int | tag, | ||
const T & | value | ||
) | const |
asynchronous send operation the mpi status is stored in _mpiStatus
dest | The destination of the message |
tag | The tag of the message |
value | The 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().
Declare the Singleton class a friend to allow construction of the MPIProxy_ class
Definition at line 111 of file MPIProxy.hpp.
|
staticprivate |
storage of the rank to avoid function calls
Definition at line 127 of file MPIProxy.hpp.
Referenced by getRank(), and MPIProxy_().
|
staticprivate |
storage of the size to avoid function calls
Definition at line 132 of file MPIProxy.hpp.
Referenced by getSize(), and MPIProxy_().