g4tools  5.4.0
wrmpi
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_mpi_wrmpi
5 #define tools_mpi_wrmpi
6 
7 #include "wait_buffer"
8 
9 #include <tools/impi>
10 #include <tools/vdata>
11 #include <tools/realloc>
12 #include <tools/mnmx>
13 
14 #ifdef TOOLS_MEM
15 #include <tools/mem>
16 #endif
17 
18 // the below must be in sync with inlib/typedefs
19 #ifdef _MSC_VER
20 //typedef __int64 int64;
21 //typedef unsigned __int64 uint64;
22 #define TOOLS_MPI_UINT64 MPI_UNSIGNED_LONG_LONG
23 #define TOOLS_MPI_INT64 MPI_LONG_LONG
24 #elif defined(_LP64)
25 // 64 Bit Platforms
26 //typedef long int64;
27 //typedef unsigned long uint64;
28 #define TOOLS_MPI_UINT64 MPI_UNSIGNED_LONG
29 #define TOOLS_MPI_INT64 MPI_LONG
30 #else
31 // 32-Bit Platforms
32 //typedef long long int64;
33 //typedef unsigned long long uint64;
34 #define TOOLS_MPI_UINT64 MPI_UNSIGNED_LONG_LONG
35 #define TOOLS_MPI_INT64 MPI_LONG_LONG
36 #endif
37 
38 namespace tools {
39 namespace mpi {
40 
41 class wrmpi : public virtual tools::impi {
42  typedef tools::impi parent;
43 public:
44  typedef unsigned int num_t;
45 protected:
46  static const std::string& s_class() {
47  static const std::string s_v("tools::mpi::wrmpi");
48  return s_v;
49  }
50 public: //inlib::mpi::impi
51  virtual bool pack(char a_val) {
52  tools::uint32 sz = tools::uint32(sizeof(char));
53  if(m_pos+sz>m_max) {if(!expand2(m_size+sz)) return false;}
55  m_out << "tools::mpi::wrmpi : MPI_Pack(char) failed." << std::endl;
56  return false;
57  }
58  m_pos += sz;
59  return true;
60  }
61  virtual bool pack(short a_val) {
62  tools::uint32 sz = tools::uint32(sizeof(short));
63  if(m_pos+sz>m_max) {if(!expand2(m_size+sz)) return false;}
65  m_out << "tools::mpi::wrmpi : MPI_Pack(short) failed." << std::endl;
66  return false;
67  }
68  m_pos += sz;
69  return true;
70  }
71  virtual bool pack(int a_val) {
72  tools::uint32 sz = tools::uint32(sizeof(int));
73  if(m_pos+sz>m_max) {if(!expand2(m_size+sz)) return false;}
75  m_out << "tools::mpi::wrmpi : MPI_Pack(int) failed." << std::endl;
76  return false;
77  }
78  m_pos += sz;
79  return true;
80  }
81  virtual bool pack(unsigned int a_val) {
82  tools::uint32 sz = tools::uint32(sizeof(unsigned int));
83  if(m_pos+sz>m_max) {if(!expand2(m_size+sz)) return false;}
85  m_out << "tools::mpi::wrmpi : MPI_Pack(unsigned int) failed." << std::endl;
86  return false;
87  }
88  m_pos += sz;
89  return true;
90  }
91  virtual bool pack(tools::uint64 a_val) {
93  if(m_pos+sz>m_max) {if(!expand2(m_size+sz)) return false;}
95  m_out << "tools::mpi::wrmpi : MPI_Pack(uint64) failed." << std::endl;
96  return false;
97  }
98  m_pos += sz;
99  return true;
100  }
101  virtual bool pack(tools::int64 a_val) {
103  if(m_pos+sz>m_max) {if(!expand2(m_size+sz)) return false;}
105  m_out << "tools::mpi::wrmpi : MPI_Pack(int64) failed." << std::endl;
106  return false;
107  }
108  m_pos += sz;
109  return true;
110  }
111  virtual bool pack(float a_val) {
112  tools::uint32 sz = tools::uint32(sizeof(float));
113  if(m_pos+sz>m_max) {if(!expand2(m_size+sz)) return false;}
115  m_out << "tools::mpi::wrmpi : MPI_Pack(float) failed." << std::endl;
116  return false;
117  }
118  m_pos += sz;
119  return true;
120  }
121  virtual bool pack(double a_val) {
122  tools::uint32 sz = tools::uint32(sizeof(double));
123  if(m_pos+sz>m_max) {if(!expand2(m_size+sz)) return false;}
125  m_out << "tools::mpi::wrmpi : MPI_Pack(double) failed." << std::endl;
126  return false;
127  }
128  m_pos += sz;
129  return true;
130  }
131  virtual bool bpack(bool a_val) {
132  tools::uint32 sz = tools::uint32(sizeof(unsigned char));
133  if(m_pos+sz>m_max) {if(!expand2(m_size+sz)) return false;}
134  unsigned char val = a_val?1:0;
136  m_out << "tools::mpi::wrmpi : MPI_Pack(bool) failed." << std::endl;
137  return false;
138  }
139  m_pos += sz;
140  return true;
141  }
142  virtual bool spack(const std::string& a_s) {
143  if(!pack((num_t)a_s.size())) return false;
144  tools::uint32 sz = (tools::uint32)a_s.size();
145  if((m_pos+sz)>m_max) {if(!expand2(m_size+sz)) return false;}
146 #ifdef TOOLS_USE_MPI_PACK_NOT_CONST
147  if(::MPI_Pack(const_cast<char*>(a_s.c_str()),a_s.size(),MPI_CHAR,m_buffer,m_size,&m_ipos,m_comm)!=MPI_SUCCESS) {
148 #else
149  if(::MPI_Pack(a_s.c_str(),a_s.size(),MPI_CHAR,m_buffer,m_size,&m_ipos,m_comm)!=MPI_SUCCESS) {
150 #endif
151  m_out << "tools::mpi::wrmpi : MPI_Pack(std::string) failed." << std::endl;
152  return false;
153  }
154  m_pos += sz;
155  return true;
156  }
157  virtual bool vpack(const std::vector<unsigned int>& a_v) {
158  if(!pack((num_t)a_v.size())) return false;
159  tools::uint32 sz = (tools::uint32)(a_v.size()*sizeof(unsigned int));
160  if((m_pos+sz)>m_max) {if(!expand2(m_size+sz)) return false;}
161 #ifdef TOOLS_USE_MPI_PACK_NOT_CONST
162  if(::MPI_Pack(const_cast<unsigned int*>(tools::vec_data(a_v)),a_v.size(),
164 #else
166 #endif
167  m_out << "tools::mpi::wrmpi : MPI_Pack(std::vector<unsigned int>) failed." << std::endl;
168  return false;
169  }
170  m_pos += sz;
171  return true;
172  }
173  virtual bool vpack(const std::vector<int>& a_v) {
174  if(!pack((num_t)a_v.size())) return false;
175  tools::uint32 sz = (tools::uint32)(a_v.size()*sizeof(int));
176  if((m_pos+sz)>m_max) {if(!expand2(m_size+sz)) return false;}
177 #ifdef TOOLS_USE_MPI_PACK_NOT_CONST
178  if(::MPI_Pack(const_cast<int*>(tools::vec_data(a_v)),a_v.size(),MPI_INT,m_buffer,m_size,&m_ipos,m_comm)!=MPI_SUCCESS) {
179 #else
181 #endif
182  m_out << "tools::mpi::wrmpi : MPI_Pack(std::vector<int>) failed." << std::endl;
183  return false;
184  }
185  m_pos += sz;
186  return true;
187  }
188  virtual bool vpack(const std::vector<double>& a_v) {
189  if(!pack((num_t)a_v.size())) return false;
190  tools::uint32 sz = (tools::uint32)(a_v.size()*sizeof(double));
191  if((m_pos+sz)>m_max) {if(!expand2(m_size+sz)) return false;}
192 #ifdef TOOLS_USE_MPI_PACK_NOT_CONST
193  if(::MPI_Pack(const_cast<double*>(tools::vec_data(a_v)),a_v.size(),MPI_DOUBLE,m_buffer,m_size,&m_ipos,m_comm)!=MPI_SUCCESS) {
194 #else
196 #endif
197  m_out << "tools::mpi::wrmpi : MPI_Pack(std::vector<double>) failed." << std::endl;
198  return false;
199  }
200  m_pos += sz;
201  return true;
202  }
203  virtual bool pack(tools::uint32 a_size,const char* a_buffer) {
204  if(!pack((num_t)a_size)) return false;
205  tools::uint32 sz = (tools::uint32)(a_size*sizeof(char));
206  if((m_pos+sz)>m_max) {if(!expand2(m_size+sz)) return false;}
207 #ifdef TOOLS_USE_MPI_PACK_NOT_CONST
208  if(::MPI_Pack(const_cast<char*>(a_buffer),a_size,MPI_CHAR,m_buffer,m_size,&m_ipos,m_comm)!=MPI_SUCCESS) {
209 #else
210  if(::MPI_Pack(a_buffer,a_size,MPI_CHAR,m_buffer,m_size,&m_ipos,m_comm)!=MPI_SUCCESS) {
211 #endif
212  m_out << "tools::mpi::wrmpi : MPI_Pack(char*) failed." << std::endl;
213  return false;
214  }
215  m_pos += sz;
216  return true;
217  }
218 
219  virtual bool pack(tools::uint32 a_size,const int* a_buffer) {
220  if(!pack((num_t)a_size)) return false;
221  tools::uint32 sz = (tools::uint32)(a_size*sizeof(int));
222  if((m_pos+sz)>m_max) {if(!expand2(m_size+sz)) return false;}
223 #ifdef TOOLS_USE_MPI_PACK_NOT_CONST
224  if(::MPI_Pack(const_cast<int*>(a_buffer),a_size,MPI_INT,m_buffer,m_size,&m_ipos,m_comm)!=MPI_SUCCESS) {
225 #else
226  if(::MPI_Pack(a_buffer,a_size,MPI_INT,m_buffer,m_size,&m_ipos,m_comm)!=MPI_SUCCESS) {
227 #endif
228  m_out << "tools::mpi::wrmpi : MPI_Pack(int*) failed." << std::endl;
229  return false;
230  }
231  m_pos += sz;
232  return true;
233  }
234 public: //inlib::mpi::impi
235  virtual bool unpack(char& a_val) {
237  m_out << "tools::mpi::wrmpi : MPI_Unpack(char) failed." << std::endl;
238  a_val = 0;
239  return false;
240  }
241  return true;
242  }
243  virtual bool unpack(short& a_val) {
245  m_out << "tools::mpi::wrmpi : MPI_Unpack(short) failed." << std::endl;
246  a_val = 0;
247  return false;
248  }
249  return true;
250  }
251  virtual bool unpack(int& a_val) {
253  m_out << "tools::mpi::wrmpi : MPI_Unpack(int) failed." << std::endl;
254  a_val = 0;
255  return false;
256  }
257  return true;
258  }
259  virtual bool unpack(unsigned int& a_val) {
261  m_out << "tools::mpi::wrmpi : MPI_Unpack(unsigned int) failed." << std::endl;
262  a_val = 0;
263  return false;
264  }
265  return true;
266  }
267  virtual bool unpack(tools::uint64& a_val) {
269  m_out << "tools::mpi::wrmpi : MPI_Unpack(uint64) failed." << std::endl;
270  a_val = 0;
271  return false;
272  }
273  return true;
274  }
275  virtual bool unpack(tools::int64& a_val) {
277  m_out << "tools::mpi::wrmpi : MPI_Unpack(int64) failed." << std::endl;
278  a_val = 0;
279  return false;
280  }
281  return true;
282  }
283  virtual bool unpack(float& a_val) {
285  m_out << "tools::mpi::wrmpi : MPI_Unpack(float) failed." << std::endl;
286  a_val = 0;
287  return false;
288  }
289  return true;
290  }
291  virtual bool unpack(double& a_val) {
293  m_out << "tools::mpi::wrmpi : MPI_Unpack(double) failed." << std::endl;
294  a_val = 0;
295  return false;
296  }
297  return true;
298  }
299  virtual bool bunpack(bool& a_val) {
300  typedef unsigned char bool_t;
301  bool_t val;
303  m_out << "tools::mpi::wrmpi : MPI_Unpack(bool) failed." << std::endl;
304  a_val = false;
305  return false;
306  }
307  a_val = val==1?true:false;
308  return true;
309  }
310  virtual bool vunpack(std::vector<unsigned int>& a_v) {
311  num_t num;
312  if(!unpack(num)) {a_v.clear();return false;}
313  a_v.resize(num);
315  m_out << "tools::mpi::wrmpi : MPI_Unpack(std::vector<unsigned int>) failed." << std::endl;
316  a_v.clear();
317  return false;
318  }
319  return true;
320  }
321  virtual bool vunpack(std::vector<int>& a_v) {
322  num_t num;
323  if(!unpack(num)) {a_v.clear();return false;}
324  a_v.resize(num);
326  m_out << "tools::mpi::wrmpi : MPI_Unpack(std::vector<int>) failed." << std::endl;
327  a_v.clear();
328  return false;
329  }
330  return true;
331  }
332  virtual bool vunpack(std::vector<double>& a_v) {
333  num_t num;
334  if(!unpack(num)) {a_v.clear();return false;}
335  a_v.resize(num);
337  m_out << "tools::mpi::wrmpi : MPI_Unpack(std::vector<double>) failed." << std::endl;
338  a_v.clear();
339  return false;
340  }
341  return true;
342  }
343  virtual bool sunpack(std::string& a_s) {
344  num_t num;
345  if(!unpack(num)) {a_s.clear();return false;}
346  a_s.resize(num);
347  if(::MPI_Unpack(m_buffer,m_size,&m_ipos,const_cast<char*>(a_s.c_str()),a_s.size(),MPI_CHAR,m_comm)!=MPI_SUCCESS) {
348  m_out << "tools::mpi::wrmpi : MPI_Unpack(std::string) failed." << std::endl;
349  a_s.clear();
350  return false;
351  }
352  return true;
353  }
354  virtual bool unpack(tools::uint32& a_size,char*& a_buffer) {
355  num_t num;
356  if(!unpack(num)) {a_size = 0;a_buffer = 0;return false;}
357  a_buffer = new char[num];
358  if(::MPI_Unpack(m_buffer,m_size,&m_ipos,a_buffer,num,MPI_CHAR,m_comm)!=MPI_SUCCESS) {
359  m_out << "tools::mpi::wrmpi : MPI_Unpack(char*) failed." << std::endl;
360  delete [] a_buffer;
361  a_size = 0;
362  a_buffer = 0;
363  return false;
364  }
365  a_size = num;
366  return true;
367  }
368  virtual bool unpack(tools::uint32& a_size,int*& a_buffer) {
369  num_t num;
370  if(!unpack(num)) {a_size = 0;a_buffer = 0;return false;}
371  a_buffer = new int[num];
372  if(::MPI_Unpack(m_buffer,m_size,&m_ipos,a_buffer,num,MPI_INT,m_comm)!=MPI_SUCCESS) {
373  m_out << "tools::mpi::wrmpi : MPI_Unpack(int*) failed." << std::endl;
374  delete [] a_buffer;
375  a_size = 0;
376  a_buffer = 0;
377  return false;
378  }
379  a_size = num;
380  return true;
381  }
382 
383  virtual void pack_reset() {
384  delete [] m_buffer;
385  m_size = 128;
386  m_buffer = new char[m_size];
387  //if(!m_buffer) {}
389  m_pos = m_buffer;
390  m_ipos = 0; //IMPORTANT
391  }
392 
393  virtual bool send_buffer(int a_dest,int a_tag) { // used in tools/mpi/pntuple.
394  if(::MPI_Send(m_buffer,m_ipos,MPI_CHAR,a_dest,a_tag,m_comm)!=MPI_SUCCESS) {
395  m_out << "tools::mpi::wrmpi::send_buffer : MPI_Send() failed for rank destination " << a_dest << "." << std::endl;
396  return false;
397  }
398  return true;
399  }
400 
401  virtual bool wait_buffer(int a_rank,int a_src,int a_tag,int& a_probe_src,bool a_verbose = false) {
402  int buffer_size = 0;
403  char* _buffer = 0;
404  if (!mpi::wait_buffer(m_out,a_rank,a_src,a_tag,m_comm,buffer_size,_buffer,a_probe_src,a_verbose)) {
405  m_out << "tools::mpi::wrmpi::wait_buffer : failed for rank " << a_rank << " and source " << a_src <<"." << std::endl;
406  return false;
407  }
408  // we take ownership of buffer :
409  delete [] m_buffer;
410  m_size = buffer_size;
411  m_buffer = _buffer;
413  m_pos = m_buffer;
414  m_ipos = 0; //IMPORTANT
415  return true;
416  }
417 
418  virtual bool wait_buffer(int a_rank,int a_tag,int& a_probe_src,bool a_verbose = false) {
419  return wait_buffer(a_rank,MPI_ANY_SOURCE,a_tag,a_probe_src,a_verbose);
420  }
421 
422 public:
423  wrmpi(std::ostream& a_out,const MPI_Comm& a_comm,tools::uint32 a_size = 128) // we expect a_size!=0
424  :m_out(a_out)
425  ,m_comm(a_comm)
426  ,m_size(0)
427  ,m_buffer(0)
428  ,m_max(0)
429  ,m_pos(0)
430  ,m_ipos(0)
431  {
432 #ifdef TOOLS_MEM
433  tools::mem::increment(s_class().c_str());
434 #endif
435  m_size = a_size;
436  m_buffer = new char[m_size];
437  //if(!m_buffer) {}
439  m_pos = m_buffer;
440  }
441  wrmpi(std::ostream& a_out,const MPI_Comm& a_comm,tools::uint32 a_size,char* a_buffer) //we take ownership of a_buffer.
442  :m_out(a_out)
443  ,m_comm(a_comm)
444  ,m_size(a_size)
445  ,m_buffer(a_buffer)
446  ,m_max(0)
447  ,m_pos(0)
448  ,m_ipos(0)
449  {
450 #ifdef TOOLS_MEM
451  tools::mem::increment(s_class().c_str());
452 #endif
454  m_pos = m_buffer;
455  }
456  virtual ~wrmpi(){
457  delete [] m_buffer;
458 #ifdef TOOLS_MEM
459  tools::mem::decrement(s_class().c_str());
460 #endif
461  }
462 protected:
463  wrmpi(const wrmpi& a_from)
464  :parent(a_from)
465  ,m_out(a_from.m_out)
466  ,m_comm(a_from.m_comm)
467  ,m_size(0)
468  ,m_buffer(0)
469  ,m_max(0)
470  ,m_pos(0)
471  ,m_ipos(0)
472  {
473 #ifdef TOOLS_MEM
474  tools::mem::increment(s_class().c_str());
475 #endif
476  }
477  wrmpi& operator=(const wrmpi&){return *this;}
478 public:
479  int ipos() const {return m_ipos;}
480 #ifdef TOOLS_USE_MPI_PACK_NOT_CONST
481  char* buffer() {return m_buffer;}
482 #else
483  const char* buffer() const {return m_buffer;}
484 #endif
485 
486 protected:
487  bool expand2(tools::uint32 a_new_size) {return expand(tools::mx<tools::uint32>(2*m_size,a_new_size));} //CERN-ROOT logic.
488 
489  bool expand(tools::uint32 a_new_size) {
491  if(!tools::realloc<char>(m_buffer,a_new_size,m_size)) {
492  m_out << "tools::mpi::wrmpi::expand :"
493  << " can't realloc " << a_new_size << " bytes."
494  << std::endl;
495  m_size = 0;
496  m_max = 0;
497  m_pos = 0;
498  //m_wb.set_eob(m_max);
499  return false;
500  }
501  m_size = a_new_size;
502  m_max = m_buffer + m_size;
503  m_pos = m_buffer + len;
504  return true;
505  }
506 
507 protected:
508  std::ostream& m_out;
509  const MPI_Comm& m_comm;
511  char* m_buffer;
512  char* m_max;
513  char* m_pos;
514  //
515  int m_ipos;
516 };
517 
518 }}
519 
520 #endif
MPI_CHAR
#define MPI_CHAR
Definition: dummy_mpi.h:20
tools::mpi::wrmpi::bpack
virtual bool bpack(bool a_val)
Definition: wrmpi:131
tools::mpi::wrmpi::s_class
static const std::string & s_class()
Definition: wrmpi:46
tools::uint64
unsigned long long uint64
Definition: typedefs:72
MPI_Send
int MPI_Send(const void *, int, MPI_Datatype, int, int, MPI_Comm)
Definition: dummy_mpi.h:52
tools::int64
long long int64
Definition: typedefs:67
tools::mpi::wrmpi::wrmpi
wrmpi(std::ostream &a_out, const MPI_Comm &a_comm, tools::uint32 a_size=128)
Definition: wrmpi:423
tools::mpi::wrmpi::m_size
tools::uint32 m_size
Definition: wrmpi:510
mnmx
MPI_INT
#define MPI_INT
Definition: dummy_mpi.h:23
tools::mpi::wrmpi::send_buffer
virtual bool send_buffer(int a_dest, int a_tag)
Definition: wrmpi:393
tools::mpi::wrmpi::pack_reset
virtual void pack_reset()
Definition: wrmpi:383
tools::mpi::wrmpi::pack
virtual bool pack(unsigned int a_val)
Definition: wrmpi:81
tools::mpi::wrmpi::unpack
virtual bool unpack(short &a_val)
Definition: wrmpi:243
tools::mpi::wrmpi::pack
virtual bool pack(float a_val)
Definition: wrmpi:111
tools::mpi::wrmpi::unpack
virtual bool unpack(double &a_val)
Definition: wrmpi:291
tools::mpi::wrmpi::pack
virtual bool pack(short a_val)
Definition: wrmpi:61
tools::mpi::wrmpi::expand2
bool expand2(tools::uint32 a_new_size)
Definition: wrmpi:487
tools::mpi::wrmpi::pack
virtual bool pack(tools::uint64 a_val)
Definition: wrmpi:91
tools::mpi::wrmpi::vpack
virtual bool vpack(const std::vector< unsigned int > &a_v)
Definition: wrmpi:157
tools::mpi::wrmpi::unpack
virtual bool unpack(int &a_val)
Definition: wrmpi:251
tools::mpi::wrmpi::unpack
virtual bool unpack(tools::int64 &a_val)
Definition: wrmpi:275
tools::mpi::wrmpi::pack
virtual bool pack(int a_val)
Definition: wrmpi:71
tools::vec_data
const T * vec_data(const std::vector< T > &a_vec)
Definition: vdata:18
MPI_Pack
int MPI_Pack(const void *, int, MPI_Datatype, void *, int, int *, MPI_Comm)
Definition: dummy_mpi.h:36
tools::mpi::wrmpi::unpack
virtual bool unpack(unsigned int &a_val)
Definition: wrmpi:259
tools::mpi::wrmpi::buffer
const char * buffer() const
Definition: wrmpi:483
tools::mpi::wrmpi::wait_buffer
virtual bool wait_buffer(int a_rank, int a_tag, int &a_probe_src, bool a_verbose=false)
Definition: wrmpi:418
MPI_ANY_SOURCE
#define MPI_ANY_SOURCE
Definition: dummy_mpi.h:28
tools::mpi::wrmpi::m_out
std::ostream & m_out
Definition: wrmpi:508
tools::mpi::wrmpi::num_t
unsigned int num_t
Definition: wrmpi:44
MPI_SUCCESS
#define MPI_SUCCESS
Definition: dummy_mpi.h:30
tools::mpi::wrmpi::m_max
char * m_max
Definition: wrmpi:512
tools::mpi::wrmpi::unpack
virtual bool unpack(tools::uint32 &a_size, char *&a_buffer)
Definition: wrmpi:354
tools::mpi::wrmpi::pack
virtual bool pack(tools::int64 a_val)
Definition: wrmpi:101
mem
MPI_FLOAT
#define MPI_FLOAT
Definition: dummy_mpi.h:17
tools::mpi::wrmpi::m_comm
const MPI_Comm & m_comm
Definition: wrmpi:509
tools::mpi::wrmpi::unpack
virtual bool unpack(tools::uint32 &a_size, int *&a_buffer)
Definition: wrmpi:368
wait_buffer
tools::mpi::wrmpi::vunpack
virtual bool vunpack(std::vector< unsigned int > &a_v)
Definition: wrmpi:310
TOOLS_MPI_INT64
#define TOOLS_MPI_INT64
Definition: wrmpi:35
MPI_UNSIGNED
#define MPI_UNSIGNED
Definition: dummy_mpi.h:16
TOOLS_MPI_UINT64
#define TOOLS_MPI_UINT64
Definition: wrmpi:34
MPI_Comm
void * MPI_Comm
to pass hd2mpi ////////////////////////////////////////////
Definition: dummy_mpi.h:13
tools::impi
Definition: impi:14
tools::mpi::wrmpi::m_ipos
int m_ipos
Definition: wrmpi:515
tools::mpi::wrmpi::sunpack
virtual bool sunpack(std::string &a_s)
Definition: wrmpi:343
tools::mpi::wait_buffer
bool wait_buffer(std::ostream &a_out, int a_rank, int a_src, int a_tag, const MPI_Comm &a_comm, int &a_buffer_size, char *&a_buffer, int &a_probe_src, bool a_verbose=false)
Definition: wait_buffer:18
tools::diff_pointer_t
unsigned long diff_pointer_t
Definition: typedefs:76
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::mpi::wrmpi::m_buffer
char * m_buffer
Definition: wrmpi:511
vdata
tools::mpi::wrmpi::m_pos
char * m_pos
Definition: wrmpi:513
tools::mpi::wrmpi::pack
virtual bool pack(double a_val)
Definition: wrmpi:121
tools::mpi::wrmpi::pack
virtual bool pack(char a_val)
Definition: wrmpi:51
tools::mpi::wrmpi::~wrmpi
virtual ~wrmpi()
Definition: wrmpi:456
tools::mpi::wrmpi::vunpack
virtual bool vunpack(std::vector< double > &a_v)
Definition: wrmpi:332
realloc
tools::mpi::wrmpi::wrmpi
wrmpi(const wrmpi &a_from)
Definition: wrmpi:463
tools::mpi::wrmpi::vunpack
virtual bool vunpack(std::vector< int > &a_v)
Definition: wrmpi:321
MPI_UNSIGNED_CHAR
#define MPI_UNSIGNED_CHAR
Definition: dummy_mpi.h:19
tools::mpi::wrmpi::wrmpi
wrmpi(std::ostream &a_out, const MPI_Comm &a_comm, tools::uint32 a_size, char *a_buffer)
Definition: wrmpi:441
MPI_DOUBLE
#define MPI_DOUBLE
Definition: dummy_mpi.h:18
tools::mpi::wrmpi::ipos
int ipos() const
Definition: wrmpi:479
tools::mpi::wrmpi::expand
bool expand(tools::uint32 a_new_size)
Definition: wrmpi:489
tools::mpi::wrmpi::operator=
wrmpi & operator=(const wrmpi &)
Definition: wrmpi:477
tools::mpi::wrmpi::spack
virtual bool spack(const std::string &a_s)
Definition: wrmpi:142
tools::mpi::wrmpi::pack
virtual bool pack(tools::uint32 a_size, const int *a_buffer)
Definition: wrmpi:219
tools::mpi::wrmpi::wait_buffer
virtual bool wait_buffer(int a_rank, int a_src, int a_tag, int &a_probe_src, bool a_verbose=false)
Definition: wrmpi:401
tools::mpi::wrmpi::unpack
virtual bool unpack(char &a_val)
Definition: wrmpi:235
tools::mpi::wrmpi::unpack
virtual bool unpack(float &a_val)
Definition: wrmpi:283
impi
MPI_Unpack
int MPI_Unpack(const void *, int, int *, void *, int, MPI_Datatype, MPI_Comm)
Definition: dummy_mpi.h:37
tools::mpi::wrmpi::bunpack
virtual bool bunpack(bool &a_val)
Definition: wrmpi:299
tools::mpi::wrmpi::vpack
virtual bool vpack(const std::vector< int > &a_v)
Definition: wrmpi:173
tools::uint32
unsigned int uint32
Definition: typedefs:71
tools::mpi::wrmpi::unpack
virtual bool unpack(tools::uint64 &a_val)
Definition: wrmpi:267
MPI_SHORT
#define MPI_SHORT
Definition: dummy_mpi.h:22
tools::mpi::wrmpi::pack
virtual bool pack(tools::uint32 a_size, const char *a_buffer)
Definition: wrmpi:203
tools::mpi::wrmpi::vpack
virtual bool vpack(const std::vector< double > &a_v)
Definition: wrmpi:188
tools::mpi::wrmpi
Definition: wrmpi:41