Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
communicator.cpp
Go to the documentation of this file.
1 
14 #include "layout.h"
15 
16 // static const char rcsid[] = "$Id: communicator.cpp 1145 2014-09-16 09:27:22Z namekawa $";
17 
22 int Communicator::init(int *pargc, char ***pargv)
23 {
24  return Communicator_impl::init(pargc, pargv);
25 }
26 
27 
29 {
31 }
32 
33 
35 {
36  return Communicator_impl::abort();
37 }
38 
39 
40 int Communicator::setup(int ninstance)
41 {
42  return Communicator_impl::setup(ninstance);
43 }
44 
45 
47 {
49 }
50 
51 
53 {
54  return Communicator_impl::is_primary_master();
55 }
56 
57 
59 {
60  return Communicator_impl::self();
61 }
62 
63 
65 {
66  return Communicator_impl::size();
67 }
68 
69 
70 #ifdef ENABLE_MULTI_INSTANCE
71 int Communicator::self_global()
72 {
73  return Communicator_impl::self_global();
74 }
75 
76 
77 int Communicator::world_id()
78 {
79  return Communicator_impl::world_id();
80 }
81 
82 
83 #endif
84 
85 int Communicator::ipe(const int idir)
86 {
87  return Communicator_impl::Layout::ipe(idir);
88 }
89 
90 
91 int Communicator::npe(const int idir)
92 {
93  return Communicator_impl::Layout::npe(idir);
94 }
95 
96 
97 int Communicator::grid_rank(int *rank, const int *grid_coord)
98 {
99  return Communicator_impl::Layout::grid_rank(rank, grid_coord);
100 }
101 
102 
103 int Communicator::grid_coord(int *grid_coord, const int rank)
104 {
105  return Communicator_impl::Layout::grid_coord(grid_coord, rank);
106 }
107 
108 
109 int Communicator::grid_dims(int *grid_dims)
110 {
111  return Communicator_impl::Layout::grid_dims(grid_dims);
112 }
113 
114 
115 int Communicator::sync()
116 {
117  return Communicator_impl::sync();
118 }
119 
120 
121 #ifdef ENABLE_MULTI_INSTANCE
122 int Communicator::sync_global()
123 {
124  return Communicator_impl::sync_global();
125 }
126 
127 
128 #endif
129 
130 int Communicator::Base::broadcast(size_t size, void *data, int sender)
131 {
132  return Communicator_impl::Base::broadcast(size, data, sender);
133 }
134 
135 
136 int Communicator::broadcast(int count, double *data, int sender)
137 {
138  return Communicator_impl::Base::broadcast(sizeof(double) * count, (void *)data, sender);
139 }
140 
141 
142 int Communicator::broadcast(int count, int *data, int sender)
143 {
144  return Communicator_impl::Base::broadcast(sizeof(int) * count, (void *)data, sender);
145 }
146 
147 
148 int Communicator::broadcast(int count, string& data, int sender)
149 {
150  return Communicator_impl::broadcast_string(count, data, sender);
151 }
152 
153 
154 int Communicator::Base::exchange(size_t size, void *recv_buf, void *send_buf, int idir, int ipm, int itag)
155 {
156  return Communicator_impl::Base::exchange(size, recv_buf, send_buf, idir, ipm, itag);
157 }
158 
159 
160 int Communicator::exchange(int count, double *recv_buf, double *send_buf, int idir, int ipm, int itag)
161 {
162  return Communicator_impl::Base::exchange(sizeof(double) * count, (void *)recv_buf, (void *)send_buf, idir, ipm, itag);
163 }
164 
165 
166 int Communicator::exchange(int count, int *recv_buf, int *send_buf, int idir, int ipm, int itag)
167 {
168  return Communicator_impl::Base::exchange(sizeof(int) * count, (void *)recv_buf, (void *)send_buf, idir, ipm, itag);
169 }
170 
171 
172 int Communicator::Base::send_1to1(size_t size, void *recv_buf, void *send_buf, int send_to, int recv_from, int tag)
173 {
174  return Communicator_impl::Base::send_1to1(size, recv_buf, send_buf, send_to, recv_from, tag);
175 }
176 
177 
178 int Communicator::send_1to1(int count, double *recv_buf, double *send_buf, int send_to, int recv_from, int tag)
179 {
180  return Communicator_impl::Base::send_1to1(sizeof(double) * count, (void *)recv_buf, (void *)send_buf, send_to, recv_from, tag);
181 }
182 
183 
184 int Communicator::send_1to1(int count, int *recv_buf, int *send_buf, int send_to, int recv_from, int tag)
185 {
186  return Communicator_impl::Base::send_1to1(sizeof(int) * count, (void *)recv_buf, (void *)send_buf, send_to, recv_from, tag);
187 }
188 
189 
190 int Communicator::reduce_sum(int count, double *recv_buf, double *send_buf, int pattern)
191 {
192  return Communicator_impl::Base::reduce(count, (void *)recv_buf, (void *)send_buf, MPI_DOUBLE, MPI_SUM, pattern);
193 }
194 
195 
196 int Communicator::reduce_sum(int count, int *recv_buf, int *send_buf, int pattern)
197 {
198  return Communicator_impl::Base::reduce(count, (void *)recv_buf, (void *)send_buf, MPI_INT, MPI_SUM, pattern);
199 }
200 
201 
202 int Communicator::reduce_max(int count, double *recv_buf, double *send_buf, int pattern)
203 {
204  return Communicator_impl::Base::reduce(count, (void *)recv_buf, (void *)send_buf, MPI_DOUBLE, MPI_MAX, pattern);
205 }
206 
207 
208 int Communicator::reduce_max(int count, int *recv_buf, int *send_buf, int pattern)
209 {
210  return Communicator_impl::Base::reduce(count, (void *)recv_buf, (void *)send_buf, MPI_INT, MPI_MAX, pattern);
211 }
212 
213 
214 int Communicator::reduce_min(int count, double *recv_buf, double *send_buf, int pattern)
215 {
216  return Communicator_impl::Base::reduce(count, (void *)recv_buf, (void *)send_buf, MPI_DOUBLE, MPI_MIN, pattern);
217 }
218 
219 
220 int Communicator::reduce_min(int count, int *recv_buf, int *send_buf, int pattern)
221 {
222  return Communicator_impl::Base::reduce(count, (void *)recv_buf, (void *)send_buf, MPI_INT, MPI_MIN, pattern);
223 }
224 
225 
226 double Communicator::reduce_sum(double a)
227 {
228  double ar = double();
229 
230  reduce_sum(1, &ar, &a, 0);
231  return ar;
232 }
233 
234 
235 double Communicator::reduce_max(double a)
236 {
237  double ar = double();
238 
239  reduce_max(1, &ar, &a, 0);
240  return ar;
241 }
242 
243 
244 double Communicator::reduce_min(double a)
245 {
246  double ar = double();
247 
248  reduce_min(1, &ar, &a, 0);
249  return ar;
250 }
251 
252 
253 double Communicator::get_time()
254 {
256 }
257 
258 
260 {
261  return Communicator_impl::status();
262 }
static int send_1to1(size_t size, void *recv_buf, void *send_buf, int send_to, int recv_from, int tag)
static int broadcast(size_t size, void *data, int sender)
static int npe(const int dir)
logical grid extent
static int reduce_max(int count, double *recv_buf, double *send_buf, int pattern=0)
find a global maximum of an array of double over the communicator. pattern specifies the dimensions t...
static void abort()
terminate communicator
static int self()
rank within small world.
static bool is_primary_master()
check if the present node is primary in global communicator.
static int init(int *pargc, char ***pargv)
initialize communicator
static int grid_coord(int *gcoord, const int rank)
static int grid_coord(int *grid_coord, const int rank)
find grid coordinate from rank number.
static int sync()
synchronize within small world.
static int reduce_min(int count, double *recv_buf, double *send_buf, int pattern=0)
find a global minimum of an array of double over the communicator. pattern specifies the dimensions t...
static int setup(int ninstance=1)
static int status()
for debug
static int broadcast(size_t size, void *data, int sender)
static int ipe(const int dir)
logical coordinate of current proc.
static int grid_rank(int *rank, const int *gcoord)
static bool is_primary()
info about rank
static int npe(const int idir)
Definition: layout.cpp:67
static int reduce(int count, void *recv_buf, void *send_buf, int type, int op, int pattern)
static int finalize()
finalize communicator
static int init(int *pargc, char ***pargv)
static int send_1to1(int count, double *recv_buf, double *send_buf, int p_to, int p_from, int tag)
send array of double from rank p_from to rank p_to. communication distinguished by tag...
static int grid_dims(int *gdims)
Definition: layout.cpp:73
static int exchange(size_t size, void *recv_buf, void *send_buf, int idir, int ipm, int tag)
static int grid_dims(int *grid_dims)
find grid dimensions.
static int broadcast_string(int count, string &data, int sender)
for specific datatypes
static double get_time()
for getting time interval using clock count.
static int exchange(int count, double *recv_buf, double *send_buf, int idir, int ipm, int tag)
receive array of double from upstream specified by idir and ipm, and send array to downstream...
static int status()
static int grid_rank(int *rank, const int *grid_coord)
find rank number from grid coordinate.
static int setup(int ninstance=1)
setup communicator
static int ipe(const int idir)
Definition: layout.cpp:61
static int send_1to1(size_t size, void *recv_buf, void *send_buf, int send_to, int recv_from, int tag)
static int size()
size of small world.
static double get_time()
obtain a wall-clock time.
static int reduce_sum(int count, double *recv_buf, double *send_buf, int pattern=0)
make a global sum of an array of double over the communicator. pattern specifies the dimensions to be...
static int sync()
synchronize within small world.
static int broadcast(int count, double *data, int sender)
broadcast array of double from sender.
static bool is_primary()
check if the present node is primary in small communicator.
static int exchange(size_t size, void *recv_buf, void *send_buf, int idir, int ipm, int tag)