WARPXM v1.10.0
Loading...
Searching...
No Matches
WxMsgTmpl< T > Class Template Referenceabstract

Provides interface for messaging between processes. More...

#include <wxmsgtmpl.h>

Inheritance diagram for WxMsgTmpl< T >:
WxMpiMsgTmpl< T >

Detailed Description

template<typename T>
class WxMsgTmpl< T >

Provides interface for messaging between processes.

Public Member Functions

virtual ~WxMsgTmpl ()
 Destructor.
 
virtual void send (unsigned num, const T *array, unsigned recvRank, int tag) const =0
 Send an array to another rank.
 
virtual void finishSend (WxMsgStatus ms) const =0
 Finish the send started by startSend.
 
virtual WxMsgStatus startSend (unsigned num, const T *arr, unsigned recvRank, int tag) const =0
 Send an array to another rank.
 
virtual void recv (unsigned num, std::vector< T > &array, unsigned sendRank, int tag) const =0
 Receive an array from another rank.
 
virtual void recv (unsigned num, T *array, unsigned sendRank, int tag) const =0
 Receive an array from another rank.
 
virtual WxMsgStatus startRecv (unsigned num, unsigned sendRank, int tag=-1) const =0
 Receive an array from another rank.
 
virtual WxMsgStatus startRecv (unsigned num, T *arr, unsigned sendRank, int tag=-1) const =0
 Receive an array from another rank.
 
virtual void allReduce (unsigned num, T *sendBuff, T *recvBuff, MPI_Op op) const =0
 Reduce data to all ranks.
 
virtual void broadcast (unsigned num, T *buffer, int root) const =0
 

Protected Member Functions

 WxMsgTmpl ()
 Protected so only children can make instances.
 
void resizeArray (T *&array, unsigned &numElem, unsigned reqNumElem) const
 Resizes a array.
 
void resizeSendBuff (unsigned reqSize)
 Checks the buffer and resizes it if necessary.
 
void resizeRecvBuff (unsigned reqSize)
 Checks the buffer and resizes it if necessary.
 

Protected Attributes

unsigned _sendSize
 
T * _sendBuff
 
unsigned _recvSize
 
T * _recvBuff
 

Constructor & Destructor Documentation

◆ ~WxMsgTmpl()

template<typename T >
virtual WxMsgTmpl< T >::~WxMsgTmpl ( )
inlinevirtual

Destructor.

◆ WxMsgTmpl()

template<typename T >
WxMsgTmpl< T >::WxMsgTmpl ( )
inlineprotected

Protected so only children can make instances.

Member Function Documentation

◆ allReduce()

template<typename T >
virtual void WxMsgTmpl< T >::allReduce ( unsigned  num,
T *  sendBuff,
T *  recvBuff,
MPI_Op  op 
) const
pure virtual

Reduce data to all ranks.

Parameters
numNumber of elements being reduced
sendBuffbuffer to reduce
recvBuffbuffer to recieve reduced data
opoperation to perform.

Implemented in WxMpiMsgTmpl< T >.

◆ broadcast()

template<typename T >
virtual void WxMsgTmpl< T >::broadcast ( unsigned  num,
T *  buffer,
int  root 
) const
pure virtual

Implemented in WxMpiMsgTmpl< T >.

◆ finishSend()

template<typename T >
virtual void WxMsgTmpl< T >::finishSend ( WxMsgStatus  ms) const
pure virtual

Finish the send started by startSend.

Parameters
msmessage status object returned by startSend

Implemented in WxMpiMsgTmpl< T >.

◆ recv() [1/2]

template<typename T >
virtual void WxMsgTmpl< T >::recv ( unsigned  num,
std::vector< T > &  array,
unsigned  sendRank,
int  tag 
) const
pure virtual

Receive an array from another rank.

Parameters
numnumber of elements to recieve
arrayarray that is filled with received values
sendRankrank that sent array

Implemented in WxMpiMsgTmpl< T >.

◆ recv() [2/2]

template<typename T >
virtual void WxMsgTmpl< T >::recv ( unsigned  num,
T *  array,
unsigned  sendRank,
int  tag 
) const
pure virtual

Receive an array from another rank.

Parameters
numnumber of elements to receive
arrayarray that is filled with received values
sendRankrank that sent array

Implemented in WxMpiMsgTmpl< T >.

◆ resizeArray()

template<typename T >
void WxMsgTmpl< T >::resizeArray ( T *&  array,
unsigned &  numElem,
unsigned  reqNumElem 
) const
inlineprotected

Resizes a array.

Sets number of elements to the exact number of elements in the data.

Parameters
arraythe array to be resized.
numElemthe number of elements in the array. Is set to reqNumElem
reqNumElemthe number of array elements needed

◆ resizeRecvBuff()

template<typename T >
void WxMsgTmpl< T >::resizeRecvBuff ( unsigned  reqSize)
inlineprotected

Checks the buffer and resizes it if necessary.

Parameters
reqSizethe needed size for the buffer

◆ resizeSendBuff()

template<typename T >
void WxMsgTmpl< T >::resizeSendBuff ( unsigned  reqSize)
inlineprotected

Checks the buffer and resizes it if necessary.

Parameters
reqSizethe needed size for the buffer

◆ send()

template<typename T >
virtual void WxMsgTmpl< T >::send ( unsigned  num,
const T *  array,
unsigned  recvRank,
int  tag 
) const
pure virtual

Send an array to another rank.

@parem num number of elements to send

Parameters
arrayarray of length 'num' of data being sent
recvRankrank that will receive array

Implemented in WxMpiMsgTmpl< T >.

◆ startRecv() [1/2]

template<typename T >
virtual WxMsgStatus WxMsgTmpl< T >::startRecv ( unsigned  num,
T *  arr,
unsigned  sendRank,
int  tag = -1 
) const
pure virtual

Receive an array from another rank.

This is a non-blocking call.

Parameters
numnumber of elements to receive
arrarray to fill with received value
sendRankrank we want to receive from
tagidentifier for data transaction
Returns
message status

Implemented in WxMpiMsgTmpl< T >.

◆ startRecv() [2/2]

template<typename T >
virtual WxMsgStatus WxMsgTmpl< T >::startRecv ( unsigned  num,
unsigned  sendRank,
int  tag = -1 
) const
pure virtual

Receive an array from another rank.

This is a non-blocking call.

Parameters
numnumber of elements to receive
sendRankrank that sent array
Returns
message status

Implemented in WxMpiMsgTmpl< T >.

◆ startSend()

template<typename T >
virtual WxMsgStatus WxMsgTmpl< T >::startSend ( unsigned  num,
const T *  arr,
unsigned  recvRank,
int  tag 
) const
pure virtual

Send an array to another rank.

This is a non-blocking call.

Parameters
numnumber of elements to send
arrarray that is filled with values to send
recvRankrank that sent array
tagidentifier for data transaction
Returns
message status

Implemented in WxMpiMsgTmpl< T >.

Member Data Documentation

◆ _recvBuff

template<typename T >
T* WxMsgTmpl< T >::_recvBuff
protected

◆ _recvSize

template<typename T >
unsigned WxMsgTmpl< T >::_recvSize
protected

◆ _sendBuff

template<typename T >
T* WxMsgTmpl< T >::_sendBuff
protected

◆ _sendSize

template<typename T >
unsigned WxMsgTmpl< T >::_sendSize
protected

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