MADNESS  version 0.9
print_seq.h
Go to the documentation of this file.
1 /*
2  This file is part of MADNESS.
3 
4  Copyright (C) 2007,2010 Oak Ridge National Laboratory
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20  For more information please contact:
21 
22  Robert J. Harrison
23  Oak Ridge National Laboratory
24  One Bethel Valley Road
25  P.O. Box 2008, MS-6367
26 
27  email: harrisonrj@ornl.gov
28  tel: 865-241-3937
29  fax: 865-572-0680
30 
31  $Id$
32 */
33 #ifndef MADNESS_WORLD_PRINT_SEQ_H__INCLUDED
34 #define MADNESS_WORLD_PRINT_SEQ_H__INCLUDED
35 
38 
39 namespace madness {
41  template <typename A, typename B, typename C, typename D>
42  void print_seq(World& world, const A& a, const B& b, const C& c, const D& d) {
43  if (world.rank() == 0) {
44  printf("%6d : ",0);
45  print(a, b, c, d);
46  for (int p=1; p<world.size(); ++p) {
47  A aa;
48  B bb;
49  C cc;
50  D dd;
51  archive::MPIOutputArchive(world,p) & 1;
52  archive::MPIInputArchive(world, p) & aa & bb & cc & dd;
53  printf("%6d : ",p);
54  print(aa, bb, cc, dd);
55  }
56  }
57  else {
58  int i;
59  archive::MPIInputArchive(world, 0) & i;
60  archive::MPIOutputArchive(world, 0) & a & b & c & d;
61  }
62  }
63 
65  template <typename A, typename B, typename C>
66  void print_seq(World& world, const A& a, const B& b, const C& c) {
67  if (world.rank() == 0) {
68  printf("%6d : ",0);
69  print(a, b, c);
70  for (int p=1; p<world.size(); ++p) {
71  A aa;
72  B bb;
73  C cc;
74  archive::MPIOutputArchive(world,p) & 1;
75  archive::MPIInputArchive(world, p) & aa & bb & cc;
76  printf("%6d : ",p);
77  print(aa, bb, cc);
78  }
79  }
80  else {
81  int i;
82  archive::MPIInputArchive(world, 0) & i;
83  archive::MPIOutputArchive(world, 0) & a & b & c;
84  }
85  }
86 
88  template <typename A, typename B>
89  void print_seq(World& world, const A& a, const B& b) {
90  if (world.rank() == 0) {
91  printf("%6d : ",0);
92  print(a, b);
93  for (int p=1; p<world.size(); ++p) {
94  A aa;
95  B bb;
96  archive::MPIOutputArchive(world,p) & 1;
97  archive::MPIInputArchive(world, p) & aa & bb;
98  printf("%6d : ",p);
99  print(aa, bb);
100  }
101  }
102  else {
103  int i;
104  archive::MPIInputArchive(world, 0) & i;
105  archive::MPIOutputArchive(world, 0) & a & b;
106  }
107  }
108 
110  template <typename A>
111  void print_seq(World& world, const A& a) {
112  if (world.rank() == 0) {
113  printf("%6d : ",0);
114  print(a);
115  for (int p=1; p<world.size(); ++p) {
116  A aa;
117  archive::MPIOutputArchive(world,p) & 1;
118  archive::MPIInputArchive(world, p) & aa;
119  printf("%6d : ",p);
120  print(aa);
121  }
122  }
123  else {
124  int i;
125  archive::MPIInputArchive(world, 0) & i;
126  archive::MPIOutputArchive(world, 0) & a;
127  }
128  }
129 }
130 
131 #endif // MADNESS_WORLD_PRINT_SEQ_H__INCLUDED
Tensor< double > B
Definition: tdse1d.cc:167
void print_seq(World &world, const A &a, const B &b, const C &c, const D &d)
Sequentially ordered printing of (serializable) data from every process ... collective no fence...
Definition: print_seq.h:42
ProcessID size() const
Returns the number of processes in this world (same as MPI_Comm_size())
Definition: worldfwd.h:533
JLOOP2 NK jnz KLOOP2 mov C
Definition: mtxm_gen.h:10
FLOAT a(int j, FLOAT z)
Definition: y1.cc:86
Definition: mpiar.h:119
A parallel world with full functionality wrapping an MPI communicator.
Definition: worldfwd.h:416
ProcessID rank() const
Returns the process rank in this world (same as MPI_Comm_rank()))
Definition: worldfwd.h:526
void print(const A &a)
Print a single item to std::cout terminating with new line.
Definition: print.h:122
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45
const double c
Definition: gfit.cc:200
FLOAT b(int j, FLOAT z)
Definition: y1.cc:79