ESyS-Particle
4.0.1
|
abstract base class for communicator More...
#include <comm.h>
Public Member Functions | |
bool | isNull () const |
int | rank () const |
int | size () |
MPI_Comm | comm () const |
TML_Comm & | operator= (const TML_Comm &) |
void | setComm (MPI_Comm) |
TML_Comm () | |
TML_Comm (MPI_Comm) | |
TML_Comm | include (const vector< int > &) |
TML_Comm | exclude (const vector< int > &) |
template<typename T > | |
void | send (T, int, int=0) |
template<typename T > | |
void | receive (T &, int, int=MPI_ANY_TAG) |
template<typename T > | |
void | send_array (T *, int, int, int=0) |
template<typename T > | |
void | receive_array (T *, int, int, int=MPI_ANY_TAG) |
template<typename T > | |
void | send_cont (const T &, int, int=0) |
template<typename T > | |
void | receive_cont (T &, int, int=MPI_ANY_TAG) |
template<typename T > | |
void | send_cont_packed (T, int, bool, int=0) |
template<typename T > | |
void | receive_cont_packed (T &, int, bool, int=MPI_ANY_TAG) |
template<typename T , typename P > | |
void | sendrecv (T, P &, int, int, int=0) |
template<typename T , typename P > | |
void | sendrecv_array (T *, int, P *, int, int, int, int=0) |
template<typename T , typename P > | |
void | sendrecv_cont (T, P &, int, int, int=0) |
template<typename T > | |
void | sendrecv_cont_replace (T &, int, int, int=0) |
template<typename T , typename P > | |
void | sendrecv_cont_packed (T, P &, int, int, bool, int=0) |
template<typename T > | |
void | sendrecv_cont_packed_replace (T &, int, int, bool, int=0) |
template<typename T > | |
void | broadcast (T) |
template<typename T > | |
void | broadcast_array (T *, int) |
template<typename T > | |
void | broadcast_cont (const T &) |
template<typename T > | |
void | broadcast_cont_packed (const T &) |
template<typename T > | |
void | recv_broadcast (T &, int) |
template<typename T > | |
void | recv_broadcast_array (T *, int, int) |
template<typename T > | |
void | recv_broadcast_cont (T &, int) |
template<typename T > | |
void | recv_broadcast_cont_packed (T &, int) |
template<typename T > | |
void | scatter (const multimap< int, T >) |
template<typename T > | |
void | recv_scatter (T &, int) |
template<typename T > | |
void | gather (multimap< int, T > &) |
template<typename T > | |
void | send_gather (T &, int) |
template<typename T > | |
void | gather_debug (multimap< int, T > &) |
template<typename T > | |
void | send_gather_debug (T &, int) |
template<typename T > | |
void | scatter_packed (const multimap< int, T >) |
template<typename T > | |
void | recv_scatter_packed (T &, int) |
template<typename T > | |
void | gather_packed (multimap< int, T > &) |
template<typename T > | |
void | send_gather_packed (const T &, int) |
template<typename T > | |
T | sum_all (const T &) |
void | barrier () |
void | barrier (const string &) |
Protected Attributes | |
MPI_Status | m_status |
MPI_Comm | m_comm |
abstract base class for communicator
Default constructor for TML_comm. Sets the MPI communicator to MPI_COMM_NULL;
TML_Comm::TML_Comm | ( | MPI_Comm | comm | ) |
construct TML_Comm from MPI communicator
comm | the MPI communicator |
void TML_Comm::barrier | ( | ) |
Wait on a barrier. Wrapper for MPI_Barrier.
Referenced by CSubLatticeControler::initMPI(), CSubLatticeControler::run(), and VectorWallFieldMaster::VectorWallFieldMaster().
void TML_Comm::barrier | ( | const string & | msg | ) |
Wait on a barrier with debug message
References BasicCon::Debug().
void TML_Comm::broadcast | ( | T | data | ) |
broadcast single data to all other nodes
data | the data to be broadcast |
Referenced by broadcast_cont(), broadcast_cont_packed(), ScalarParticleDistributionMaster::collect(), ScalarTriangleFieldMaster::collect(), VectorTriangleFieldMaster::collect(), ScalarTriangleFieldMaster::collectFull(), VectorTriangleFieldMaster::collectFull(), ScalarParticleFieldMaster::collectFull(), ScalarInteractionFieldMaster::collectFull(), VectorInteractionFieldMaster::collectFull(), ScalarInteractionFieldMaster::collectFull2(), VectorInteractionFieldMaster::collectFull2(), VectorInteractionFieldMaster::collectFullWithID(), ScalarInteractionFieldMaster::collectFullWithID(), VectorInteractionFieldMaster::collectFullWithPosID(), ScalarInteractionFieldMaster::collectFullWithPosID(), ScalarParticleFieldMaster::collectSum(), ScalarInteractionFieldMaster::collectSum(), VectorInteractionFieldMaster::collectSum(), ScalarInteractionFieldMaster::ScalarInteractionFieldMaster(), ScalarParticleFieldMaster::ScalarParticleFieldMaster(), ScalarTriangleFieldMaster::ScalarTriangleFieldMaster(), VectorInteractionFieldMaster::VectorInteractionFieldMaster(), VectorParticleFieldMaster::VectorParticleFieldMaster(), VectorTriangleFieldMaster::VectorTriangleFieldMaster(), and VectorWallFieldMaster::VectorWallFieldMaster().
void TML_Comm::broadcast_array | ( | T * | data, |
int | ndata | ||
) |
broadcast an array of known size
data | the array to be broadcast |
ndata | the size of the array (nr. of elements) |
Referenced by broadcast_cont(), and broadcast_cont_packed().
void TML_Comm::broadcast_cont | ( | const T & | data | ) |
broadcast the content of a STL container of simple types. Uses 2 MPI broadcasts for size and data.
data | the data to be broadcast |
References broadcast(), and broadcast_array().
Referenced by ScalarInteractionFieldMaster::ScalarInteractionFieldMaster(), ScalarParticleFieldMaster::ScalarParticleFieldMaster(), ScalarTriangleFieldMaster::ScalarTriangleFieldMaster(), VectorInteractionFieldMaster::VectorInteractionFieldMaster(), VectorParticleFieldMaster::VectorParticleFieldMaster(), VectorTriangleFieldMaster::VectorTriangleFieldMaster(), and VectorWallFieldMaster::VectorWallFieldMaster().
void TML_Comm::broadcast_cont_packed | ( | const T & | data | ) |
broadcast the content of a STL container of packable objects. Uses 2 MPI broadcasts for size and data.
data | the data to be broadcast |
References broadcast(), and broadcast_array().
Referenced by CLatticeMaster::addConnections(), and CLatticeMaster::addParticles().
TML_Comm TML_Comm::exclude | ( | const vector< int > & | ids | ) |
Construct a new communicator containing the processes from the current communicator except to ones which are given as input
ids | the ranks of the processes which are excluded from the new communicator |
void TML_Comm::gather | ( | multimap< int, T > & | data | ) |
Gather data from all other processes in the communicator into a multimap. The multimap-key will be set according to the rank of the process where the data came from
data | the multimap |
Referenced by ScalarTriangleFieldMaster::collectFull(), VectorTriangleFieldMaster::collectFull(), ScalarParticleFieldMaster::collectFull(), VectorInteractionFieldMaster::collectFull(), ScalarInteractionFieldMaster::collectFull(), ScalarInteractionFieldMaster::collectFull2(), VectorInteractionFieldMaster::collectFull2(), ScalarInteractionFieldMaster::collectFullWithID(), VectorInteractionFieldMaster::collectFullWithID(), VectorInteractionFieldMaster::collectFullWithPosID(), ScalarInteractionFieldMaster::collectFullWithPosID(), ScalarParticleFieldMaster::collectSum(), VectorInteractionFieldMaster::collectSum(), ScalarInteractionFieldMaster::collectSum(), and CheckPointController::issueCheckPointCmdWTM().
void TML_Comm::gather_debug | ( | multimap< int, T > & | data | ) |
Gather data from all other processes in the communicator into a multimap. The multimap-key will be set according to the rank of the process where the data came from. Debug version (output data)
data | the multimap |
References BasicCon::Debug().
TML_Comm TML_Comm::include | ( | const vector< int > & | ids | ) |
Construct a new communicator containing the processes which are given as input
ids | the ranks of the processes which form the new communicator in the current communicator |
References BasicCon::Error().
void TML_Comm::receive | ( | T & | data, |
int | source, | ||
int | tag = MPI_ANY_TAG |
||
) |
receive single data
data | the data to be received |
source | the rank of the destination process the data comes from |
tag | the message tag |
Referenced by receive_cont(), receive_cont_packed(), and VectorWallFieldMaster::VectorWallFieldMaster().
void TML_Comm::receive_array | ( | T * | data, |
int | ndata, | ||
int | source, | ||
int | tag = MPI_ANY_TAG |
||
) |
receive a C-array of data with known dimensions
data | the data to be received |
ndata | the number of integers to be received |
source | the rank of the destination process the data comes from |
tag | the message tag |
Referenced by receive_cont(), and receive_cont_packed().
void TML_Comm::receive_cont | ( | T & | data, |
int | source, | ||
int | tag = MPI_ANY_TAG |
||
) |
Receive an STL container or anything that has iterators, begin() and end(). Single item insert (a.insert(p,t)) is used instead of range insert to be compatible with both sequence and associative containers;
data | the data to be received |
source | the rank of the destination process the data is coming from |
tag | the message tag |
References receive(), and receive_array().
void TML_Comm::receive_cont_packed | ( | T & | data, |
int | source, | ||
bool | checked, | ||
int | tag = MPI_ANY_TAG |
||
) |
Receive an STL container or anything that has iterators and insert(). Uses 2 receive operations for size and data. If the "checked" option is set, a checked message buffer is used to detect type mismatches between pack and unpack operations.
data | the data to be received |
source | the rank of the destination process the data is coming from |
checked | use checked message buffer if true |
tag | the message tag |
References TML_Packed_Message::pop_int(), receive(), and receive_array().
void TML_Comm::recv_broadcast | ( | T & | data, |
int | root | ||
) |
Receive broadcast of single data from a given node
data | the data to be broadcast |
root | the node which sent the broadcast |
Referenced by recv_broadcast_cont(), recv_broadcast_cont_packed(), VectorEdge2DFieldSlave::sendData(), VectorTriangleFieldSlave::sendData(), and ScalarTriangleFieldSlave::sendData().
void TML_Comm::recv_broadcast_array | ( | T * | data, |
int | ndata, | ||
int | root | ||
) |
Receive broadcast of an array of known size
data | the array to be broadcast |
ndata | the size of the array (nr. of elements) |
root | the node which sent the broadcast |
Referenced by recv_broadcast_cont(), and recv_broadcast_cont_packed().
void TML_Comm::recv_broadcast_cont | ( | T & | data, |
int | root | ||
) |
Receive broadcast of the content of a STL container of simple types from a given node. Uses 2 MPI broadcasts for size and data.
data | the data to be broadcast |
root | the node which sent the broadcast |
References recv_broadcast(), and recv_broadcast_array().
Referenced by CSubLatticeControler::initLatticeCirc().
void TML_Comm::recv_broadcast_cont_packed | ( | T & | data, |
int | root | ||
) |
Receive broadcast of the content of a STL container of packable objects from a given node. Uses 2 MPI broadcasts for size and data.
data | the data to be broadcast |
root | the node which sent the broadcast |
References TML_Packed_Message::pop_int(), recv_broadcast(), and recv_broadcast_array().
Referenced by CSubLatticeControler::initLattice(), and CSubLatticeControler::initLatticeCirc().
void TML_Comm::recv_scatter | ( | T & | data, |
int | root | ||
) |
receive scattered data
data | the received data |
root | the process which scattered the data |
void TML_Comm::recv_scatter_packed | ( | T & | data, |
int | root | ||
) |
receive scattered packed data
data | the received data |
root | the process which scattered the data |
References TML_Packed_Message::pop_int().
void TML_Comm::scatter | ( | const multimap< int, T > | data | ) |
scatter the content of a multimap. The key of the multimap is used to decide where to send the data. Uses one MPI_Scatter (sizes) and one MPI_Scatterv (data) call.
data | the multimap containing the data to be scattered |
void TML_Comm::scatter_packed | ( | const multimap< int, T > | data | ) |
Scatter the content of a multimap of packable objects. The key of the multimap is used to decide where to send the data. Uses one MPI_Scatter (sizes) and one MPI_Scatterv (data) call.
data | the multimap containing the data to be scattered |
void TML_Comm::send | ( | T | data, |
int | dest, | ||
int | tag = 0 |
||
) |
send single data
data | the data to be sent |
dest | the rank of the destination process the data is sent to |
tag | the message tag |
Referenced by send_cont(), and send_cont_packed().
void TML_Comm::send_array | ( | T * | data, |
int | ndata, | ||
int | dest, | ||
int | tag = 0 |
||
) |
send a C-array of data with known dimensions
data | the data to be sent |
ndata | the size of the array (nr. of elements) |
dest | the rank of the destination process the data is sent to |
tag | the message tag |
Referenced by send_cont(), and send_cont_packed().
void TML_Comm::send_cont | ( | const T & | data, |
int | dest, | ||
int | tag = 0 |
||
) |
Send an STL container or anything that has iterators, begin() and end(). Uses 2 send operations for size and data.
data | the data to be sent |
dest | the rank of the destination process the data is sent to |
tag | the message tag |
References send(), and send_array().
void TML_Comm::send_cont_packed | ( | T | data, |
int | dest, | ||
bool | checked, | ||
int | tag = 0 |
||
) |
Send an STL container or anything that has iterators, begin() and end(). Uses 2 send operations for size and data. If the "checked" option is set, a checked message buffer is used to detect type mismatches between pack and unpack operations. The TML_Packed_Message has to grow dynamically. It is not possible to predetermine the size of the message because while T always has a size() function, it is not guaranteed that sizeof() or size() work for the valuetype of T.
data | the data to be sent |
dest | the rank of the destination process the data is sent to |
checked | use checked message buffer if true |
tag | the message tag |
References send(), and send_array().
void TML_Comm::send_gather | ( | T & | data, |
int | root | ||
) |
Send data to be gathered by a root process.
data | the data (a container) |
root | the root process |
Referenced by CSubLatticeControler::initLattice(), CSubLatticeControler::initLatticeCirc(), VectorEdge2DFieldSlave::SendDataFull(), VectorTriangleFieldSlave::SendDataFull(), and ScalarTriangleFieldSlave::SendDataFull().
void TML_Comm::send_gather_debug | ( | T & | data, |
int | root | ||
) |
Send data to be gathered by a root process. Debug version.
data | the data (a container) |
root | the root process |
References BasicCon::Debug().
void TML_Comm::sendrecv | ( | T | send_data, |
P & | recv_data, | ||
int | dest, | ||
int | source, | ||
int | tag = 0 |
||
) |
send and receive single data
send_data | the data to be sent |
recv_data | the data to be received |
dest | the rank of the destination process the data is sent to |
source | the rank of the destination process the data comes from |
tag | the message tag |
Referenced by sendrecv_cont(), sendrecv_cont_packed(), sendrecv_cont_packed_replace(), sendrecv_cont_replace(), TML_CartComm::shift(), and TML_CartComm::shift_array().
void TML_Comm::sendrecv_array | ( | T * | send_data, |
int | send_count, | ||
P * | recv_data, | ||
int | recv_count, | ||
int | dest, | ||
int | source, | ||
int | tag = 0 |
||
) |
send and receive a C-array of data with known dimensions
send_data | the data to be sent |
send_count | the number of integers to be sent |
recv_data | the data to be received |
recv_count | the number of integers to be received |
dest | the rank of the destination process the data is sent to |
source | the rank of the destination process the data comes from |
tag | the message tag |
Referenced by sendrecv_cont(), sendrecv_cont_packed(), sendrecv_cont_packed_replace(), and sendrecv_cont_replace().
void TML_Comm::sendrecv_cont | ( | T | send_data, |
P & | recv_data, | ||
int | dest, | ||
int | source, | ||
int | tag = 0 |
||
) |
send and receive an STL container or anything that has iterators, begin() and end(). Uses 2 MPI_Sendrecv operations for size and data
send_data | the data to be sent |
recv_data | the data to be received |
dest | the rank of the destination process the data is sent to |
source | the rank of the destination process the data comes from |
tag | the message tag |
References sendrecv(), and sendrecv_array().
Referenced by TML_CartComm::shift_cont().
void TML_Comm::sendrecv_cont_packed | ( | T | send_data, |
P & | recv_data, | ||
int | dest, | ||
int | source, | ||
bool | checked, | ||
int | tag = 0 |
||
) |
send and receive an STL container or anything that has iterators, begin() and end() and insert(). Uses 2 MPI_Sendrecv operations for size and data. If the "checked" option is set, a checked message buffer is used to detect type mismatches between pack and unpack operations.
send_data | the data to be sent |
recv_data | the data to be received |
dest | the rank of the destination process the data is sent to |
source | the rank of the destination process the data comes from |
tag | the message tag |
References TML_Packed_Message::pop_int(), sendrecv(), and sendrecv_array().
Referenced by TML_CartComm::shift_cont_packed().
void TML_Comm::sendrecv_cont_packed_replace | ( | T & | data, |
int | dest, | ||
int | source, | ||
bool | checked, | ||
int | tag = 0 |
||
) |
send and receive an STL container or anything that has iterators, begin() and end() and insert(). In input data is replaced by the received data. Uses 2 MPI_Sendrecv operations for size and data. If the "checked" option is set, a checked message buffer is used to detect type mismatches between pack and unpack operations.
data | the data to be sent and received |
dest | the rank of the destination process the data is sent to |
source | the rank of the destination process the data comes from |
tag | the message tag |
References TML_Packed_Message::pop_int(), sendrecv(), and sendrecv_array().
void TML_Comm::sendrecv_cont_replace | ( | T & | data, |
int | dest, | ||
int | source, | ||
int | tag = 0 |
||
) |
send and receive an STL container or anything that has iterators, begin() and end(), erase() and insert(). The input data is replaced (via erase/insert) by the output data. Uses separate send/receive buffers and MPI_Sendrecv instead of a single buffer and MPI_Sendrecv_replace to accomodate different size send and received messages. Uses 2 MPI_Sendrecv operations for size and data.
data | the data to be sent and received |
dest | the rank of the destination process the data is sent to |
source | the rank of the destination process the data comes from |
tag | the message tag |
References sendrecv(), and sendrecv_array().
void TML_Comm::setComm | ( | MPI_Comm | comm | ) |
set the undelying MPI communicator
comm | the MPI communicator |
Referenced by CSubLatticeControler::initMPI(), and TSubLattice< T >::TSubLattice().