ESyS-Particle  2.3.2
TML_Comm Class Reference

abstract base class for communicator More...

#include <comm.h>

Inheritance diagram for TML_Comm:

Public Member Functions

bool isNull () const
int rank () const
int size ()
MPI_Comm comm () const
TML_Commoperator= (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 >
sum_all (const T &)
void barrier ()
void barrier (const string &)

Protected Attributes

MPI_Status m_status
MPI_Comm m_comm

Detailed Description

abstract base class for communicator

Author
Steffen Abe $Revision$ $Date$

Constructor & Destructor Documentation

TML_Comm::TML_Comm ( )

Default constructor for TML_comm. Sets the MPI communicator to MPI_COMM_NULL;

References m_comm.

TML_Comm::TML_Comm ( MPI_Comm  comm)

construct TML_Comm from MPI communicator

Parameters
commthe MPI communicator

References comm(), and m_comm.

Here is the call graph for this function:

Member Function Documentation

void TML_Comm::barrier ( const string &  msg)

Wait on a barrier with debug message

References console, Console::Debug(), m_comm, and rank().

Here is the call graph for this function:

template<typename T >
void TML_Comm::broadcast ( data)

broadcast single data to all other nodes

Parameters
datathe data to be broadcast

References GetType, m_comm, and rank().

Referenced by broadcast_cont(), broadcast_cont_packed(), ScalarParticleDistributionMaster::collect(), VectorWallFieldMaster::collect(), ScalarTriangleFieldMaster::collect(), VectorTriangleFieldMaster::collect(), ScalarParticleFieldMaster::collect(), VectorInteractionFieldMaster::collect(), ScalarInteractionFieldMaster::collect(), VectorParticleFieldMaster::collect(), ScalarTriangleFieldMaster::collectFull(), VectorTriangleFieldMaster::collectFull(), ScalarParticleFieldMaster::collectFull(), VectorInteractionFieldMaster::collectFull(), ScalarInteractionFieldMaster::collectFull(), ScalarInteractionFieldMaster::collectFull2(), VectorInteractionFieldMaster::collectFull2(), VectorInteractionFieldMaster::collectFullWithID(), ScalarInteractionFieldMaster::collectFullWithID(), ScalarInteractionFieldMaster::collectFullWithPosID(), VectorInteractionFieldMaster::collectFullWithPosID(), ScalarParticleFieldMaster::collectSum(), VectorInteractionFieldMaster::collectSum(), ScalarInteractionFieldMaster::collectSum(), ScalarInteractionFieldMaster::ScalarInteractionFieldMaster(), ScalarParticleFieldMaster::ScalarParticleFieldMaster(), ScalarTriangleFieldMaster::ScalarTriangleFieldMaster(), test_broadcast(), VectorInteractionFieldMaster::VectorInteractionFieldMaster(), VectorParticleFieldMaster::VectorParticleFieldMaster(), VectorTriangleFieldMaster::VectorTriangleFieldMaster(), and VectorWallFieldMaster::VectorWallFieldMaster().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
void TML_Comm::broadcast_array ( T *  data,
int  ndata 
)

broadcast an array of known size

Parameters
datathe array to be broadcast
ndatathe size of the array (nr. of elements)

References GetType, m_comm, and rank().

Referenced by broadcast_cont(), and broadcast_cont_packed().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
void TML_Comm::broadcast_cont ( const T &  data)
template<typename T >
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.

Parameters
datathe data to be broadcast

References broadcast(), broadcast_array(), TML_Packed_Message::buffer(), esys::lsm::bpu::iter(), m_comm, TML_PackedMessageInterface::pack(), and TML_Packed_Message::size().

Referenced by CLatticeMaster::createTriMesh(), CLatticeMaster::readAndDistributeMesh2D(), CLatticeMaster::setSpatialDomain(), and test_broadcast_cont_packed().

Here is the call graph for this function:

Here is the caller graph for this function:

MPI_Comm TML_Comm::comm ( ) const
inline

References m_comm.

Referenced by setComm(), test_pack(), test_pack_multi(), TML_CartComm::TML_CartComm(), and TML_Comm().

Here is the caller graph for this function:

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

Parameters
idsthe ranks of the processes which are excluded from the new communicator
Todo:
error handling

References m_comm.

template<typename T >
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)

Parameters
datathe multimap

References console, Console::Debug(), GetType, m_comm, rank(), and size().

Here is the call graph for this function:

template<typename T >
void TML_Comm::gather_packed ( multimap< int, T > &  data)
TML_Comm TML_Comm::include ( const vector< int > &  ids)

Construct a new communicator containing the processes which are given as input

Parameters
idsthe ranks of the processes which form the new communicator in the current communicator
Todo:
error handling

References console, Console::Error(), m_comm, and rank().

Referenced by test_const().

Here is the call graph for this function:

Here is the caller graph for this function:

bool TML_Comm::isNull ( ) const
inline

References m_comm.

TML_Comm & TML_Comm::operator= ( const TML_Comm rhs)

References m_comm.

int TML_Comm::rank ( ) const
template<typename T >
void TML_Comm::receive ( T &  data,
int  source,
int  tag = MPI_ANY_TAG 
)

receive single data

Parameters
datathe data to be received
sourcethe rank of the destination process the data comes from
tagthe message tag
Warning
no checks

References GetType, m_comm, and m_status.

Referenced by receive_cont(), receive_cont_packed(), test_pair(), test_simple(), and VectorWallFieldMaster::VectorWallFieldMaster().

Here is the caller graph for this function:

template<typename T >
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

Parameters
datathe data to be received
ndatathe number of integers to be received
sourcethe rank of the destination process the data comes from
tagthe message tag
Warning
no checks

References GetType, m_comm, and m_status.

Referenced by receive_cont(), and receive_cont_packed().

Here is the caller graph for this function:

template<typename T >
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;

Parameters
datathe data to be received
sourcethe rank of the destination process the data is coming from
tagthe message tag

References receive(), and receive_array().

Referenced by test_container(), test_container_map(), and test_container_vec3().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
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.

Parameters
datathe data to be received
sourcethe rank of the destination process the data is coming from
checkeduse checked message buffer if true
tagthe message tag
Warning
checked stuff not yet implemented

References TML_Packed_Message::buffer(), m_comm, TML_Packed_Message::pop_int(), receive(), receive_array(), and TML_PackedMessageInterface::unpack().

Referenced by test_container_packed(), and test_container_packed_user().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
void TML_Comm::recv_broadcast ( T &  data,
int  root 
)

Receive broadcast of single data from a given node

Parameters
datathe data to be broadcast
rootthe node which sent the broadcast

References GetType, and m_comm.

Referenced by recv_broadcast_cont(), recv_broadcast_cont_packed(), VectorEdge2DFieldSlave::sendData(), VectorTriangleFieldSlave::sendData(), ScalarTriangleFieldSlave::sendData(), and test_broadcast().

Here is the caller graph for this function:

template<typename T >
void TML_Comm::recv_broadcast_array ( T *  data,
int  ndata,
int  root 
)

Receive broadcast of an array of known size

Parameters
datathe array to be broadcast
ndatathe size of the array (nr. of elements)
rootthe node which sent the broadcast

References GetType, and m_comm.

Referenced by recv_broadcast_cont(), and recv_broadcast_cont_packed().

Here is the caller graph for this function:

template<typename T >
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.

Parameters
datathe data to be broadcast
rootthe node which sent the broadcast

References recv_broadcast(), and recv_broadcast_array().

Referenced by CSubLatticeControler::getIdParticleData(), CSubLatticeControler::initLatticeCirc(), and test_broadcast_cont().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
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.

Parameters
datathe data to be broadcast
rootthe node which sent the broadcast

References TML_Packed_Message::buffer(), m_comm, TML_Packed_Message::pop_int(), recv_broadcast(), recv_broadcast_array(), and TML_PackedMessageInterface::unpack().

Referenced by CSubLatticeControler::initLattice(), CSubLatticeControler::initLatticeCirc(), and test_broadcast_cont_packed().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
void TML_Comm::recv_scatter ( T &  data,
int  root 
)

receive scattered data

Parameters
datathe received data
rootthe process which scattered the data

References GetType, m_comm, NULL, and size().

Referenced by test_scatter().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
void TML_Comm::recv_scatter_packed ( T &  data,
int  root 
)

receive scattered packed data

Parameters
datathe received data
rootthe process which scattered the data

References TML_Packed_Message::begin_unpack(), TML_Packed_Message::buffer(), GetType, m_comm, NULL, TML_Packed_Message::pop_int(), and TML_PackedMessageInterface::unpack().

Referenced by test_scatter_packed().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
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.

Parameters
datathe multimap containing the data to be scattered
Todo:
checks, handling of out of range indices

References GetType, esys::lsm::bpu::iter(), m_comm, rank(), and size().

Referenced by test_scatter().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
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.

Parameters
datathe multimap containing the data to be scattered
Todo:
checks, handling of out of range indices

References TML_PackedMultiMessage::buffer(), GetType, esys::lsm::bpu::iter(), m_comm, TML_PackedMultiMessage::offsets(), rank(), size(), and TML_PackedMultiMessage::sizes().

Referenced by test_scatter_packed().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
void TML_Comm::send ( data,
int  dest,
int  tag = 0 
)

send single data

Parameters
datathe data to be sent
destthe rank of the destination process the data is sent to
tagthe message tag

References GetType, and m_comm.

Referenced by send_cont(), send_cont_packed(), test_pair(), and test_simple().

Here is the caller graph for this function:

template<typename T >
void TML_Comm::send_array ( T *  data,
int  ndata,
int  dest,
int  tag = 0 
)

send a C-array of data with known dimensions

Parameters
datathe data to be sent
ndatathe size of the array (nr. of elements)
destthe rank of the destination process the data is sent to
tagthe message tag
Warning
no checks

References GetType, and m_comm.

Referenced by send_cont(), and send_cont_packed().

Here is the caller graph for this function:

template<typename T >
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.

Parameters
datathe data to be sent
destthe rank of the destination process the data is sent to
tagthe message tag

References esys::lsm::bpu::iter(), send(), and send_array().

Referenced by test_container(), test_container_map(), and test_container_vec3().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
void TML_Comm::send_cont_packed ( 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.

Parameters
datathe data to be sent
destthe rank of the destination process the data is sent to
checkeduse checked message buffer if true
tagthe message tag
Warning
checked stuff not yet implemented

References TML_Packed_Message::buffer(), esys::lsm::bpu::iter(), m_comm, TML_PackedMessageInterface::pack(), send(), send_array(), and TML_Packed_Message::size().

Referenced by test_container_packed(), and test_container_packed_user().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
void TML_Comm::send_gather ( T &  data,
int  root 
)
template<typename T >
void TML_Comm::send_gather_debug ( T &  data,
int  root 
)

Send data to be gathered by a root process. Debug version.

Parameters
datathe data (a container)
rootthe root process

References console, Console::Debug(), GetType, esys::lsm::bpu::iter(), m_comm, NULL, and size().

Here is the call graph for this function:

template<typename T >
void TML_Comm::send_gather_packed ( const T &  data,
int  root 
)
template<typename T , typename P >
void TML_Comm::sendrecv ( send_data,
P &  recv_data,
int  dest,
int  source,
int  tag = 0 
)

send and receive single data

Parameters
send_datathe data to be sent
recv_datathe data to be received
destthe rank of the destination process the data is sent to
sourcethe rank of the destination process the data comes from
tagthe message tag
Warning
no checks

References GetType, m_comm, and m_status.

Referenced by sendrecv_cont(), sendrecv_cont_packed(), sendrecv_cont_packed_replace(), sendrecv_cont_replace(), TML_CartComm::shift(), TML_CartComm::shift_array(), and test_simple_sendrecv().

Here is the caller graph for this function:

template<typename T , typename P >
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

Parameters
send_datathe data to be sent
send_countthe number of integers to be sent
recv_datathe data to be received
recv_countthe number of integers to be received
destthe rank of the destination process the data is sent to
sourcethe rank of the destination process the data comes from
tagthe message tag
Warning
no checks

References GetType, m_comm, and m_status.

Referenced by sendrecv_cont(), sendrecv_cont_packed(), sendrecv_cont_packed_replace(), and sendrecv_cont_replace().

Here is the caller graph for this function:

template<typename T , typename P >
void TML_Comm::sendrecv_cont ( 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

Parameters
send_datathe data to be sent
recv_datathe data to be received
destthe rank of the destination process the data is sent to
sourcethe rank of the destination process the data comes from
tagthe message tag

References esys::lsm::bpu::iter(), sendrecv(), and sendrecv_array().

Referenced by TML_CartComm::shift_cont(), and test_container_sendrecv().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T , typename P >
void TML_Comm::sendrecv_cont_packed ( 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.

Parameters
send_datathe data to be sent
recv_datathe data to be received
destthe rank of the destination process the data is sent to
sourcethe rank of the destination process the data comes from
tagthe message tag
Warning
checked stuff not yet implemented

References TML_Packed_Message::buffer(), esys::lsm::bpu::iter(), m_comm, TML_PackedMessageInterface::pack(), TML_Packed_Message::pop_int(), sendrecv(), sendrecv_array(), TML_Packed_Message::size(), and TML_PackedMessageInterface::unpack().

Referenced by TML_CartComm::shift_cont_packed(), and test_container_sendrecv_packed().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
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.

Parameters
datathe data to be sent and received
destthe rank of the destination process the data is sent to
sourcethe rank of the destination process the data comes from
tagthe message tag
Warning
checked stuff not yet implemented

References TML_Packed_Message::buffer(), esys::lsm::bpu::iter(), m_comm, TML_PackedMessageInterface::pack(), TML_Packed_Message::pop_int(), sendrecv(), sendrecv_array(), TML_Packed_Message::size(), and TML_PackedMessageInterface::unpack().

Referenced by test_container_sendrecv_packed_replace().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
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.

Parameters
datathe data to be sent and received
destthe rank of the destination process the data is sent to
sourcethe rank of the destination process the data comes from
tagthe message tag

References esys::lsm::bpu::iter(), sendrecv(), and sendrecv_array().

Referenced by test_container_sendrecv_replace().

Here is the call graph for this function:

Here is the caller graph for this function:

void TML_Comm::setComm ( MPI_Comm  comm)

set the undelying MPI communicator

Parameters
commthe MPI communicator

References comm(), and m_comm.

Referenced by CSubLatticeControler::initMPI(), CLatticeMaster::setupWorkers(), and TSubLattice< T >::TSubLattice().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
T TML_Comm::sum_all ( const T &  data)

References GetType, and m_comm.

Referenced by test_sum_all().

Here is the caller graph for this function:

Member Data Documentation

MPI_Status TML_Comm::m_status
protected

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