Nektar++
CommSerial.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File CommSerial.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: CommSerial header
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 #ifndef NEKTAR_LIB_UTILITIES_COMMSERIAL_H
35 #define NEKTAR_LIB_UTILITIES_COMMSERIAL_H
36 
37 #include <string>
38 
42 
43 namespace Nektar
44 {
45 namespace LibUtilities
46 {
47 // Forward declarations
48 class CommSerial;
49 
50 /// Pointer to a Communicator object.
51 typedef std::shared_ptr<CommSerial> CommSerialSharedPtr;
52 
53 /// A global linear system.
54 class CommSerial : public Comm
55 {
56 public:
57  /// Creates an instance of this class
58  LIB_UTILITIES_EXPORT static CommSharedPtr create(int narg, char *arg[])
59  {
61  }
62 
63  /// Name of class
64  LIB_UTILITIES_EXPORT static std::string className;
65 
66  LIB_UTILITIES_EXPORT CommSerial(int argc, char *argv[]);
68 
69 protected:
70  LIB_UTILITIES_EXPORT virtual void v_Finalise();
71  LIB_UTILITIES_EXPORT virtual int v_GetRank();
72  LIB_UTILITIES_EXPORT virtual bool v_TreatAsRankZero(void);
73  LIB_UTILITIES_EXPORT virtual bool v_IsSerial(void);
74 
75  LIB_UTILITIES_EXPORT virtual void v_Block();
77  LIB_UTILITIES_EXPORT virtual void v_Send(void *buf, int count,
78  CommDataType dt, int dest);
79  LIB_UTILITIES_EXPORT virtual void v_Recv(void *buf, int count,
80  CommDataType dt, int source);
81  LIB_UTILITIES_EXPORT virtual void v_SendRecv(
82  void *sendbuf, int sendcount, CommDataType sendtype, int dest,
83  void *recvbuf, int recvcount, CommDataType recvtype, int source);
84  LIB_UTILITIES_EXPORT virtual void v_SendRecvReplace(void *buf, int count,
85  CommDataType dt,
86  int pSendProc,
87  int pRecvProc);
88  LIB_UTILITIES_EXPORT virtual void v_AllReduce(void *buf, int count,
89  CommDataType dt,
90  enum ReduceOperator pOp);
91  LIB_UTILITIES_EXPORT virtual void v_AlltoAll(void *sendbuf, int sendcount,
92  CommDataType sendtype,
93  void *recvbuf, int recvcount,
94  CommDataType recvtype);
95  LIB_UTILITIES_EXPORT virtual void v_AlltoAllv(
96  void *sendbuf, int sendcounts[], int sensdispls[],
97  CommDataType sendtype, void *recvbuf, int recvcounts[], int rdispls[],
98  CommDataType recvtype);
99  LIB_UTILITIES_EXPORT virtual void v_AllGather(void *sendbuf, int sendcount,
100  CommDataType sendtype,
101  void *recvbuf, int recvcount,
102  CommDataType recvtype);
103  LIB_UTILITIES_EXPORT virtual void v_AllGatherv(void *sendbuf, int sendcount,
104  CommDataType sendtype,
105  void *recvbuf, int recvcounts[],
106  int rdispls[],
107  CommDataType recvtype);
108  LIB_UTILITIES_EXPORT virtual void v_AllGatherv(void *recvbuf, int recvcounts[],
109  int rdispls[],
110  CommDataType recvtype);
111  LIB_UTILITIES_EXPORT virtual void v_Bcast(void *buffer, int count,
112  CommDataType dt, int root);
113  LIB_UTILITIES_EXPORT virtual void v_Exscan(
114  Array<OneD, unsigned long long> &pData, const enum ReduceOperator pOp,
116  LIB_UTILITIES_EXPORT virtual void v_Gather(void *sendbuf, int sendcount,
117  CommDataType sendtype,
118  void *recvbuf, int recvcount,
119  CommDataType recvtype, int root);
120  LIB_UTILITIES_EXPORT virtual void v_Scatter(void *sendbuf, int sendcount,
121  CommDataType sendtype,
122  void *recvbuf, int recvcount,
123  CommDataType recvtype,
124  int root);
125 
126  LIB_UTILITIES_EXPORT virtual void v_SplitComm(int pRows, int pColumns);
128 };
129 }
130 }
131 
132 #endif
virtual void v_SendRecvReplace(void *buf, int count, CommDataType dt, int pSendProc, int pRecvProc)
Definition: CommSerial.cpp:142
virtual void v_SplitComm(int pRows, int pColumns)
Definition: CommSerial.cpp:233
virtual void v_Exscan(Array< OneD, unsigned long long > &pData, const enum ReduceOperator pOp, Array< OneD, unsigned long long > &ans)
Definition: CommSerial.cpp:208
ReduceOperator
Type of operation to perform in AllReduce.
Definition: Comm.h:65
virtual bool v_TreatAsRankZero(void)
Definition: CommSerial.cpp:84
virtual void v_AllGatherv(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcounts[], int rdispls[], CommDataType recvtype)
Definition: CommSerial.cpp:189
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53
array buffer
Definition: GsLib.hpp:61
virtual void v_AlltoAllv(void *sendbuf, int sendcounts[], int sensdispls[], CommDataType sendtype, void *recvbuf, int recvcounts[], int rdispls[], CommDataType recvtype)
Definition: CommSerial.cpp:170
virtual bool v_IsSerial(void)
Definition: CommSerial.cpp:92
std::shared_ptr< CommSerial > CommSerialSharedPtr
Pointer to a Communicator object.
Definition: CommSerial.h:48
virtual void v_Send(void *buf, int count, CommDataType dt, int dest)
Definition: CommSerial.cpp:115
virtual void v_AlltoAll(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype)
Definition: CommSerial.cpp:160
A global linear system.
Definition: CommSerial.h:54
#define LIB_UTILITIES_EXPORT
static CommSharedPtr create(int narg, char *arg[])
Creates an instance of this class.
Definition: CommSerial.h:58
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
virtual void v_Gather(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype, int root)
Definition: CommSerial.cpp:215
double NekDouble
virtual CommSharedPtr v_CommCreateIf(int flag)
Definition: CommSerial.cpp:242
virtual void v_Recv(void *buf, int count, CommDataType dt, int source)
Definition: CommSerial.cpp:123
virtual void v_Bcast(void *buffer, int count, CommDataType dt, int root)
Definition: CommSerial.cpp:203
Base communications class.
Definition: Comm.h:81
CommSerial(int argc, char *argv[])
Definition: CommSerial.cpp:50
virtual void v_AllReduce(void *buf, int count, CommDataType dt, enum ReduceOperator pOp)
Definition: CommSerial.cpp:151
virtual void v_SendRecv(void *sendbuf, int sendcount, CommDataType sendtype, int dest, void *recvbuf, int recvcount, CommDataType recvtype, int source)
Definition: CommSerial.cpp:131
static std::string className
Name of class.
Definition: CommSerial.h:64
virtual void v_AllGather(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype)
Definition: CommSerial.cpp:182
virtual void v_Scatter(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype, int root)
Definition: CommSerial.cpp:223