COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-parallel-collective-reduce.hpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2013 von Karman Institute for Fluid Dynamics, Belgium
2 //
3 // This software is distributed under the terms of the
4 // GNU Lesser General Public License version 3 (LGPLv3).
5 // See doc/lgpl.txt and doc/gpl.txt for the license text.
6 
7 // this file is en-block included into utest-parallel-collective.cpp
8 // do not include anything here, rather in utest-parallel-collective.cpp
9 
11 
13 {
16  {
17  // rank and proc
18  nproc=PE::Comm::instance().size();
19  irank=PE::Comm::instance().rank();
20 
21  // ptr helpers
22  sndcnt=0;
23  ptr_snddat=new double[2*nproc];
24  ptr_rcvdat=new double[2*nproc];
25  ptr_tmprcv=new double[2*nproc];
26  ptr_sndmap=new int[nproc];
27  ptr_rcvmap=new int[nproc];
28  ptr_snddat2=new double[4*nproc];
29  ptr_rcvdat2=new double[4*nproc];
30  ptr_tmprcv2=new double[4*nproc];
31 
32  // std::Vector helpers
33  vec_snddat.resize(2*nproc);
34  vec_rcvdat.resize(2*nproc);
35  vec_tmprcv.resize(2*nproc);
36  vec_sndmap.resize(nproc);
37  vec_rcvmap.resize(nproc);
38  vec_snddat2.resize(4*nproc);
39  vec_rcvdat2.resize(4*nproc);
40  vec_tmprcv2.resize(4*nproc);
41  }
42 
45  {
46  delete[] ptr_snddat;
47  delete[] ptr_rcvdat;
48  delete[] ptr_sndmap;
49  delete[] ptr_rcvmap;
50  delete[] ptr_tmprcv;
51  delete[] ptr_snddat2;
52  delete[] ptr_rcvdat2;
53  delete[] ptr_tmprcv2;
54  }
55 
57  int nproc;
59  int irank;
60 
62  int sndcnt;
63  double* ptr_snddat;
64  double* ptr_rcvdat;
65  double* ptr_tmprcv;
66  int* ptr_sndmap;
67  int* ptr_rcvmap;
68  double* ptr_snddat2;
69  double* ptr_rcvdat2;
70  double* ptr_tmprcv2;
71 
73  std::vector<double> vec_snddat;
74  std::vector<double> vec_rcvdat;
75  std::vector<double> vec_tmprcv;
76  std::vector<int> vec_sndmap;
77  std::vector<int> vec_rcvmap;
78  std::vector<double> vec_snddat2;
79  std::vector<double> vec_rcvdat2;
80  std::vector<double> vec_tmprcv2;
81 
84  {
85  int i,j,k;
86  for (i=0; i<2*nproc; i++)
87  {
88  ptr_snddat[i]=(irank+1)*10000+(i+1);
89  ptr_rcvdat[i]=0.;
90  for (k=0; k<nproc; k++) ptr_rcvdat[i]+=(k+1)*10000+(i+1);
91  }
92  for (i=0; i<2*nproc; i++) { ptr_snddat2[2*i+0]=ptr_snddat[i]; ptr_snddat2[2*i+1]=ptr_snddat[i]+1; }
93  for (i=0; i<2*nproc; i++) { ptr_rcvdat2[2*i+0]=ptr_rcvdat[i]; ptr_rcvdat2[2*i+1]=ptr_rcvdat[i]+nproc; }
94  sndcnt=2*nproc;
95  vec_snddat.assign(ptr_snddat,ptr_snddat+2*nproc);
96  vec_rcvdat.assign(ptr_rcvdat,ptr_rcvdat+2*nproc);
97  vec_snddat2.assign(ptr_snddat2,ptr_snddat2+4*nproc);
98  vec_rcvdat2.assign(ptr_rcvdat2,ptr_rcvdat2+4*nproc);
99  }
100 
103  {
104  int i,j,k;
105  for (i=0; i<2*nproc; i++) {
106  ptr_snddat[i]=-1.;
107  ptr_rcvdat[i]=0.;
108  }
109  for (i=0; i<nproc; i++)
110  {
111  ptr_snddat[2*i]=(irank+1)*10000+(i+1);
112  ptr_sndmap[i]=2*i; // taking only every second
113  ptr_rcvmap[i]=2*(nproc-1-i); // inverts order and puts to every second
114  for (k=0; k<nproc; k++) ptr_rcvdat[2*(nproc-1-i)]+=(k+1)*10000+(i+1);
115  }
116  for (i=0; i<2*nproc; i++) { ptr_snddat2[2*i+0]=ptr_snddat[i]; ptr_snddat2[2*i+1]=ptr_snddat[i]+1; }
117  for (i=0; i<2*nproc; i++) { ptr_rcvdat2[2*i+0]=ptr_rcvdat[i]; ptr_rcvdat2[2*i+1]=ptr_rcvdat[i]+(double)nproc; }
118  sndcnt=nproc;
119  vec_snddat.assign(ptr_snddat,ptr_snddat+2*nproc);
120  vec_rcvdat.assign(ptr_rcvdat,ptr_rcvdat+2*nproc);
121  vec_sndmap.assign(ptr_sndmap,ptr_sndmap+nproc);
122  vec_rcvmap.assign(ptr_rcvmap,ptr_rcvmap+nproc);
123  vec_snddat2.assign(ptr_snddat2,ptr_snddat2+4*nproc);
124  vec_rcvdat2.assign(ptr_rcvdat2,ptr_rcvdat2+4*nproc);
125  }
126 
128  class optest {
129  public:
131  int ival;
132  double dval;
134  void init(){
135  ival=PE::Comm::instance().rank()+1;
136  dval=(double)PE::Comm::instance().rank()+10.;
137  }
139  optest operator +(const optest& b) const { optest t; t.ival=ival+b.ival; t.dval=dval+b.dval; return t; };
141  bool test()
142  {
143  int i;
144  int nproc=PE::Comm::instance().size();
145  int itest=0;
146  for(i=0; i<nproc; i++) itest+=i+1;
147  double dtest=0;
148  for(i=0; i<nproc; i++) dtest+=(double)i+10.;
149  return ((ival==itest)&&(dval==dtest));
150  }
151  };
152 
153 };
154 
156 
157 BOOST_FIXTURE_TEST_SUITE( PEReduceSuite, PEReduceFixture )
158 
159 
162 {
163  PEProcessSortedExecute(-1,CFinfo << "Testing reduce " << irank << "/" << nproc << CFendl; );
164 }
165 
167 
168 BOOST_AUTO_TEST_CASE( reduce_most_common_ops )
169 {
170  int i,r;
171  int ival,itest,iresult;
172  double dval,dtest,dresult;
173  ival=irank+1;
174  dval=(double)irank+1.;
175 
176  // testing plus
177  itest=0;
178  dtest=0.;
179  for(i=0; i<nproc; i++) { itest+=i+1; dtest+=(double)i+1.; }
180  iresult=-1;
181  dresult=-1.;
182  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), &ival, 1, &iresult, r);
183  BOOST_CHECK_EQUAL( iresult, itest );
184  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), &dval, 1, &dresult, r);
185  BOOST_CHECK_EQUAL( dresult, dtest );
186 
187  // testing multiplies
188  itest=1;
189  dtest=1.;
190  for(i=0; i<nproc; i++) { itest*=i+1; dtest*=(double)i+1.; }
191  iresult=-1;
192  dresult=-1.;
193  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::multiplies(), &ival, 1, &iresult, r);
194  BOOST_CHECK_EQUAL( iresult, itest );
195  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::multiplies(), &dval, 1, &dresult, r);
196  BOOST_CHECK_EQUAL( dresult, dtest );
197 
198  // testing max
199  itest=nproc;
200  dtest=(double)nproc;
201  iresult=-1;
202  dresult=-1.;
203  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::max(), &ival, 1, &iresult, r);
204  BOOST_CHECK_EQUAL( iresult, itest );
205  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::max(), &dval, 1, &dresult, r);
206  BOOST_CHECK_EQUAL( dresult, dtest );
207 
208  // testing min
209  itest=1;
210  dtest=1.;
211  iresult=-1;
212  dresult=-1.;
213  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::min(), &ival, 1, &iresult, r);
214  BOOST_CHECK_EQUAL( iresult, itest );
215  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::min(), &dval, 1, &dresult, r);
216  BOOST_CHECK_EQUAL( dresult, dtest );
217 }
218 
220 
221 BOOST_AUTO_TEST_CASE( reduce_operator_of_class )
222 {
223  int r;
224  optest in[3],out[3];
225  in[0].init();
226  in[1].init();
227  in[2].init();
228  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), in, 3, out, r);
229  BOOST_CHECK_EQUAL( out[0].test() , true );
230  BOOST_CHECK_EQUAL( out[1].test() , true );
231  BOOST_CHECK_EQUAL( out[2].test() , true );
232 }
233 
235 
236 BOOST_AUTO_TEST_CASE( reduce_ptr_constant )
237 {
238  int i,r;
239 
240  setup_data_constant();
241 
242  delete[] ptr_tmprcv;
243  ptr_tmprcv=0;
244  for(r=0; r<nproc; r++) {
245  if (r==irank) {
246  ptr_tmprcv=PE::Comm::instance().reduce(PE::plus(), ptr_snddat, sndcnt, (double*)0, r);
247  } else {
248  double* dummy=PE::Comm::instance().reduce(PE::plus(), ptr_snddat, sndcnt, (double*)0, r);
249  BOOST_CHECK_EQUAL( dummy , (double*)0 );
250  }
251  }
252  for (i=0; i<2*nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv[i] , ptr_rcvdat[i] );
253 
254  for (i=0; i<2*nproc; i++) ptr_tmprcv[i]=0.;
255  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), ptr_snddat, sndcnt, ptr_tmprcv, r);
256  for (i=0; i<2*nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv[i] , ptr_rcvdat[i] );
257 
258  for(r=0; r<nproc; r++) {
259  for (i=0; i<2*nproc; i++) ptr_tmprcv[i]=ptr_snddat[i];
260  PE::Comm::instance().reduce(PE::plus(), ptr_tmprcv, sndcnt, ptr_tmprcv, r);
261  if (irank==r) {
262  for (i=0; i<2*nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv[i] , ptr_rcvdat[i] );
263  } else {
264  for (i=0; i<2*nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv[i] , ptr_snddat[i] );
265  }
266  }
267 
268  delete[] ptr_tmprcv2;
269  ptr_tmprcv2=0;
270  for(r=0; r<nproc; r++) {
271  if (r==irank) {
272  ptr_tmprcv2=PE::Comm::instance().reduce(PE::plus(), ptr_snddat2, sndcnt, (double*)0, r, 2);
273  } else {
274  double* dummy=PE::Comm::instance().reduce(PE::plus(), ptr_snddat2, sndcnt, (double*)0, r, 2);
275  BOOST_CHECK_EQUAL( dummy , (double*)0 );
276  }
277  }
278  for (i=0; i<4*nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv2[i] , ptr_rcvdat2[i] );
279 
280  for (i=0; i<4*nproc; i++) ptr_tmprcv2[i]=0.;
281  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), ptr_snddat2, sndcnt, ptr_tmprcv2, r, 2);
282  for (i=0; i<4*nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv2[i] , ptr_rcvdat2[i] );
283 
284  for(r=0; r<nproc; r++) {
285  for (i=0; i<4*nproc; i++) ptr_tmprcv2[i]=ptr_snddat2[i];
286  PE::Comm::instance().reduce(PE::plus(), ptr_tmprcv2, sndcnt, ptr_tmprcv2, r, 2);
287  if (irank==r) {
288  for (i=0; i<4*nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv2[i] , ptr_rcvdat2[i] );
289  } else {
290  for (i=0; i<4*nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv2[i] , ptr_snddat2[i] );
291  }
292  }
293 }
294 
296 
297 BOOST_AUTO_TEST_CASE( reduce_vector_constant )
298 {
299  int i,r;
300 
301  setup_data_constant();
302 
303  vec_tmprcv.resize(0);
304  vec_tmprcv.reserve(0);
305  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), vec_snddat, vec_tmprcv, r);
306  for (i=0; i<2*nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv[i] , vec_rcvdat[i] );
307  BOOST_CHECK_EQUAL( (int)vec_tmprcv.size() , sndcnt );
308 
309  vec_tmprcv.assign(2*nproc,0.);
310  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), vec_snddat, vec_tmprcv, r);
311  for (i=0; i<2*nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv[i] , vec_rcvdat[i] );
312 
313  for(r=0; r<nproc; r++) {
314  vec_tmprcv=vec_snddat;
315  PE::Comm::instance().reduce(PE::plus(), vec_tmprcv, vec_tmprcv, r);
316  if (irank==r) {
317  for (i=0; i<2*nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv[i] , vec_rcvdat[i] );
318  } else {
319  for (i=0; i<2*nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv[i] , vec_snddat[i] );
320  }
321  }
322 
323  vec_tmprcv2.resize(0);
324  vec_tmprcv2.reserve(0);
325  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), vec_snddat2, vec_tmprcv2, r, 2);
326  for (i=0; i<4*nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv2[i] , vec_rcvdat2[i] );
327  BOOST_CHECK_EQUAL( (int)vec_tmprcv2.size() , 2*sndcnt );
328 
329  vec_tmprcv2.assign(4*nproc,0.);
330  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), vec_snddat2, vec_tmprcv2, r, 2);
331  for (i=0; i<4*nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv2[i] , vec_rcvdat2[i] );
332 
333  for(r=0; r<nproc; r++) {
334  vec_tmprcv2=vec_snddat2;
335  PE::Comm::instance().reduce(PE::plus(), vec_tmprcv2, vec_tmprcv2, r, 2);
336  if (irank==r) {
337  for (i=0; i<4*nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv2[i] , vec_rcvdat2[i] );
338  } else {
339  for (i=0; i<4*nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv2[i] , vec_snddat2[i] );
340  }
341  }
342 }
343 
345 
346 BOOST_AUTO_TEST_CASE( reduce_ptr_variable )
347 {
348  int i,r;
349 
350  setup_data_variable();
351 
352  delete[] ptr_tmprcv;
353  ptr_tmprcv=0;
354  for(r=0; r<nproc; r++) {
355  if (r==irank) {
356  ptr_tmprcv=PE::Comm::instance().reduce(PE::plus(), ptr_snddat, sndcnt, ptr_sndmap, (double*)0, ptr_rcvmap, r);
357  } else {
358  double* dummy=PE::Comm::instance().reduce(PE::plus(), ptr_snddat, sndcnt, ptr_sndmap, (double*)0, ptr_rcvmap, r);
359  BOOST_CHECK_EQUAL( dummy , (double*)0 );
360  }
361  }
362  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv[2*i] , ptr_rcvdat[2*i] );
363 
364  delete[] ptr_tmprcv;
365  ptr_tmprcv=new double[2*nproc];
366  for (i=0; i<2*nproc; i++) ptr_tmprcv[i]=0.;
367  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), ptr_snddat, sndcnt, ptr_sndmap, ptr_tmprcv, ptr_rcvmap, r);
368  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv[2*i] , ptr_rcvdat[2*i] );
369 
370  for(r=0; r<nproc; r++) {
371  for (i=0; i<2*nproc; i++) ptr_tmprcv[i]=ptr_snddat[i];
372  PE::Comm::instance().reduce(PE::plus(), ptr_tmprcv, sndcnt, ptr_sndmap, ptr_tmprcv, ptr_rcvmap, r);
373  if (irank==r) {
374  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv[2*i] , ptr_rcvdat[2*i] );
375  } else {
376  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv[2*i] , ptr_snddat[2*i] );
377  }
378  }
379 
380  delete[] ptr_tmprcv2;
381  ptr_tmprcv2=0;
382  for(r=0; r<nproc; r++) {
383  if (r==irank) {
384  ptr_tmprcv2=PE::Comm::instance().reduce(PE::plus(), ptr_snddat2, sndcnt, ptr_sndmap, (double*)0, ptr_rcvmap, r, 2);
385  } else {
386  double* dummy=PE::Comm::instance().reduce(PE::plus(), ptr_snddat2, sndcnt, ptr_sndmap, (double*)0, ptr_rcvmap, r, 2);
387  BOOST_CHECK_EQUAL( dummy , (double*)0 );
388  }
389  }
390  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv2[4*i+0] , ptr_rcvdat2[4*i+0] );
391  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv2[4*i+1] , ptr_rcvdat2[4*i+1] );
392 
393  delete[] ptr_tmprcv2;
394  ptr_tmprcv2=new double[4*nproc];
395  for (i=0; i<4*nproc; i++) ptr_tmprcv2[i]=0.;
396  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), ptr_snddat2, sndcnt, ptr_sndmap, ptr_tmprcv2, ptr_rcvmap, r, 2);
397  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv2[4*i+0] , ptr_rcvdat2[4*i+0] );
398  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv2[4*i+1] , ptr_rcvdat2[4*i+1] );
399 
400  for(r=0; r<nproc; r++) {
401  for (i=0; i<4*nproc; i++) ptr_tmprcv2[i]=ptr_snddat2[i];
402  PE::Comm::instance().reduce(PE::plus(), ptr_tmprcv2, sndcnt, ptr_sndmap, ptr_tmprcv2, ptr_rcvmap, r, 2);
403  if (irank==r) {
404  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv2[4*i+0] , ptr_rcvdat2[4*i+0] );
405  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv2[4*i+1] , ptr_rcvdat2[4*i+1] );
406  } else {
407  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv2[4*i+0] , ptr_snddat2[4*i+0] );
408  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( ptr_tmprcv2[4*i+1] , ptr_snddat2[4*i+1] );
409  }
410  }
411 }
412 
414 
415 BOOST_AUTO_TEST_CASE( reduce_vector_variable )
416 {
417  int i,r;
418 
419  setup_data_variable();
420 
421  vec_tmprcv.resize(0);
422  vec_tmprcv.reserve(0);
423  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), vec_snddat, vec_sndmap, vec_tmprcv, vec_rcvmap, r);
424  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv[2*i] , vec_rcvdat[2*i] );
425 
426  vec_tmprcv.resize(2*nproc);
427  vec_tmprcv.reserve(2*nproc);
428  for (i=0; i<2*nproc; i++) vec_tmprcv[i]=0.;
429  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), vec_snddat, vec_sndmap, vec_tmprcv, vec_rcvmap, r);
430  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv[2*i] , vec_rcvdat[2*i] );
431 
432  for(r=0; r<nproc; r++) {
433  vec_tmprcv=vec_snddat;
434  PE::Comm::instance().reduce(PE::plus(), vec_tmprcv, vec_sndmap, vec_tmprcv, vec_rcvmap, r);
435  if (irank==r) {
436  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv[2*i] , vec_rcvdat[2*i] );
437  } else {
438  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv[2*i] , vec_snddat[2*i] );
439  }
440  }
441 
442  vec_tmprcv2.resize(0);
443  vec_tmprcv2.reserve(0);
444  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), vec_snddat2, vec_sndmap, vec_tmprcv2, vec_rcvmap, r, 2);
445  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv2[4*i+0] , vec_rcvdat2[4*i+0] );
446  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv2[4*i+1] , vec_rcvdat2[4*i+1] );
447 
448  vec_tmprcv2.resize(4*nproc);
449  vec_tmprcv2.reserve(4*nproc);
450  vec_tmprcv2.assign(4*nproc,0.);
451  for(r=0; r<nproc; r++) PE::Comm::instance().reduce(PE::plus(), vec_snddat2, vec_sndmap, vec_tmprcv2, vec_rcvmap, r, 2);
452  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv2[4*i+0] , vec_rcvdat2[4*i+0] );
453  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv2[4*i+1] , vec_rcvdat2[4*i+1] );
454 
455  for(r=0; r<nproc; r++) {
456  vec_tmprcv2=vec_snddat2;
457  PE::Comm::instance().reduce(PE::plus(), vec_tmprcv2, vec_sndmap, vec_tmprcv2, vec_rcvmap, r, 2);
458  if (irank==r) {
459  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv2[4*i+0] , vec_rcvdat2[4*i+0] );
460  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv2[4*i+1] , vec_rcvdat2[4*i+1] );
461  } else {
462  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv2[4*i+0] , vec_snddat2[4*i+0] );
463  for (i=0; i<nproc; i++) BOOST_CHECK_EQUAL( vec_tmprcv2[4*i+1] , vec_snddat2[4*i+1] );
464  }
465  }
466 }
467 
469 
470 BOOST_AUTO_TEST_SUITE_END()
471 
472 
#define CFinfo
these are always defined
Definition: Log.hpp:104
std::vector< double > vec_rcvdat2
std::vector< double > vec_snddat2
~PEReduceFixture()
common tear-down for each test case
std::vector< double > vec_rcvdat
int nproc
number of processes
#define CFendl
Definition: Log.hpp:109
Real max(const Real a, const Real b)
Maximum between two scalars.
Definition: Terminals.hpp:228
optest operator+(const optest &b) const
operator +
void setup_data_constant()
helper function for constant size data - setting up input and verification data
T * reduce(const Communicator &comm, const Op &op, const T *in_values, const int in_n, T *out_values, const int root, const int stride=1)
Definition: reduce.hpp:124
Real min(const Real a, const Real b)
Minimum between two scalars.
Definition: Terminals.hpp:234
void init()
giving values for i and d
int sndcnt
data for raw pointers
void setup_data_variable()
helper function for variable size data - setting up input and verification data
std::vector< double > vec_tmprcv2
test class with operator + to test if operations and reduce can work with it
BOOST_AUTO_TEST_CASE(reduce)
std::vector< double > vec_snddat
data for std::vectors
bool test()
function to test result
std::vector< double > vec_tmprcv
PEReduceFixture()
common setup for each test case
#define PEProcessSortedExecute(irank, expression)
Definition: debug.hpp:43
Send comments to:
COOLFluiD Web Admin