Bridge++  Ver. 1.1.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 "configure.h"
15 #include "defs.h"
16 #include "communicator.h"
17 #include "communicator_mpi.h"
18 #include "layout.h"
19 
20 static const char rcsid[] = "$Id: communicator.cpp 942 2013-07-22 06:50:06Z aoym $";
21 
26 int Communicator::init(int *pargc, char ***pargv)
27 {
28  return Communicator_impl::init(pargc, pargv);
29 }
30 
31 
33 {
35 }
36 
37 
39 {
40  return Communicator_impl::abort();
41 }
42 
43 
44 int Communicator::setup(int ninstance)
45 {
46  return Communicator_impl::setup(ninstance);
47 }
48 
49 
51 {
53 }
54 
55 
57 {
58  return Communicator_impl::is_primary_master();
59 }
60 
61 
63 {
64  return Communicator_impl::self();
65 }
66 
67 
69 {
70  return Communicator_impl::size();
71 }
72 
73 
74 #ifdef ENABLE_MULTI_INSTANCE
75 int Communicator::self_global()
76 {
77  return Communicator_impl::self_global();
78 }
79 
80 
81 int Communicator::world_id()
82 {
83  return Communicator_impl::world_id();
84 }
85 #endif
86 
87 int Communicator::ipe(const int idir)
88 {
89  return Communicator_impl::Layout::ipe(idir);
90 }
91 
92 
93 int Communicator::npe(const int idir)
94 {
95  return Communicator_impl::Layout::npe(idir);
96 }
97 
98 
99 int Communicator::grid_rank(int *rank, const int *grid_coord)
100 {
101  return Communicator_impl::Layout::grid_rank(rank, grid_coord);
102 }
103 
104 
105 int Communicator::grid_coord(int *grid_coord, const int rank)
106 {
107  return Communicator_impl::Layout::grid_coord(grid_coord, rank);
108 }
109 
110 
111 int Communicator::grid_dims(int *grid_dims)
112 {
113  return Communicator_impl::Layout::grid_dims(grid_dims);
114 }
115 
116 
118 {
119  return Communicator_impl::sync();
120 }
121 
122 
123 #ifdef ENABLE_MULTI_INSTANCE
124 int Communicator::sync_global()
125 {
126  return Communicator_impl::sync_global();
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 
254 {
256 }
257 
258 
260 {
261  return Communicator_impl::status();
262 }