Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Nektar::LibUtilities::Comm Class Referenceabstract

Base communications class. More...

#include <Comm.h>

Inheritance diagram for Nektar::LibUtilities::Comm:
Inheritance graph
[legend]
Collaboration diagram for Nektar::LibUtilities::Comm:
Collaboration graph
[legend]

Public Member Functions

 Comm (int narg, char *arg[])
 
virtual ~Comm ()
 
void Finalise ()
 
int GetSize ()
 Returns number of processes. More...
 
int GetRank ()
 
const std::string & GetType () const
 
void Block ()
 Block execution until all processes reach this point. More...
 
void Send (int pProc, Array< OneD, NekDouble > &pData)
 
void Send (int pProc, Array< OneD, int > &pData)
 
void Send (int pProc, std::vector< unsigned int > &pData)
 
void Recv (int pProc, Array< OneD, NekDouble > &pData)
 
void Recv (int pProc, Array< OneD, int > &pData)
 
void Recv (int pProc, std::vector< unsigned int > &pData)
 
void SendRecv (int pSendProc, Array< OneD, NekDouble > &pSendData, int pRecvProc, Array< OneD, NekDouble > &pRecvData)
 
void SendRecv (int pSendProc, Array< OneD, int > &pSendData, int pRecvProc, Array< OneD, int > &pRecvData)
 
void SendRecvReplace (int pSendProc, int pRecvProc, Array< OneD, NekDouble > &pSendData)
 
void SendRecvReplace (int pSendProc, int pRecvProc, Array< OneD, int > &pSendData)
 
void AllReduce (NekDouble &pData, enum ReduceOperator pOp)
 
void AllReduce (int &pData, enum ReduceOperator pOp)
 
void AllReduce (Array< OneD, NekDouble > &pData, enum ReduceOperator pOp)
 
void AllReduce (Array< OneD, int > &pData, enum ReduceOperator pOp)
 
void AllReduce (std::vector< unsigned int > &pData, enum ReduceOperator pOp)
 
void AlltoAll (Array< OneD, NekDouble > &pSendData, Array< OneD, NekDouble > &pRecvData)
 
void AlltoAll (Array< OneD, int > &pSendData, Array< OneD, int > &pRecvData)
 
void AlltoAllv (Array< OneD, NekDouble > &pSendData, Array< OneD, int > &pSendDataSizeMap, Array< OneD, int > &pSendDataOffsetMap, Array< OneD, NekDouble > &pRecvData, Array< OneD, int > &pRecvDataSizeMap, Array< OneD, int > &pRecvDataOffsetMap)
 
void AlltoAllv (Array< OneD, int > &pSendData, Array< OneD, int > &pSendDataSizeMap, Array< OneD, int > &pSendDataOffsetMap, Array< OneD, int > &pRecvData, Array< OneD, int > &pRecvDataSizeMap, Array< OneD, int > &pRecvDataOffsetMap)
 
void SplitComm (int pRows, int pColumns)
 Splits this communicator into a grid of size pRows*pColumns and creates row and column communicators. By default the communicator is a single row. More...
 
CommSharedPtr GetRowComm ()
 Retrieve the row communicator to which this process belongs. More...
 
CommSharedPtr GetColumnComm ()
 Retrieve the column communicator to which this process belongs. More...
 
bool TreatAsRankZero (void)
 
bool RemoveExistingFiles (void)
 

Protected Member Functions

 Comm ()
 
virtual void v_Finalise ()=0
 
virtual int v_GetRank ()=0
 
virtual void v_Block ()=0
 
virtual void v_Send (int pProc, Array< OneD, NekDouble > &pData)=0
 
virtual void v_Send (int pProc, Array< OneD, int > &pData)=0
 
virtual void v_Send (int pProc, std::vector< unsigned int > &pData)=0
 
virtual void v_Recv (int pProc, Array< OneD, NekDouble > &pData)=0
 
virtual void v_Recv (int pProc, Array< OneD, int > &pData)=0
 
virtual void v_Recv (int pProc, std::vector< unsigned int > &pData)=0
 
virtual void v_SendRecv (int pSendProc, Array< OneD, NekDouble > &pSendData, int pRecvProc, Array< OneD, NekDouble > &pRecvData)=0
 
virtual void v_SendRecv (int pSendProc, Array< OneD, int > &pSendData, int pRecvProc, Array< OneD, int > &pRecvData)=0
 
virtual void v_SendRecvReplace (int pSendProc, int pRecvProc, Array< OneD, NekDouble > &pSendData)=0
 
virtual void v_SendRecvReplace (int pSendProc, int pRecvProc, Array< OneD, int > &pSendData)=0
 
virtual void v_AllReduce (NekDouble &pData, enum ReduceOperator pOp)=0
 
virtual void v_AllReduce (int &pData, enum ReduceOperator pOp)=0
 
virtual void v_AllReduce (Array< OneD, NekDouble > &pData, enum ReduceOperator pOp)=0
 
virtual void v_AllReduce (Array< OneD, int > &pData, enum ReduceOperator pOp)=0
 
virtual void v_AllReduce (std::vector< unsigned int > &pData, enum ReduceOperator pOp)=0
 
virtual void v_AlltoAll (Array< OneD, NekDouble > &pSendData, Array< OneD, NekDouble > &pRecvData)=0
 
virtual void v_AlltoAll (Array< OneD, int > &pSendData, Array< OneD, int > &pRecvData)=0
 
virtual void v_AlltoAllv (Array< OneD, NekDouble > &pSendData, Array< OneD, int > &pSendDataSizeMap, Array< OneD, int > &pSendDataOffsetMap, Array< OneD, NekDouble > &pRecvData, Array< OneD, int > &pRecvDataSizeMap, Array< OneD, int > &pRecvDataOffsetMap)=0
 
virtual void v_AlltoAllv (Array< OneD, int > &pSendData, Array< OneD, int > &pSendDataSizeMap, Array< OneD, int > &pSendDataOffsetMap, Array< OneD, int > &pRecvData, Array< OneD, int > &pRecvDataSizeMap, Array< OneD, int > &pRecvDataOffsetMap)=0
 
virtual void v_SplitComm (int pRows, int pColumns)=0
 
virtual bool v_TreatAsRankZero (void)=0
 
virtual bool v_RemoveExistingFiles (void)
 

Protected Attributes

int m_size
 Number of processes. More...
 
std::string m_type
 Type of communication. More...
 
CommSharedPtr m_commRow
 Row communicator. More...
 
CommSharedPtr m_commColumn
 Column communicator. More...
 

Detailed Description

Base communications class.

Definition at line 73 of file Comm.h.

Constructor & Destructor Documentation

Nektar::LibUtilities::Comm::Comm ( int  narg,
char *  arg[] 
)

Definition at line 43 of file Comm.cpp.

44  {
45 
46  }
Nektar::LibUtilities::Comm::~Comm ( )
virtual

Definition at line 53 of file Comm.cpp.

54  {
55 
56  }
Nektar::LibUtilities::Comm::Comm ( )
protected

Definition at line 48 of file Comm.cpp.

49  {
50 
51  }

Member Function Documentation

void Nektar::LibUtilities::Comm::AllReduce ( NekDouble pData,
enum ReduceOperator  pOp 
)
inline

Definition at line 341 of file Comm.h.

References v_AllReduce().

342  {
343  v_AllReduce(pData, pOp);
344  }
virtual void v_AllReduce(NekDouble &pData, enum ReduceOperator pOp)=0
void Nektar::LibUtilities::Comm::AllReduce ( int &  pData,
enum ReduceOperator  pOp 
)
inline

Definition at line 350 of file Comm.h.

References v_AllReduce().

351  {
352  v_AllReduce(pData, pOp);
353  }
virtual void v_AllReduce(NekDouble &pData, enum ReduceOperator pOp)=0
void Nektar::LibUtilities::Comm::AllReduce ( Array< OneD, NekDouble > &  pData,
enum ReduceOperator  pOp 
)
inline

Definition at line 359 of file Comm.h.

References v_AllReduce().

360  {
361  v_AllReduce(pData, pOp);
362  }
virtual void v_AllReduce(NekDouble &pData, enum ReduceOperator pOp)=0
void Nektar::LibUtilities::Comm::AllReduce ( Array< OneD, int > &  pData,
enum ReduceOperator  pOp 
)
inline

Definition at line 368 of file Comm.h.

References v_AllReduce().

369  {
370  v_AllReduce(pData, pOp);
371  }
virtual void v_AllReduce(NekDouble &pData, enum ReduceOperator pOp)=0
void Nektar::LibUtilities::Comm::AllReduce ( std::vector< unsigned int > &  pData,
enum ReduceOperator  pOp 
)
inline

Definition at line 377 of file Comm.h.

References v_AllReduce().

378  {
379  v_AllReduce(pData, pOp);
380  }
virtual void v_AllReduce(NekDouble &pData, enum ReduceOperator pOp)=0
void Nektar::LibUtilities::Comm::AlltoAll ( Array< OneD, NekDouble > &  pSendData,
Array< OneD, NekDouble > &  pRecvData 
)
inline

Definition at line 386 of file Comm.h.

References v_AlltoAll().

387  {
388  v_AlltoAll(pSendData,pRecvData);
389  }
virtual void v_AlltoAll(Array< OneD, NekDouble > &pSendData, Array< OneD, NekDouble > &pRecvData)=0
void Nektar::LibUtilities::Comm::AlltoAll ( Array< OneD, int > &  pSendData,
Array< OneD, int > &  pRecvData 
)
inline

Definition at line 395 of file Comm.h.

References v_AlltoAll().

396  {
397  v_AlltoAll(pSendData,pRecvData);
398  }
virtual void v_AlltoAll(Array< OneD, NekDouble > &pSendData, Array< OneD, NekDouble > &pRecvData)=0
void Nektar::LibUtilities::Comm::AlltoAllv ( Array< OneD, NekDouble > &  pSendData,
Array< OneD, int > &  pSendDataSizeMap,
Array< OneD, int > &  pSendDataOffsetMap,
Array< OneD, NekDouble > &  pRecvData,
Array< OneD, int > &  pRecvDataSizeMap,
Array< OneD, int > &  pRecvDataOffsetMap 
)
inline

Definition at line 404 of file Comm.h.

References v_AlltoAllv().

410  {
411  v_AlltoAllv(pSendData,pSendDataSizeMap,pSendDataOffsetMap,pRecvData,pRecvDataSizeMap,pRecvDataOffsetMap);
412  }
virtual void v_AlltoAllv(Array< OneD, NekDouble > &pSendData, Array< OneD, int > &pSendDataSizeMap, Array< OneD, int > &pSendDataOffsetMap, Array< OneD, NekDouble > &pRecvData, Array< OneD, int > &pRecvDataSizeMap, Array< OneD, int > &pRecvDataOffsetMap)=0
void Nektar::LibUtilities::Comm::AlltoAllv ( Array< OneD, int > &  pSendData,
Array< OneD, int > &  pSendDataSizeMap,
Array< OneD, int > &  pSendDataOffsetMap,
Array< OneD, int > &  pRecvData,
Array< OneD, int > &  pRecvDataSizeMap,
Array< OneD, int > &  pRecvDataOffsetMap 
)
inline

Definition at line 417 of file Comm.h.

References v_AlltoAllv().

423  {
424  v_AlltoAllv(pSendData,pSendDataSizeMap,pSendDataOffsetMap,pRecvData,pRecvDataSizeMap,pRecvDataOffsetMap);
425  }
virtual void v_AlltoAllv(Array< OneD, NekDouble > &pSendData, Array< OneD, int > &pSendDataSizeMap, Array< OneD, int > &pSendDataOffsetMap, Array< OneD, NekDouble > &pRecvData, Array< OneD, int > &pRecvDataSizeMap, Array< OneD, int > &pRecvDataOffsetMap)=0
void Nektar::LibUtilities::Comm::Block ( )
inline

Block execution until all processes reach this point.

Definition at line 239 of file Comm.h.

References v_Block().

240  {
241  v_Block();
242  }
virtual void v_Block()=0
void Nektar::LibUtilities::Comm::Finalise ( )
inline

Definition at line 207 of file Comm.h.

References v_Finalise().

208  {
209  v_Finalise();
210  }
virtual void v_Finalise()=0
CommSharedPtr Nektar::LibUtilities::Comm::GetColumnComm ( )
inline

Retrieve the column communicator to which this process belongs.

Definition at line 459 of file Comm.h.

References m_commColumn.

460  {
461  if (!m_commColumn.get())
462  {
463  return shared_from_this();
464  }
465  else
466  {
467  return m_commColumn;
468  }
469  }
CommSharedPtr m_commColumn
Column communicator.
Definition: Comm.h:145
int Nektar::LibUtilities::Comm::GetRank ( )
inline

Definition at line 223 of file Comm.h.

References v_GetRank().

224  {
225  return v_GetRank();
226  }
virtual int v_GetRank()=0
CommSharedPtr Nektar::LibUtilities::Comm::GetRowComm ( )
inline

Retrieve the row communicator to which this process belongs.

Definition at line 442 of file Comm.h.

References m_commRow.

443  {
444  if (!m_commRow.get())
445  {
446  return shared_from_this();
447  }
448  else
449  {
450  return m_commRow;
451  }
452  }
CommSharedPtr m_commRow
Row communicator.
Definition: Comm.h:144
int Nektar::LibUtilities::Comm::GetSize ( )
inline

Returns number of processes.

Definition at line 215 of file Comm.h.

References m_size.

Referenced by Nektar::LibUtilities::CommMpi::v_AllReduce(), and Nektar::LibUtilities::CommMpi::v_AlltoAll().

216  {
217  return m_size;
218  }
int m_size
Number of processes.
Definition: Comm.h:142
const std::string & Nektar::LibUtilities::Comm::GetType ( ) const
inline

Definition at line 231 of file Comm.h.

References m_type.

232  {
233  return m_type;
234  }
std::string m_type
Type of communication.
Definition: Comm.h:143
void Nektar::LibUtilities::Comm::Recv ( int  pProc,
Array< OneD, NekDouble > &  pData 
)
inline

Definition at line 255 of file Comm.h.

References v_Recv().

256  {
257  v_Recv(pProc, pData);
258  }
virtual void v_Recv(int pProc, Array< OneD, NekDouble > &pData)=0
void Nektar::LibUtilities::Comm::Recv ( int  pProc,
Array< OneD, int > &  pData 
)
inline

Definition at line 272 of file Comm.h.

References v_Recv().

273  {
274  v_Recv(pProc, pData);
275  }
virtual void v_Recv(int pProc, Array< OneD, NekDouble > &pData)=0
void Nektar::LibUtilities::Comm::Recv ( int  pProc,
std::vector< unsigned int > &  pData 
)
inline

Definition at line 288 of file Comm.h.

References v_Recv().

289  {
290  v_Recv(pProc, pData);
291  }
virtual void v_Recv(int pProc, Array< OneD, NekDouble > &pData)=0
bool Nektar::LibUtilities::Comm::RemoveExistingFiles ( void  )
inline

Definition at line 476 of file Comm.h.

References v_RemoveExistingFiles().

477  {
478  return v_RemoveExistingFiles();
479  }
virtual bool v_RemoveExistingFiles(void)
Definition: Comm.cpp:59
void Nektar::LibUtilities::Comm::Send ( int  pProc,
Array< OneD, NekDouble > &  pData 
)
inline

Definition at line 247 of file Comm.h.

References v_Send().

248  {
249  v_Send(pProc, pData);
250  }
virtual void v_Send(int pProc, Array< OneD, NekDouble > &pData)=0
void Nektar::LibUtilities::Comm::Send ( int  pProc,
Array< OneD, int > &  pData 
)
inline

Definition at line 264 of file Comm.h.

References v_Send().

265  {
266  v_Send(pProc, pData);
267  }
virtual void v_Send(int pProc, Array< OneD, NekDouble > &pData)=0
void Nektar::LibUtilities::Comm::Send ( int  pProc,
std::vector< unsigned int > &  pData 
)
inline

Definition at line 280 of file Comm.h.

References v_Send().

281  {
282  v_Send(pProc, pData);
283  }
virtual void v_Send(int pProc, Array< OneD, NekDouble > &pData)=0
void Nektar::LibUtilities::Comm::SendRecv ( int  pSendProc,
Array< OneD, NekDouble > &  pSendData,
int  pRecvProc,
Array< OneD, NekDouble > &  pRecvData 
)
inline

Definition at line 296 of file Comm.h.

References v_SendRecv().

300  {
301  v_SendRecv(pSendProc, pSendData, pRecvProc, pRecvData);
302  }
virtual void v_SendRecv(int pSendProc, Array< OneD, NekDouble > &pSendData, int pRecvProc, Array< OneD, NekDouble > &pRecvData)=0
void Nektar::LibUtilities::Comm::SendRecv ( int  pSendProc,
Array< OneD, int > &  pSendData,
int  pRecvProc,
Array< OneD, int > &  pRecvData 
)
inline

Definition at line 308 of file Comm.h.

References v_SendRecv().

312  {
313  v_SendRecv(pSendProc, pSendData, pRecvProc, pRecvData);
314  }
virtual void v_SendRecv(int pSendProc, Array< OneD, NekDouble > &pSendData, int pRecvProc, Array< OneD, NekDouble > &pRecvData)=0
void Nektar::LibUtilities::Comm::SendRecvReplace ( int  pSendProc,
int  pRecvProc,
Array< OneD, NekDouble > &  pSendData 
)
inline

Definition at line 319 of file Comm.h.

References v_SendRecvReplace().

322  {
323  v_SendRecvReplace(pSendProc,pRecvProc,pSendData);
324  }
virtual void v_SendRecvReplace(int pSendProc, int pRecvProc, Array< OneD, NekDouble > &pSendData)=0
void Nektar::LibUtilities::Comm::SendRecvReplace ( int  pSendProc,
int  pRecvProc,
Array< OneD, int > &  pSendData 
)
inline

Definition at line 330 of file Comm.h.

References v_SendRecvReplace().

333  {
334  v_SendRecvReplace(pSendProc,pRecvProc,pSendData);
335  }
virtual void v_SendRecvReplace(int pSendProc, int pRecvProc, Array< OneD, NekDouble > &pSendData)=0
void Nektar::LibUtilities::Comm::SplitComm ( int  pRows,
int  pColumns 
)
inline

Splits this communicator into a grid of size pRows*pColumns and creates row and column communicators. By default the communicator is a single row.

Definition at line 433 of file Comm.h.

References v_SplitComm().

434  {
435  v_SplitComm(pRows, pColumns);
436  }
virtual void v_SplitComm(int pRows, int pColumns)=0
bool Nektar::LibUtilities::Comm::TreatAsRankZero ( void  )
inline

Definition at line 471 of file Comm.h.

References v_TreatAsRankZero().

472  {
473  return v_TreatAsRankZero();
474  }
virtual bool v_TreatAsRankZero(void)=0
virtual void Nektar::LibUtilities::Comm::v_AllReduce ( NekDouble pData,
enum ReduceOperator  pOp 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AllReduce ( int &  pData,
enum ReduceOperator  pOp 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AllReduce ( Array< OneD, NekDouble > &  pData,
enum ReduceOperator  pOp 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AllReduce ( Array< OneD, int > &  pData,
enum ReduceOperator  pOp 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AllReduce ( std::vector< unsigned int > &  pData,
enum ReduceOperator  pOp 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AlltoAll ( Array< OneD, NekDouble > &  pSendData,
Array< OneD, NekDouble > &  pRecvData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AlltoAll ( Array< OneD, int > &  pSendData,
Array< OneD, int > &  pRecvData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AlltoAllv ( Array< OneD, NekDouble > &  pSendData,
Array< OneD, int > &  pSendDataSizeMap,
Array< OneD, int > &  pSendDataOffsetMap,
Array< OneD, NekDouble > &  pRecvData,
Array< OneD, int > &  pRecvDataSizeMap,
Array< OneD, int > &  pRecvDataOffsetMap 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_AlltoAllv ( Array< OneD, int > &  pSendData,
Array< OneD, int > &  pSendDataSizeMap,
Array< OneD, int > &  pSendDataOffsetMap,
Array< OneD, int > &  pRecvData,
Array< OneD, int > &  pRecvDataSizeMap,
Array< OneD, int > &  pRecvDataOffsetMap 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Block ( )
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Finalise ( )
protectedpure virtual
virtual int Nektar::LibUtilities::Comm::v_GetRank ( )
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Recv ( int  pProc,
Array< OneD, NekDouble > &  pData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Recv ( int  pProc,
Array< OneD, int > &  pData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Recv ( int  pProc,
std::vector< unsigned int > &  pData 
)
protectedpure virtual
bool Nektar::LibUtilities::Comm::v_RemoveExistingFiles ( void  )
protectedvirtual

Reimplemented in Nektar::Utilities::FieldConvertComm.

Definition at line 59 of file Comm.cpp.

Referenced by RemoveExistingFiles().

60  {
61  return true;
62  }
virtual void Nektar::LibUtilities::Comm::v_Send ( int  pProc,
Array< OneD, NekDouble > &  pData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Send ( int  pProc,
Array< OneD, int > &  pData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_Send ( int  pProc,
std::vector< unsigned int > &  pData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_SendRecv ( int  pSendProc,
Array< OneD, NekDouble > &  pSendData,
int  pRecvProc,
Array< OneD, NekDouble > &  pRecvData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_SendRecv ( int  pSendProc,
Array< OneD, int > &  pSendData,
int  pRecvProc,
Array< OneD, int > &  pRecvData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_SendRecvReplace ( int  pSendProc,
int  pRecvProc,
Array< OneD, NekDouble > &  pSendData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_SendRecvReplace ( int  pSendProc,
int  pRecvProc,
Array< OneD, int > &  pSendData 
)
protectedpure virtual
virtual void Nektar::LibUtilities::Comm::v_SplitComm ( int  pRows,
int  pColumns 
)
protectedpure virtual
virtual bool Nektar::LibUtilities::Comm::v_TreatAsRankZero ( void  )
protectedpure virtual

Member Data Documentation

CommSharedPtr Nektar::LibUtilities::Comm::m_commColumn
protected

Column communicator.

Definition at line 145 of file Comm.h.

Referenced by GetColumnComm(), and Nektar::LibUtilities::CommMpi::v_SplitComm().

CommSharedPtr Nektar::LibUtilities::Comm::m_commRow
protected

Row communicator.

Definition at line 144 of file Comm.h.

Referenced by GetRowComm(), and Nektar::LibUtilities::CommMpi::v_SplitComm().

int Nektar::LibUtilities::Comm::m_size
protected
std::string Nektar::LibUtilities::Comm::m_type
protected

Type of communication.

Definition at line 143 of file Comm.h.

Referenced by Nektar::LibUtilities::CommMpi::CommMpi(), Nektar::LibUtilities::CommSerial::CommSerial(), and GetType().