MaMiCo 1.2
Loading...
Searching...
No Matches
coupling::sendrecv::SendReceiveBuffer< Cell_T, dim > Class Template Reference

generic class for send-/ receive methodology. More...

#include <SendReceiveBuffer.h>

Inheritance diagram for coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >:

Classes

struct  BufferCollective
 
struct  BufferWithID
 

Public Member Functions

 SendReceiveBuffer ()
 
virtual ~SendReceiveBuffer ()
 

Protected Member Functions

void deleteBuffers ()
 deletes the buffers
 
template<class Container_T>
void writeToSendBuffer (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Container_T &cells)
 fills all information that needs to be sent from a coupling cell into the send-buffer.
 
void writeToBcastBuffer (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Cell_T &cell, I01 idx)
 fills all information that needs to be broadcast from a coupling cell into the broadcast-buffer.
 
void writeToReduceBuffer (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Cell_T &cell, I01 idx)
 fills all information that needs to be reduced to a coupling cell into the reduce-buffer.
 
template<class Container_T>
void readFromReceiveBuffer (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, const Container_T &cells)
 
void readFromCollectiveBuffer (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, Cell_T &couplingCell, I01 idx)
 
void readFromReduceBuffer (coupling::sendrecv::DataExchangeFromMD2Macro< dim > &dataExchange, Cell_T &couplingCell, I01 idx)
 
void allocateReceiveBuffers (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, I01 idx)
 
void allocateBcastBufferForReceiving (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, I01 idx)
 
void allocateReduceBufferForReceiving (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange, I01 idx)
 
void triggerSending (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange)
 
void triggerBcasts (unsigned int rank)
 
void triggerReceiving (coupling::sendrecv::DataExchange< Cell_T, dim > &dataExchange)
 
void triggerReduce (unsigned int rank)
 
void waitAllOperations ()
 
void waitAllCollectiveOperations ()
 
void allocateRequests ()
 
void allocateBcastRequests (unsigned int thisRank)
 
void allocateReduceRequests (unsigned int thisRank)
 

Private Member Functions

void deleteBuffer (std::map< unsigned int, BufferWithID > &buffer)
 

Static Private Member Functions

static void elementWiseSum (void *in, void *inout, int *len, MPI_Datatype *datatype)
 

Private Attributes

std::map< unsigned int, BufferWithID_receiveBuffer
 
std::map< unsigned int, BufferWithID_sendBuffer
 
std::map< unsigned int, BufferCollective_bcastBuffer
 
std::map< unsigned int, BufferCollective_reduceBuffer
 
bool _requestsAllocated
 
MPI_Request * _requests
 
int _receiveSize
 
int _sendSize
 
std::vector< MPI_Comm > _subComms
 
std::vector< MPI_Group > _subGroups
 
int _bcastOrReduceSize
 
MPI_Op elementWiseSumOperation
 

Detailed Description

template<class Cell_T, unsigned int dim>
class coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >

generic class for send-/ receive methodology.

generic class for send-/ receive methodology including buffer implementations. The access to the buffers is prescribed by the DataExchange object.

Template Parameters
Cell_Tcell type
dimNumber of dimensions; it can be 1, 2 or 3
Author
Philipp Neumann

Constructor & Destructor Documentation

◆ SendReceiveBuffer()

template<class Cell_T, unsigned int dim>
coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::SendReceiveBuffer ( )

Constructor

◆ ~SendReceiveBuffer()

template<class Cell_T, unsigned int dim>
virtual coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::~SendReceiveBuffer ( )
virtual

Destructor

Member Function Documentation

◆ allocateBcastBufferForReceiving()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::allocateBcastBufferForReceiving ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange,
I01 idx )
protected

Allocates buffer for receiving in the context of the broadcast operation

Parameters
dataExchange
idx

◆ allocateBcastRequests()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::allocateBcastRequests ( unsigned int thisRank)
protected

allocates broadcast request

Parameters
thisRank

◆ allocateReceiveBuffers()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::allocateReceiveBuffers ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange,
I01 idx )
protected

according to rule by dataExchange, the receive buffers are allocated. This function adds a contribution for the cell at idx.

Parameters
dataExchange
idx

◆ allocateReduceBufferForReceiving()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::allocateReduceBufferForReceiving ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange,
I01 idx )
protected

Allocates buffer for receiving in the context of the reduce operation

Parameters
dataExchange
idx

◆ allocateReduceRequests()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::allocateReduceRequests ( unsigned int thisRank)
protected

allocates reduce request

Parameters
thisRank

◆ allocateRequests()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::allocateRequests ( )
protected

allocates send and receive requests

◆ deleteBuffer()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::deleteBuffer ( std::map< unsigned int, BufferWithID > & buffer)
private

deletes everything inside a given buffer

Parameters
buffer

◆ readFromReceiveBuffer()

template<class Cell_T, unsigned int dim>
template<class Container_T>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::readFromReceiveBuffer ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange,
const Container_T & cells )
protected

reads the information from the receive-buffer and fills it into a coupling cell.

Parameters
dataExchange
couplingCell
idx

◆ readFromReduceBuffer()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::readFromReduceBuffer ( coupling::sendrecv::DataExchangeFromMD2Macro< dim > & dataExchange,
Cell_T & couplingCell,
I01 idx )
protected

reads the information from the reduce-buffer and fills it into a coupling cell.

Parameters
dataExchange
couplingCell
idx

◆ triggerBcasts()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::triggerBcasts ( unsigned int rank)
protected

triggers the MPI-broadcast on the respective buffers.

Parameters
rank

◆ triggerReceiving()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::triggerReceiving ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange)
protected

triggers the MPI-receiving on the respective buffers. No receiving of information from/to this rank.

Parameters
dataExchange

◆ triggerReduce()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::triggerReduce ( unsigned int rank)
protected

triggers the MPI-reduce on the respective buffers.

Parameters
rank

◆ triggerSending()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::triggerSending ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange)
protected

triggers the MPI-sending on the respective buffers. No sending for information transfer from/ to this rank.

Parameters
dataExchange

◆ waitAllCollectiveOperations()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::waitAllCollectiveOperations ( )
protected

wait for all broadcast or reduce operations to complete

◆ waitAllOperations()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::waitAllOperations ( )
protected

wait for all send and receive operations to complete.

◆ writeToBcastBuffer()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::writeToBcastBuffer ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange,
const Cell_T & cell,
I01 idx )
protected

fills all information that needs to be broadcast from a coupling cell into the broadcast-buffer.

Parameters
dataExchange
cell
idx

◆ writeToReduceBuffer()

template<class Cell_T, unsigned int dim>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::writeToReduceBuffer ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange,
const Cell_T & cell,
I01 idx )
protected

fills all information that needs to be reduced to a coupling cell into the reduce-buffer.

Parameters
dataExchange
cell
idx

◆ writeToSendBuffer()

template<class Cell_T, unsigned int dim>
template<class Container_T>
void coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::writeToSendBuffer ( coupling::sendrecv::DataExchange< Cell_T, dim > & dataExchange,
const Container_T & cells )
protected

fills all information that needs to be sent from a coupling cell into the send-buffer.

Parameters
dataExchange
cells

Member Data Documentation

◆ _bcastBuffer

template<class Cell_T, unsigned int dim>
std::map<unsigned int, BufferCollective> coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::_bcastBuffer
private

members for collective communication

◆ _receiveBuffer

template<class Cell_T, unsigned int dim>
std::map<unsigned int, BufferWithID> coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::_receiveBuffer
private

buffer for storing all received messages from MD. Each map entry is identified by a respective rank.

◆ _requests

template<class Cell_T, unsigned int dim>
MPI_Request* coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::_requests
private

flag that will always be reset after every send operation. Triggers instantiation of requests

◆ _sendSize

template<class Cell_T, unsigned int dim>
int coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::_sendSize
private

number of receive requests

◆ _subComms

template<class Cell_T, unsigned int dim>
std::vector<MPI_Comm> coupling::sendrecv::SendReceiveBuffer< Cell_T, dim >::_subComms
private

number of send requests


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