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
44{
45// Forward declarations
46class CommSerial;
47
48/// Pointer to a Communicator object.
49typedef std::shared_ptr<CommSerial> CommSerialSharedPtr;
50
51/// A global linear system.
52class CommSerial : public Comm
53{
54public:
55 /// Creates an instance of this class
56 LIB_UTILITIES_EXPORT static CommSharedPtr create(int narg, char *arg[])
57 {
59 }
60
61 /// Name of class
62 LIB_UTILITIES_EXPORT static std::string className;
63
64 LIB_UTILITIES_EXPORT CommSerial(int argc, char *argv[]);
66
67protected:
69 LIB_UTILITIES_EXPORT int v_GetRank() override;
71 LIB_UTILITIES_EXPORT bool v_IsSerial() override;
72 LIB_UTILITIES_EXPORT std::tuple<int, int, int> v_GetVersion() final;
73 LIB_UTILITIES_EXPORT void v_Block() final;
75
76 LIB_UTILITIES_EXPORT void v_Send(void *buf, int count, CommDataType dt,
77 int dest) final;
78 LIB_UTILITIES_EXPORT void v_Recv(void *buf, int count, CommDataType dt,
79 int source) final;
80 LIB_UTILITIES_EXPORT void v_SendRecv(void *sendbuf, int sendcount,
81 CommDataType sendtype, int dest,
82 void *recvbuf, int recvcount,
83 CommDataType recvtype,
84 int source) final;
85
86 LIB_UTILITIES_EXPORT void v_AllReduce(void *buf, int count, CommDataType dt,
87 enum ReduceOperator pOp) final;
88
89 LIB_UTILITIES_EXPORT void v_AlltoAll(void *sendbuf, int sendcount,
90 CommDataType sendtype, void *recvbuf,
91 int recvcount,
92 CommDataType recvtype) final;
93 LIB_UTILITIES_EXPORT void v_AlltoAllv(void *sendbuf, int sendcounts[],
94 int sensdispls[],
95 CommDataType sendtype, void *recvbuf,
96 int recvcounts[], int rdispls[],
97 CommDataType recvtype) final;
98
99 LIB_UTILITIES_EXPORT void v_AllGather(void *sendbuf, int sendcount,
100 CommDataType sendtype, void *recvbuf,
101 int recvcount,
102 CommDataType recvtype) final;
103 LIB_UTILITIES_EXPORT void v_AllGatherv(void *sendbuf, int sendcount,
104 CommDataType sendtype, void *recvbuf,
105 int recvcounts[], int rdispls[],
106 CommDataType recvtype) final;
107 LIB_UTILITIES_EXPORT void v_AllGatherv(void *recvbuf, int recvcounts[],
108 int rdispls[],
109 CommDataType recvtype) final;
110
111 LIB_UTILITIES_EXPORT void v_Bcast(void *buffer, int count, CommDataType dt,
112 int root) final;
113 LIB_UTILITIES_EXPORT void v_Gather(void *sendbuf, int sendcount,
114 CommDataType sendtype, void *recvbuf,
115 int recvcount, CommDataType recvtype,
116 int root) final;
117 LIB_UTILITIES_EXPORT void v_Scatter(void *sendbuf, int sendcount,
118 CommDataType sendtype, void *recvbuf,
119 int recvcount, CommDataType recvtype,
120 int root) final;
121
123 int indegree, const int sources[], const int sourceweights[],
124 int reorder) final;
126 void *sendbuf, int sendcounts[], int sdispls[], CommDataType sendtype,
127 void *recvbuf, int recvcounts[], int rdispls[],
128 CommDataType recvtype) final;
129
130 LIB_UTILITIES_EXPORT void v_Irsend(void *buf, int count, CommDataType dt,
131 int dest, CommRequestSharedPtr request,
132 int loc) final;
133 LIB_UTILITIES_EXPORT void v_Isend(void *buf, int count, CommDataType dt,
134 int dest, CommRequestSharedPtr request,
135 int loc) final;
136 LIB_UTILITIES_EXPORT void v_SendInit(void *buf, int count, CommDataType dt,
137 int dest, CommRequestSharedPtr request,
138 int loc) final;
139 LIB_UTILITIES_EXPORT void v_Irecv(void *buf, int count, CommDataType dt,
140 int source, CommRequestSharedPtr request,
141 int loc) final;
142 LIB_UTILITIES_EXPORT void v_RecvInit(void *buf, int count, CommDataType dt,
143 int source,
144 CommRequestSharedPtr request,
145 int loc) final;
146
149
151 LIB_UTILITIES_EXPORT void v_SplitComm(int pRows, int pColumns,
152 int pTime) override;
154};
155} // namespace Nektar::LibUtilities
156
157#endif
#define LIB_UTILITIES_EXPORT
Base communications class.
Definition: Comm.h:88
A global linear system.
Definition: CommSerial.h:53
std::tuple< int, int, int > v_GetVersion() final
Definition: CommSerial.cpp:94
void v_Gather(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype, int root) final
Definition: CommSerial.cpp:224
CommSharedPtr v_CommCreateIf(int flag) final
Definition: CommSerial.cpp:356
void v_SendRecv(void *sendbuf, int sendcount, CommDataType sendtype, int dest, void *recvbuf, int recvcount, CommDataType recvtype, int source) final
Definition: CommSerial.cpp:135
void v_Bcast(void *buffer, int count, CommDataType dt, int root) final
Definition: CommSerial.cpp:214
CommRequestSharedPtr v_CreateRequest(int num) final
Definition: CommSerial.cpp:338
void v_Irecv(void *buf, int count, CommDataType dt, int source, CommRequestSharedPtr request, int loc) final
Definition: CommSerial.cpp:301
void v_AllReduce(void *buf, int count, CommDataType dt, enum ReduceOperator pOp) final
Definition: CommSerial.cpp:146
static CommSharedPtr create(int narg, char *arg[])
Creates an instance of this class.
Definition: CommSerial.h:56
void v_SplitComm(int pRows, int pColumns, int pTime) override
Definition: CommSerial.cpp:346
void v_RecvInit(void *buf, int count, CommDataType dt, int source, CommRequestSharedPtr request, int loc) final
Definition: CommSerial.cpp:312
void v_Isend(void *buf, int count, CommDataType dt, int dest, CommRequestSharedPtr request, int loc) final
Definition: CommSerial.cpp:278
void v_AlltoAllv(void *sendbuf, int sendcounts[], int sensdispls[], CommDataType sendtype, void *recvbuf, int recvcounts[], int rdispls[], CommDataType recvtype) final
Definition: CommSerial.cpp:168
void v_StartAll(CommRequestSharedPtr request) final
Definition: CommSerial.cpp:324
CommSerial(int argc, char *argv[])
Definition: CommSerial.cpp:46
static std::string className
Name of class.
Definition: CommSerial.h:62
void v_NeighborAlltoAllv(void *sendbuf, int sendcounts[], int sdispls[], CommDataType sendtype, void *recvbuf, int recvcounts[], int rdispls[], CommDataType recvtype) final
Definition: CommSerial.cpp:255
void v_Irsend(void *buf, int count, CommDataType dt, int dest, CommRequestSharedPtr request, int loc) final
Definition: CommSerial.cpp:266
void v_Send(void *buf, int count, CommDataType dt, int dest) final
Definition: CommSerial.cpp:117
void v_WaitAll(CommRequestSharedPtr request) final
Definition: CommSerial.cpp:331
void v_AllGatherv(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcounts[], int rdispls[], CommDataType recvtype) final
Definition: CommSerial.cpp:191
void v_AlltoAll(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype) final
Definition: CommSerial.cpp:156
void v_Scatter(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype, int root) final
Definition: CommSerial.cpp:235
void v_AllGather(void *sendbuf, int sendcount, CommDataType sendtype, void *recvbuf, int recvcount, CommDataType recvtype) final
Definition: CommSerial.cpp:179
void v_DistGraphCreateAdjacent(int indegree, const int sources[], const int sourceweights[], int reorder) final
Definition: CommSerial.cpp:246
void v_Recv(void *buf, int count, CommDataType dt, int source) final
Definition: CommSerial.cpp:126
void v_SendInit(void *buf, int count, CommDataType dt, int dest, CommRequestSharedPtr request, int loc) final
Definition: CommSerial.cpp:289
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
array buffer
Definition: GsLib.hpp:81
unsigned int CommDataType
Definition: CommDataType.h:65
std::shared_ptr< CommRequest > CommRequestSharedPtr
Definition: Comm.h:84
ReduceOperator
Type of operation to perform in AllReduce.
Definition: Comm.h:65
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:55
std::shared_ptr< CommSerial > CommSerialSharedPtr
Pointer to a Communicator object.
Definition: CommSerial.h:49
double NekDouble
STL namespace.