Nektar++
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:
[legend]

Public Member Functions

 Comm (int narg, char *arg[])
 
virtual ~Comm ()
 
void Finalise ()
 
int GetSize () const
 Returns number of processes. More...
 
int GetRank ()
 
const std::string & GetType () const
 
bool TreatAsRankZero ()
 
bool IsSerial ()
 
bool IsParallelInTime ()
 
std::tuple< int, int, int > GetVersion ()
 
void Block ()
 Block execution until all processes reach this point. More...
 
NekDouble Wtime ()
 Return the time in seconds. More...
 
template<class T >
void Send (int pProc, T &pData)
 
template<class T >
void Recv (int pProc, T &pData)
 
template<class T >
void SendRecv (int pSendProc, T &pSendData, int pRecvProc, T &pRecvData)
 
template<class T >
void AllReduce (T &pData, enum ReduceOperator pOp)
 
template<class T >
void AlltoAll (T &pSendData, T &pRecvData)
 
template<class T1 , class T2 >
void AlltoAllv (T1 &pSendData, T2 &pSendDataSizeMap, T2 &pSendDataOffsetMap, T1 &pRecvData, T2 &pRecvDataSizeMap, T2 &pRecvDataOffsetMap)
 
template<class T >
void AllGather (T &pSendData, T &pRecvData)
 
template<class T >
void AllGatherv (T &pSendData, T &pRecvData, Array< OneD, int > &pRecvDataSizeMap, Array< OneD, int > &pRecvDataOffsetMap)
 
template<class T >
void AllGatherv (T &pRecvData, Array< OneD, int > &pRecvDataSizeMap, Array< OneD, int > &pRecvDataOffsetMap)
 
template<class T >
void Bcast (T &pData, int pRoot)
 
template<class T >
Gather (int rootProc, T &val)
 
template<class T >
Scatter (int rootProc, T &pData)
 
template<class T >
void DistGraphCreateAdjacent (T &sources, T &sourceweights, int reorder)
 
template<class T1 , class T2 >
void NeighborAlltoAllv (T1 &pSendData, T2 &pSendDataSizeMap, T2 &pSendDataOffsetMap, T1 &pRecvData, T2 &pRecvDataSizeMap, T2 &pRecvDataOffsetMap)
 
template<class T >
void Irsend (int pProc, T &pData, int count, const CommRequestSharedPtr &request, int loc)
 
template<class T >
void Isend (int pProc, T &pData, int count, const CommRequestSharedPtr &request, int loc)
 
template<class T >
void SendInit (int pProc, T &pData, int count, const CommRequestSharedPtr &request, int loc)
 
template<class T >
void Irecv (int pProc, T &pData, int count, const CommRequestSharedPtr &request, int loc)
 
template<class T >
void RecvInit (int pProc, T &pData, int count, const CommRequestSharedPtr &request, int loc)
 
void StartAll (const CommRequestSharedPtr &request)
 
void WaitAll (const CommRequestSharedPtr &request)
 
CommRequestSharedPtr CreateRequest (int num)
 
CommSharedPtr CommCreateIf (int flag)
 If the flag is non-zero create a new communicator. More...
 
void SplitComm (int pRows, int pColumns, int pTime=1)
 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...
 
CommSharedPtr GetTimeComm ()
 Retrieve the time communicator to which this process belongs. More...
 
CommSharedPtr GetSpaceComm ()
 Retrieve the space communicator to which this process belongs. More...
 
bool RemoveExistingFiles ()
 
std::pair< CommSharedPtr, CommSharedPtrSplitCommNode ()
 

Protected Member Functions

 Comm ()
 
virtual void v_Finalise ()=0
 
virtual int v_GetRank ()=0
 
virtual bool v_TreatAsRankZero ()=0
 
virtual bool v_IsSerial ()=0
 
virtual std::tuple< int, int, int > v_GetVersion ()=0
 
virtual void v_Block ()=0
 
virtual NekDouble v_Wtime ()=0
 
virtual void v_Send (void *buf, int count, CommDataType dt, int dest)=0
 
virtual void v_Recv (void *buf, int count, CommDataType dt, int source)=0
 
virtual void v_SendRecv (void *sendbuf, int sendcount, CommDataType sendtype, int dest, void *recvbuf, int recvcount, CommDataType recvtype, int source)=0
 
virtual void v_AllReduce (void *buf, int count, CommDataType dt, enum ReduceOperator pOp)=0
 
virtual void v_AlltoAll (void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype)=0
 
virtual void v_AlltoAllv (void *sendbuf, int sendcounts[], int sensdispls[], CommDataType sendtype, void *recvbuf, int recvcounts[], int rdispls[], CommDataType recvtype)=0
 
virtual void v_AllGather (void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype)=0
 
virtual void v_AllGatherv (void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcounts[], int rdispls[], CommDataType recvtype)=0
 
virtual void v_AllGatherv (void *recvbuf, int recvcounts[], int rdispls[], CommDataType recvtype)=0
 
virtual void v_Bcast (void *buffer, int count, CommDataType dt, int root)=0
 
virtual void v_Gather (void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype, int root)=0
 
virtual void v_Scatter (void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype, int root)=0
 
virtual void v_DistGraphCreateAdjacent (int indegree, const int sources[], const int sourceweights[], int reorder)=0
 
virtual void v_NeighborAlltoAllv (void *sendbuf, int sendcounts[], int sdispls[], CommDataType sendtype, void *recvbuf, int recvcounts[], int rdispls[], CommDataType recvtype)=0
 
virtual void v_Irsend (void *buf, int count, CommDataType dt, int dest, CommRequestSharedPtr request, int loc)=0
 
virtual void v_Isend (void *buf, int count, CommDataType dt, int dest, CommRequestSharedPtr request, int loc)=0
 
virtual void v_SendInit (void *buf, int count, CommDataType dt, int dest, CommRequestSharedPtr request, int loc)=0
 
virtual void v_Irecv (void *buf, int count, CommDataType dt, int source, CommRequestSharedPtr request, int loc)=0
 
virtual void v_RecvInit (void *buf, int count, CommDataType dt, int source, CommRequestSharedPtr request, int loc)=0
 
virtual void v_StartAll (CommRequestSharedPtr request)=0
 
virtual void v_WaitAll (CommRequestSharedPtr request)=0
 
virtual CommRequestSharedPtr v_CreateRequest (int num)=0
 
virtual void v_SplitComm (int pRows, int pColumns, int pTime)=0
 
virtual CommSharedPtr v_CommCreateIf (int flag)=0
 
virtual std::pair< CommSharedPtr, CommSharedPtrv_SplitCommNode ()
 

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...
 
CommSharedPtr m_commTime
 
CommSharedPtr m_commSpace
 

Detailed Description

Base communications class.

Definition at line 87 of file Comm.h.

Constructor & Destructor Documentation

◆ Comm() [1/2]

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

Definition at line 39 of file Communication/Comm.cpp.

40{
41}

◆ ~Comm()

Nektar::LibUtilities::Comm::~Comm ( )
virtual

Definition at line 53 of file Communication/Comm.cpp.

54{
55}

◆ Comm() [2/2]

Nektar::LibUtilities::Comm::Comm ( )
protected

Definition at line 46 of file Communication/Comm.cpp.

47{
48}

Member Function Documentation

◆ AllGather()

template<class T >
void Nektar::LibUtilities::Comm::AllGather ( T &  pSendData,
T &  pRecvData 
)

Definition at line 425 of file Comm.h.

426{
427 BOOST_STATIC_ASSERT_MSG(
429 "AllGather only valid with Array or vector arguments.");
430
431 int sendSize = CommDataTypeTraits<T>::GetCount(pSendData);
432 int recvSize = sendSize;
433
434 pRecvData = T(recvSize * GetSize());
435
438 CommDataTypeTraits<T>::GetPointer(pRecvData), recvSize,
440}
int GetSize() const
Returns number of processes.
Definition: Comm.h:264
virtual void v_AllGather(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype)=0

References Nektar::LibUtilities::CommDataTypeTraits< T >::GetCount(), GetSize(), and v_AllGather().

◆ AllGatherv() [1/2]

template<class T >
void Nektar::LibUtilities::Comm::AllGatherv ( T &  pRecvData,
Array< OneD, int > &  pRecvDataSizeMap,
Array< OneD, int > &  pRecvDataOffsetMap 
)

Definition at line 467 of file Comm.h.

469{
470 BOOST_STATIC_ASSERT_MSG(
472 "AllGatherv only valid with Array or vector arguments.");
473
475 pRecvDataSizeMap.get(), pRecvDataOffsetMap.get(),
477}
virtual void v_AllGatherv(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcounts[], int rdispls[], CommDataType recvtype)=0

References v_AllGatherv().

◆ AllGatherv() [2/2]

template<class T >
void Nektar::LibUtilities::Comm::AllGatherv ( T &  pSendData,
T &  pRecvData,
Array< OneD, int > &  pRecvDataSizeMap,
Array< OneD, int > &  pRecvDataOffsetMap 
)

Definition at line 446 of file Comm.h.

449{
450 BOOST_STATIC_ASSERT_MSG(
452 "AllGatherv only valid with Array or vector arguments.");
453
454 int sendSize = CommDataTypeTraits<T>::GetCount(pSendData);
455
459 pRecvDataSizeMap.get(), pRecvDataOffsetMap.get(),
461}

References Nektar::LibUtilities::CommDataTypeTraits< T >::GetCount(), and v_AllGatherv().

◆ AllReduce()

template<class T >
void Nektar::LibUtilities::Comm::AllReduce ( T &  pData,
enum ReduceOperator  pOp 
)

Definition at line 370 of file Comm.h.

371{
375}
virtual void v_AllReduce(void *buf, int count, CommDataType dt, enum ReduceOperator pOp)=0

References v_AllReduce().

◆ AlltoAll()

template<class T >
void Nektar::LibUtilities::Comm::AlltoAll ( T &  pSendData,
T &  pRecvData 
)

Definition at line 380 of file Comm.h.

381{
383 "AlltoAll only valid with Array or vector arguments.");
384 int sendSize = CommDataTypeTraits<T>::GetCount(pSendData);
385 int recvSize = CommDataTypeTraits<T>::GetCount(pRecvData);
386 ASSERTL0(sendSize == recvSize,
387 "Send and Recv arrays have incompatible sizes in AlltoAll");
388
389 int count = sendSize / GetSize();
390 ASSERTL0(count * GetSize() == sendSize,
391 "Array size incompatible with size of communicator");
392
395 CommDataTypeTraits<T>::GetPointer(pRecvData), count,
397}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
virtual void v_AlltoAll(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype)=0

References ASSERTL0, Nektar::LibUtilities::CommDataTypeTraits< T >::GetCount(), GetSize(), and v_AlltoAll().

◆ AlltoAllv()

template<class T1 , class T2 >
void Nektar::LibUtilities::Comm::AlltoAllv ( T1 &  pSendData,
T2 &  pSendDataSizeMap,
T2 &  pSendDataOffsetMap,
T1 &  pRecvData,
T2 &  pRecvDataSizeMap,
T2 &  pRecvDataOffsetMap 
)

Definition at line 403 of file Comm.h.

406{
408 "AlltoAllv only valid with Array or vector arguments.");
409 static_assert(std::is_same<T2, std::vector<int>>::value ||
410 std::is_same<T2, Array<OneD, int>>::value,
411 "Alltoallv size and offset maps should be integer vectors.");
413 (int *)CommDataTypeTraits<T2>::GetPointer(pSendDataSizeMap),
414 (int *)CommDataTypeTraits<T2>::GetPointer(pSendDataOffsetMap),
417 (int *)CommDataTypeTraits<T2>::GetPointer(pRecvDataSizeMap),
418 (int *)CommDataTypeTraits<T2>::GetPointer(pRecvDataOffsetMap),
420}
virtual void v_AlltoAllv(void *sendbuf, int sendcounts[], int sensdispls[], CommDataType sendtype, void *recvbuf, int recvcounts[], int rdispls[], CommDataType recvtype)=0

References v_AlltoAllv().

◆ Bcast()

template<class T >
void Nektar::LibUtilities::Comm::Bcast ( T &  pData,
int  pRoot 
)

Definition at line 482 of file Comm.h.

483{
487}
virtual void v_Bcast(void *buffer, int count, CommDataType dt, int root)=0

References v_Bcast().

◆ Block()

void Nektar::LibUtilities::Comm::Block ( )
inline

Block execution until all processes reach this point.

Definition at line 320 of file Comm.h.

321{
322 v_Block();
323}
virtual void v_Block()=0

References v_Block().

◆ CommCreateIf()

CommSharedPtr Nektar::LibUtilities::Comm::CommCreateIf ( int  flag)
inline

If the flag is non-zero create a new communicator.

Definition at line 722 of file Comm.h.

723{
724 return v_CommCreateIf(flag);
725}
virtual CommSharedPtr v_CommCreateIf(int flag)=0

References v_CommCreateIf().

◆ CreateRequest()

CommRequestSharedPtr Nektar::LibUtilities::Comm::CreateRequest ( int  num)
inline

Creates a number of CommRequests.

Parameters
numNumber of requests to generate in the communication request object
Returns
Communication request object

Definition at line 714 of file Comm.h.

715{
716 return v_CreateRequest(num);
717}
virtual CommRequestSharedPtr v_CreateRequest(int num)=0

References v_CreateRequest().

◆ DistGraphCreateAdjacent()

template<class T >
void Nektar::LibUtilities::Comm::DistGraphCreateAdjacent ( T &  sources,
T &  sourceweights,
int  reorder 
)

This replaces the current MPI communicator with a new one that also holds the distributed graph topology information. If reordering is enabled using this might break code where process/rank numbers are assumed to remain constant. This also assumes that the graph is bi-directional, so all sources are also destinations with equal weighting.

Parameters
sourcesRanks of processes for which the calling process is the destination/source
sourceweightsWeights of the corresponding edges into the calling process
reorderRanks may be reordered (true) or not (false)

Definition at line 544 of file Comm.h.

545{
546 static_assert(
548 "DistGraphCreateAdjacent only valid with Array or vector arguments.");
549
551 CommDataTypeTraits<T>::GetCount(sourceweights),
552 "Sources and weights array sizes don't match");
553
554 int indegree = CommDataTypeTraits<T>::GetCount(sources);
555
557 indegree, (const int *)CommDataTypeTraits<T>::GetPointer(sources),
558 (const int *)CommDataTypeTraits<T>::GetPointer(sourceweights), reorder);
559}
virtual void v_DistGraphCreateAdjacent(int indegree, const int sources[], const int sourceweights[], int reorder)=0

References ASSERTL0, Nektar::LibUtilities::CommDataTypeTraits< T >::GetCount(), and v_DistGraphCreateAdjacent().

◆ Finalise()

void Nektar::LibUtilities::Comm::Finalise ( )
inline

Definition at line 256 of file Comm.h.

257{
258 v_Finalise();
259}
virtual void v_Finalise()=0

References v_Finalise().

◆ Gather()

template<class T >
T Nektar::LibUtilities::Comm::Gather ( int  rootProc,
T &  val 
)

Concatenate all the input arrays, in rank order, onto the process with rank == rootProc

Definition at line 493 of file Comm.h.

494{
496 "Gather only valid with Array or vector arguments.");
497 bool amRoot = (GetRank() == rootProc);
498 unsigned nEl = CommDataTypeTraits<T>::GetCount(val);
499
500 unsigned nOut = amRoot ? GetSize() * nEl : 0;
501 T ans(nOut);
502 void *recvbuf = amRoot ? CommDataTypeTraits<T>::GetPointer(ans) : nullptr;
503
507 return ans;
508}
virtual void v_Gather(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype, int root)=0

References Nektar::LibUtilities::CommDataTypeTraits< T >::GetCount(), Nektar::LibUtilities::CommDataTypeTraits< T >::GetPointer(), GetRank(), GetSize(), and v_Gather().

◆ GetColumnComm()

CommSharedPtr Nektar::LibUtilities::Comm::GetColumnComm ( )
inline

Retrieve the column communicator to which this process belongs.

Definition at line 756 of file Comm.h.

757{
758 if (!m_commColumn.get())
759 {
760 return shared_from_this();
761 }
762 else
763 {
764 return m_commColumn;
765 }
766}
CommSharedPtr m_commColumn
Column communicator.
Definition: Comm.h:178

References m_commColumn.

◆ GetRank()

int Nektar::LibUtilities::Comm::GetRank ( )
inline

Definition at line 272 of file Comm.h.

273{
274 return v_GetRank();
275}
virtual int v_GetRank()=0

References v_GetRank().

Referenced by Gather(), and Scatter().

◆ GetRowComm()

CommSharedPtr Nektar::LibUtilities::Comm::GetRowComm ( )
inline

Retrieve the row communicator to which this process belongs.

Definition at line 740 of file Comm.h.

741{
742 if (!m_commRow.get())
743 {
744 return shared_from_this();
745 }
746 else
747 {
748 return m_commRow;
749 }
750}
CommSharedPtr m_commRow
Row communicator.
Definition: Comm.h:177

References m_commRow.

◆ GetSize()

int Nektar::LibUtilities::Comm::GetSize ( ) const
inline

Returns number of processes.

Definition at line 264 of file Comm.h.

265{
266 return m_size;
267}
int m_size
Number of processes.
Definition: Comm.h:175

References m_size.

Referenced by AllGather(), AlltoAll(), Gather(), Scatter(), and Nektar::LibUtilities::CommMpi::v_AllReduce().

◆ GetSpaceComm()

CommSharedPtr Nektar::LibUtilities::Comm::GetSpaceComm ( )
inline

Retrieve the space communicator to which this process belongs.

Definition at line 788 of file Comm.h.

789{
790 if (!m_commSpace.get())
791 {
792 return shared_from_this();
793 }
794 else
795 {
796 return m_commSpace;
797 }
798}
CommSharedPtr m_commSpace
Definition: Comm.h:180

References m_commSpace.

◆ GetTimeComm()

CommSharedPtr Nektar::LibUtilities::Comm::GetTimeComm ( )
inline

Retrieve the time communicator to which this process belongs.

Definition at line 772 of file Comm.h.

773{
774 if (!m_commTime.get())
775 {
776 return shared_from_this();
777 }
778 else
779 {
780 return m_commTime;
781 }
782}
CommSharedPtr m_commTime
Definition: Comm.h:179

References m_commTime.

◆ GetType()

const std::string & Nektar::LibUtilities::Comm::GetType ( ) const
inline

Definition at line 280 of file Comm.h.

281{
282 return m_type;
283}
std::string m_type
Type of communication.
Definition: Comm.h:176

References m_type.

◆ GetVersion()

std::tuple< int, int, int > Nektar::LibUtilities::Comm::GetVersion ( )
inline
Returns
tuple of {major, minor, patch} version numbers

Definition at line 312 of file Comm.h.

313{
314 return v_GetVersion();
315}
virtual std::tuple< int, int, int > v_GetVersion()=0

References v_GetVersion().

◆ Irecv()

template<class T >
void Nektar::LibUtilities::Comm::Irecv ( int  pProc,
T &  pData,
int  count,
const CommRequestSharedPtr request,
int  loc 
)

Begins a nonblocking receive

Parameters
pProcRank of source
pDataArray/vector to place incoming data in to
countNumber of elements to receive in to pData
requestCommunication request object
locLocation in request to use

Definition at line 663 of file Comm.h.

665{
667 CommDataTypeTraits<T>::GetDataType(), pProc, request, loc);
668}
virtual void v_Irecv(void *buf, int count, CommDataType dt, int source, CommRequestSharedPtr request, int loc)=0

References CG_Iterations::loc, and v_Irecv().

◆ Irsend()

template<class T >
void Nektar::LibUtilities::Comm::Irsend ( int  pProc,
T &  pData,
int  count,
const CommRequestSharedPtr request,
int  loc 
)

Starts a ready-mode nonblocking send

Parameters
pProcRank of destination
pDataArray/vector to send
countNumber of elements to send in pData
requestCommunication request object
locLocation in request to use

Definition at line 612 of file Comm.h.

614{
616 CommDataTypeTraits<T>::GetDataType(), pProc, request, loc);
617}
virtual void v_Irsend(void *buf, int count, CommDataType dt, int dest, CommRequestSharedPtr request, int loc)=0

References CG_Iterations::loc, and v_Irsend().

◆ Isend()

template<class T >
void Nektar::LibUtilities::Comm::Isend ( int  pProc,
T &  pData,
int  count,
const CommRequestSharedPtr request,
int  loc 
)

Starts a nonblocking send

Parameters
pProcRank of destination
pDataArray/vector to send
countNumber of elements to send in pData
requestCommunication request object
locLocation in request to use

Definition at line 629 of file Comm.h.

631{
633 CommDataTypeTraits<T>::GetDataType(), pProc, request, loc);
634}
virtual void v_Isend(void *buf, int count, CommDataType dt, int dest, CommRequestSharedPtr request, int loc)=0

References CG_Iterations::loc, and v_Isend().

◆ IsParallelInTime()

bool Nektar::LibUtilities::Comm::IsParallelInTime ( )
inline

Definition at line 304 of file Comm.h.

305{
306 return m_commTime.get();
307}

References m_commTime.

◆ IsSerial()

bool Nektar::LibUtilities::Comm::IsSerial ( )
inline

Definition at line 296 of file Comm.h.

297{
298 return v_IsSerial();
299}
virtual bool v_IsSerial()=0

References v_IsSerial().

◆ NeighborAlltoAllv()

template<class T1 , class T2 >
void Nektar::LibUtilities::Comm::NeighborAlltoAllv ( T1 &  pSendData,
T2 &  pSendDataSizeMap,
T2 &  pSendDataOffsetMap,
T1 &  pRecvData,
T2 &  pRecvDataSizeMap,
T2 &  pRecvDataOffsetMap 
)

Sends data to neighboring processes in a virtual topology communicator. All processes send different amounts of data to, and receive different amounts of data from, all neighbors

Parameters
pSendDataArray/vector to send to neighbors
pSendDataSizeMapArray/vector where entry i specifies the number of elements to send to neighbor i
pSendDataOffsetMapArray/vector where entry i specifies the displacement (offset from pSendData) from which to send data to neighbor i
pRecvDataArray/vector to place incoming data in to
pRecvDataSizeMapArray/vector where entry i specifies the number of elements to receive from neighbor i
pRecvDataOffsetMapArray/vector where entry i specifies the displacement (offset from pRecvData) from which to receive data from neighbor i

Definition at line 580 of file Comm.h.

583{
584 static_assert(
586 "NeighbourAlltoAllv only valid with Array or vector arguments.");
587 static_assert(
588 std::is_same<T2, std::vector<int>>::value ||
589 std::is_same<T2, Array<OneD, int>>::value,
590 "NeighborAllToAllv size and offset maps should be integer vectors.");
593 (int *)CommDataTypeTraits<T2>::GetPointer(pSendDataSizeMap),
594 (int *)CommDataTypeTraits<T2>::GetPointer(pSendDataOffsetMap),
597 (int *)CommDataTypeTraits<T2>::GetPointer(pRecvDataSizeMap),
598 (int *)CommDataTypeTraits<T2>::GetPointer(pRecvDataOffsetMap),
600}
virtual void v_NeighborAlltoAllv(void *sendbuf, int sendcounts[], int sdispls[], CommDataType sendtype, void *recvbuf, int recvcounts[], int rdispls[], CommDataType recvtype)=0

References v_NeighborAlltoAllv().

◆ Recv()

template<class T >
void Nektar::LibUtilities::Comm::Recv ( int  pProc,
T &  pData 
)

Definition at line 346 of file Comm.h.

347{
351}
virtual void v_Recv(void *buf, int count, CommDataType dt, int source)=0

References v_Recv().

◆ RecvInit()

template<class T >
void Nektar::LibUtilities::Comm::RecvInit ( int  pProc,
T &  pData,
int  count,
const CommRequestSharedPtr request,
int  loc 
)

Create a persistent request for a receive

Parameters
pProcRank of source
pDataArray/vector to place incoming data in to
countNumber of elements to receive in to pData
requestCommunication request object
locLocation in request to use

Definition at line 680 of file Comm.h.

682{
684 CommDataTypeTraits<T>::GetDataType(), pProc, request, loc);
685}
virtual void v_RecvInit(void *buf, int count, CommDataType dt, int source, CommRequestSharedPtr request, int loc)=0

References CG_Iterations::loc, and v_RecvInit().

◆ RemoveExistingFiles()

bool Nektar::LibUtilities::Comm::RemoveExistingFiles ( )
inline

Definition at line 803 of file Comm.h.

804{
805 return true;
806}

◆ Scatter()

template<class T >
T Nektar::LibUtilities::Comm::Scatter ( int  rootProc,
T &  pData 
)

Scatter pData across ranks in chunks of len(pData)/num_ranks

Definition at line 513 of file Comm.h.

514{
516 "Scatter only valid with Array or vector arguments.");
517
518 bool amRoot = (GetRank() == rootProc);
519 unsigned nEl = CommDataTypeTraits<T>::GetCount(pData) / GetSize();
520
521 void *sendbuf = amRoot ? CommDataTypeTraits<T>::GetPointer(pData) : nullptr;
522 T ans(nEl);
523
527 return ans;
528}
virtual void v_Scatter(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype, int root)=0

References Nektar::LibUtilities::CommDataTypeTraits< T >::GetCount(), Nektar::LibUtilities::CommDataTypeTraits< T >::GetPointer(), GetRank(), GetSize(), and v_Scatter().

◆ Send()

template<class T >
void Nektar::LibUtilities::Comm::Send ( int  pProc,
T &  pData 
)

Definition at line 336 of file Comm.h.

337{
341}
virtual void v_Send(void *buf, int count, CommDataType dt, int dest)=0

References v_Send().

◆ SendInit()

template<class T >
void Nektar::LibUtilities::Comm::SendInit ( int  pProc,
T &  pData,
int  count,
const CommRequestSharedPtr request,
int  loc 
)

Creates a persistent request for a send

Parameters
pProcRank of destination
pDataArray/vector to send
countNumber of elements to send in pData
requestCommunication request object
locLocation in request to use

Definition at line 646 of file Comm.h.

648{
650 CommDataTypeTraits<T>::GetDataType(), pProc, request, loc);
651}
virtual void v_SendInit(void *buf, int count, CommDataType dt, int dest, CommRequestSharedPtr request, int loc)=0

References CG_Iterations::loc, and v_SendInit().

◆ SendRecv()

template<class T >
void Nektar::LibUtilities::Comm::SendRecv ( int  pSendProc,
T &  pSendData,
int  pRecvProc,
T &  pRecvData 
)

Definition at line 357 of file Comm.h.

358{
365}
virtual void v_SendRecv(void *sendbuf, int sendcount, CommDataType sendtype, int dest, void *recvbuf, int recvcount, CommDataType recvtype, int source)=0

References v_SendRecv().

◆ SplitComm()

void Nektar::LibUtilities::Comm::SplitComm ( int  pRows,
int  pColumns,
int  pTime = 1 
)
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 732 of file Comm.h.

733{
734 v_SplitComm(pRows, pColumns, pTime);
735}
virtual void v_SplitComm(int pRows, int pColumns, int pTime)=0

References v_SplitComm().

◆ SplitCommNode()

std::pair< CommSharedPtr, CommSharedPtr > Nektar::LibUtilities::Comm::SplitCommNode ( )
inline

Definition at line 811 of file Comm.h.

812{
813 return v_SplitCommNode();
814}
virtual std::pair< CommSharedPtr, CommSharedPtr > v_SplitCommNode()

References v_SplitCommNode().

◆ StartAll()

void Nektar::LibUtilities::Comm::StartAll ( const CommRequestSharedPtr request)
inline

Starts a collection of persistent requests

Parameters
requestCommunication request object

Definition at line 692 of file Comm.h.

693{
694 v_StartAll(request);
695}
virtual void v_StartAll(CommRequestSharedPtr request)=0

References v_StartAll().

◆ TreatAsRankZero()

bool Nektar::LibUtilities::Comm::TreatAsRankZero ( )
inline

Definition at line 288 of file Comm.h.

289{
290 return v_TreatAsRankZero();
291}
virtual bool v_TreatAsRankZero()=0

References v_TreatAsRankZero().

◆ v_AllGather()

virtual void Nektar::LibUtilities::Comm::v_AllGather ( void sendbuf,
int  sendcount,
CommDataType  sendtype,
void recvbuf,
int  recvcount,
CommDataType  recvtype 
)
protectedpure virtual

◆ v_AllGatherv() [1/2]

virtual void Nektar::LibUtilities::Comm::v_AllGatherv ( void recvbuf,
int  recvcounts[],
int  rdispls[],
CommDataType  recvtype 
)
protectedpure virtual

◆ v_AllGatherv() [2/2]

virtual void Nektar::LibUtilities::Comm::v_AllGatherv ( void sendbuf,
int  sendcount,
CommDataType  sendtype,
void recvbuf,
int  recvcounts[],
int  rdispls[],
CommDataType  recvtype 
)
protectedpure virtual

◆ v_AllReduce()

virtual void Nektar::LibUtilities::Comm::v_AllReduce ( void buf,
int  count,
CommDataType  dt,
enum ReduceOperator  pOp 
)
protectedpure virtual

◆ v_AlltoAll()

virtual void Nektar::LibUtilities::Comm::v_AlltoAll ( void sendbuf,
int  sendcount,
CommDataType  sendtype,
void recvbuf,
int  recvcount,
CommDataType  recvtype 
)
protectedpure virtual

◆ v_AlltoAllv()

virtual void Nektar::LibUtilities::Comm::v_AlltoAllv ( void sendbuf,
int  sendcounts[],
int  sensdispls[],
CommDataType  sendtype,
void recvbuf,
int  recvcounts[],
int  rdispls[],
CommDataType  recvtype 
)
protectedpure virtual

◆ v_Bcast()

virtual void Nektar::LibUtilities::Comm::v_Bcast ( void buffer,
int  count,
CommDataType  dt,
int  root 
)
protectedpure virtual

◆ v_Block()

virtual void Nektar::LibUtilities::Comm::v_Block ( )
protectedpure virtual

◆ v_CommCreateIf()

virtual CommSharedPtr Nektar::LibUtilities::Comm::v_CommCreateIf ( int  flag)
protectedpure virtual

◆ v_CreateRequest()

virtual CommRequestSharedPtr Nektar::LibUtilities::Comm::v_CreateRequest ( int  num)
protectedpure virtual

◆ v_DistGraphCreateAdjacent()

virtual void Nektar::LibUtilities::Comm::v_DistGraphCreateAdjacent ( int  indegree,
const int  sources[],
const int  sourceweights[],
int  reorder 
)
protectedpure virtual

◆ v_Finalise()

virtual void Nektar::LibUtilities::Comm::v_Finalise ( )
protectedpure virtual

◆ v_Gather()

virtual void Nektar::LibUtilities::Comm::v_Gather ( void sendbuf,
int  sendcount,
CommDataType  sendtype,
void recvbuf,
int  recvcount,
CommDataType  recvtype,
int  root 
)
protectedpure virtual

◆ v_GetRank()

virtual int Nektar::LibUtilities::Comm::v_GetRank ( )
protectedpure virtual

◆ v_GetVersion()

virtual std::tuple< int, int, int > Nektar::LibUtilities::Comm::v_GetVersion ( )
protectedpure virtual

◆ v_Irecv()

virtual void Nektar::LibUtilities::Comm::v_Irecv ( void buf,
int  count,
CommDataType  dt,
int  source,
CommRequestSharedPtr  request,
int  loc 
)
protectedpure virtual

◆ v_Irsend()

virtual void Nektar::LibUtilities::Comm::v_Irsend ( void buf,
int  count,
CommDataType  dt,
int  dest,
CommRequestSharedPtr  request,
int  loc 
)
protectedpure virtual

◆ v_Isend()

virtual void Nektar::LibUtilities::Comm::v_Isend ( void buf,
int  count,
CommDataType  dt,
int  dest,
CommRequestSharedPtr  request,
int  loc 
)
protectedpure virtual

◆ v_IsSerial()

virtual bool Nektar::LibUtilities::Comm::v_IsSerial ( )
protectedpure virtual

◆ v_NeighborAlltoAllv()

virtual void Nektar::LibUtilities::Comm::v_NeighborAlltoAllv ( void sendbuf,
int  sendcounts[],
int  sdispls[],
CommDataType  sendtype,
void recvbuf,
int  recvcounts[],
int  rdispls[],
CommDataType  recvtype 
)
protectedpure virtual

◆ v_Recv()

virtual void Nektar::LibUtilities::Comm::v_Recv ( void buf,
int  count,
CommDataType  dt,
int  source 
)
protectedpure virtual

◆ v_RecvInit()

virtual void Nektar::LibUtilities::Comm::v_RecvInit ( void buf,
int  count,
CommDataType  dt,
int  source,
CommRequestSharedPtr  request,
int  loc 
)
protectedpure virtual

◆ v_Scatter()

virtual void Nektar::LibUtilities::Comm::v_Scatter ( void sendbuf,
int  sendcount,
CommDataType  sendtype,
void recvbuf,
int  recvcount,
CommDataType  recvtype,
int  root 
)
protectedpure virtual

◆ v_Send()

virtual void Nektar::LibUtilities::Comm::v_Send ( void buf,
int  count,
CommDataType  dt,
int  dest 
)
protectedpure virtual

◆ v_SendInit()

virtual void Nektar::LibUtilities::Comm::v_SendInit ( void buf,
int  count,
CommDataType  dt,
int  dest,
CommRequestSharedPtr  request,
int  loc 
)
protectedpure virtual

◆ v_SendRecv()

virtual void Nektar::LibUtilities::Comm::v_SendRecv ( void sendbuf,
int  sendcount,
CommDataType  sendtype,
int  dest,
void recvbuf,
int  recvcount,
CommDataType  recvtype,
int  source 
)
protectedpure virtual

◆ v_SplitComm()

virtual void Nektar::LibUtilities::Comm::v_SplitComm ( int  pRows,
int  pColumns,
int  pTime 
)
protectedpure virtual

◆ v_SplitCommNode()

std::pair< CommSharedPtr, CommSharedPtr > Nektar::LibUtilities::Comm::v_SplitCommNode ( )
protectedvirtual

Reimplemented in Nektar::LibUtilities::CommMpi.

Definition at line 69 of file Communication/Comm.cpp.

70{
71 return std::make_pair(CommSharedPtr(), CommSharedPtr());
72}
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:55

Referenced by SplitCommNode().

◆ v_StartAll()

virtual void Nektar::LibUtilities::Comm::v_StartAll ( CommRequestSharedPtr  request)
protectedpure virtual

◆ v_TreatAsRankZero()

virtual bool Nektar::LibUtilities::Comm::v_TreatAsRankZero ( )
protectedpure virtual

◆ v_WaitAll()

virtual void Nektar::LibUtilities::Comm::v_WaitAll ( CommRequestSharedPtr  request)
protectedpure virtual

◆ v_Wtime()

virtual NekDouble Nektar::LibUtilities::Comm::v_Wtime ( )
protectedpure virtual

◆ WaitAll()

void Nektar::LibUtilities::Comm::WaitAll ( const CommRequestSharedPtr request)
inline

Waits for all CommRequests in the request object to complete.

Parameters
requestCommunication request object

Definition at line 702 of file Comm.h.

703{
704 v_WaitAll(request);
705}
virtual void v_WaitAll(CommRequestSharedPtr request)=0

References v_WaitAll().

◆ Wtime()

double Nektar::LibUtilities::Comm::Wtime ( )
inline

Return the time in seconds.

Definition at line 328 of file Comm.h.

329{
330 return v_Wtime();
331}
virtual NekDouble v_Wtime()=0

References v_Wtime().

Member Data Documentation

◆ m_commColumn

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

◆ m_commRow

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

◆ m_commSpace

CommSharedPtr Nektar::LibUtilities::Comm::m_commSpace
protected

Definition at line 180 of file Comm.h.

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

◆ m_commTime

CommSharedPtr Nektar::LibUtilities::Comm::m_commTime
protected

◆ m_size

int Nektar::LibUtilities::Comm::m_size
protected

◆ m_type

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