CHROMA
t_msumr.cc
Go to the documentation of this file.
1 
2 #include <iostream>
3 #include <sstream>
4 #include <iomanip>
5 #include <string>
6 
7 #include <cstdio>
8 
9 #include <stdlib.h>
10 #include <sys/time.h>
11 #include <math.h>
12 
13 #include "chroma.h"
15 
16 using namespace Chroma;
17 
18 struct App_input_t {
20  Cfg_t cfg;
21 };
22 
23 // Reader for input parameters
24 void read(XMLReader& xml, const std::string& path, App_input_t& input)
25 {
26  XMLReader inputtop(xml, path);
27 
28  // Read the input
29  try
30  {
31  // The parameters holds the version number
32  read(inputtop, "Param", input.param);
33 
34  // Read in the gauge configuration info
35  read(inputtop, "Cfg", input.cfg);
36  }
37  catch (const std::string& e)
38  {
39  QDPIO::cerr << "Error reading data: " << e << std::endl;
40  throw;
41  }
42 }
43 
44 
45 int main(int argc, char **argv)
46 {
47  // Put the machine into a known state
48  Chroma::initialize(&argc, &argv);
49 
50 
51 
52  App_input_t input;
53  XMLReader xml_in(Chroma::getXMLInputFileName());
54 
55  try {
56  read(xml_in, "/ovlapTest", input);
57  }
58  catch( const std::string& e) {
59  QDPIO::cerr << "Caught Exception : " << e << std::endl;
60  QDP_abort(1);
61  }
62 
63 
64  // Setup the lattice
65  Layout::setLattSize(input.param.nrow);
66  Layout::create();
67 
68  multi1d<LatticeColorMatrix> u(Nd);
69  XMLReader gauge_file_xml, gauge_xml;
70  gaugeStartup(gauge_file_xml, gauge_xml, u, input.cfg);
71 
72  XMLFileWriter& xml_out = Chroma::getXMLOutputInstance();
73  push(xml_out,"t_msumr");
74 
75 
76  // Measure the plaquette on the gauge
77  MesPlq(xml_out, "Observables", u);
78  xml_out.flush();
79 
80  // Create a FermBC
82 
83 
84  const Zolotarev4DFermActParams& zolo4d = dynamic_cast<const Zolotarev4DFermActParams& > (*(input.param.FermActHandle));
85 
86  // Construct Fermact -- now uses constructor from the zolo4d params
87  // struct
88  Zolotarev4DFermAct S(fbc, zolo4d, xml_out);
89 
90  Handle<const ConnectState> connect_state(S.createState(u, zolo4d.StateInfo, xml_out,zolo4d.AuxFermActHandle->getMass()));
91 
92  LatticeFermion chi;
93  multi1d<LatticeFermion> psi(3);
94 
95 
96  int n_count;
97 
98  // Solve on chiral point source
99  multi1d<int> coord(4);
100  coord[0] = 0;
101  coord[1] = 0;
102  coord[2] = 0;
103  coord[3] = 0;
104  QDP::StopWatch swatch;
105  double t;
106 
107  chi=zero;
108  srcfil(chi, coord, 0, 0);
109 
110 
111  psi = zero;
112  swatch.reset();
113  swatch.start();
114 
115  S.multiQprop(psi,
116  input.param.MultiMasses,
117  connect_state,
118  chi,
119  REL_SUMR_INVERTER,
120  input.param.invParam.RsdCG,
121  1,
122  input.param.invParam.MaxCG,
123  n_count);
124 
125  swatch.stop();
126  t = swatch.getTimeInSeconds();
127 
128  QDPIO::cout << "Multi Qprop with Relaxed SUMR on Point source: " << n_count
129  << " iters " << std::endl;
130 
131  QDPIO::cout << "Wall Clock Time (Rel SUMR, Point) = " << t << " seconds" << std::endl;
132 
133  push(xml_out, "RelSUMRPoint");
134  write(xml_out, "n_count", n_count);
135  write(xml_out, "t" , t);
136  pop(xml_out);
137 
138 
139  psi = zero;
140  swatch.reset();
141  swatch.start();
142 
143  S.multiQprop(psi,
144  input.param.MultiMasses,
145  connect_state,
146  chi,
147  REL_CG_INVERTER,
148  input.param.invParam.RsdCG,
149  1,
150  input.param.invParam.MaxCG,
151  n_count);
152 
153  swatch.stop();
154  t = swatch.getTimeInSeconds();
155 
156  QDPIO::cout << "Multi Qprop with Relaxed CG on Point source: " << n_count
157  << " iters " << std::endl;
158 
159  QDPIO::cout << "Wall Clock Time (RelCG, Point) = " << t << " seconds" << std::endl;
160 
161  push(xml_out, "RelCGPoint");
162  write(xml_out, "n_count", n_count);
163  write(xml_out, "t" , t);
164  pop(xml_out);
165 
166  psi = zero;
167  swatch.reset();
168  swatch.start();
169 
170  S.multiQprop(psi,
171  input.param.MultiMasses,
172  connect_state,
173  chi,
174  SUMR_INVERTER,
175  input.param.invParam.RsdCG,
176  1,
177  input.param.invParam.MaxCG,
178  n_count);
179 
180  swatch.stop();
181  t = swatch.getTimeInSeconds();
182 
183  QDPIO::cout << "Multi Qprop with Relaxed SUMR on Point source: " << n_count
184  << " iters " << std::endl;
185 
186  QDPIO::cout << "Wall Clock Time (SUMR, Point) = " << t << " seconds" << std::endl;
187 
188  push(xml_out, "SUMRPoint");
189  write(xml_out, "n_count", n_count);
190  write(xml_out, "t" , t);
191  pop(xml_out);
192 
193 
194  psi = zero;
195  swatch.reset();
196  swatch.start();
197 
198  S.multiQprop(psi,
199  input.param.MultiMasses,
200  connect_state,
201  chi,
202  CG_INVERTER,
203  input.param.invParam.RsdCG,
204  1,
205  input.param.invParam.MaxCG,
206  n_count);
207 
208  swatch.stop();
209  t = swatch.getTimeInSeconds();
210 
211  QDPIO::cout << "Multi Qprop with CG on Point source: " << n_count
212  << " iters " << std::endl;
213 
214  QDPIO::cout << "Wall Clock Time (CG, Point) = " << t << " seconds" << std::endl;
215 
216  push(xml_out, "CGPoint");
217  write(xml_out, "n_count", n_count);
218  write(xml_out, "t" , t);
219  pop(xml_out);
220 
221 #if 0
222  gaussian(chi);
223  chi /= sqrt(norm2(chi));
224 
225 
226  psi = zero;
227  swatch.reset();
228  swatch.start();
229 
230  S.multiQprop(psi,
231  input.param.MultiMasses,
232  connect_state,
233  chi,
234  SUMR_INVERTER,
235  input.param.invParam.RsdCG,
236  1,
237  input.param.invParam.MaxCG,
238  n_count);
239 
240  swatch.stop();
241  t = swatch.getTimeInSeconds();
242 
243  QDPIO::cout << "Multi Qprop with SUMR on Gaussian source: " << n_count
244  << " iters " << std::endl;
245 
246  QDPIO::cout << "Wall Clock Time (SUMR, Gaussian) = " << t << " seconds" << std::endl;
247 
248  push(xml_out, "MSUMRGauss");
249  write(xml_out, "n_count", n_count);
250  write(xml_out, "t" , t);
251  pop(xml_out);
252 
253 
254  psi = zero;
255  swatch.reset();
256  swatch.start();
257 
258  S.multiQprop(psi,
259  input.param.MultiMasses,
260  connect_state,
261  chi,
262  SUMR_INVERTER,
263  input.param.invParam.RsdCG,
264  1,
265  input.param.invParam.MaxCG,
266  n_count);
267 
268  swatch.stop();
269  t = swatch.getTimeInSeconds();
270 
271  QDPIO::cout << "Multi Qprop with CG on Gaussian source: " << n_count
272  << " iters " << std::endl;
273 
274  QDPIO::cout << "Wall Clock Time (CG, Gaussian) = " << t << " seconds" << std::endl;
275 
276  push(xml_out, "CGGauss");
277  write(xml_out, "n_count", n_count);
278  write(xml_out, "t" , t);
279  pop(xml_out);
280 
281 #endif
282 
283  pop(xml_out);
285 
286  exit(0);
287 }
Primary include file for CHROMA in application codes.
Class for counted reference semantics.
Definition: handle.h:33
Concrete class for all gauge actions with simple boundary conditions.
Definition: simple_fermbc.h:42
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
void gaugeStartup(XMLReader &gauge_file_xml, XMLReader &gauge_xml, multi1d< LatticeColorMatrix > &u, Cfg_t &cfg)
Initialize the gauge fields.
void srcfil(LatticeFermion &a, const multi1d< int > &coord, int color_index, int spin_index)
Fill a specific color and spin index with 1.0.
Definition: srcfil.cc:23
multi1d< int > coord(Nd)
int t
Definition: meslate.cc:37
Nd
Definition: meslate.cc:74
Conjugate-Gradient algorithm for a generic Linear Operator.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
gaussian(aux)
static multi1d< LatticeColorMatrix > u
int n_count
Definition: invbicg.cc:78
push(xml_out,"Condensates")
void initialize(int *argc, char ***argv)
Chroma initialisation routine.
Definition: chroma_init.cc:114
void finalize(void)
Chroma finalization routine.
Definition: chroma_init.cc:308
multi1d< LatticeFermion > chi(Ncb)
std::string getXMLInputFileName()
Get input file name.
Definition: chroma_init.cc:88
LatticeFermion psi
Definition: mespbg5p_w.cc:35
pop(xml_out)
void MesPlq(const multi1d< LatticeColorMatrixF3 > &u, multi2d< Double > &plane_plaq, Double &link)
Definition: mesplq.cc:83
XMLFileWriter & getXMLOutputInstance()
Get xml output instance.
Definition: chroma_init.cc:359
Double zero
Definition: invbicg.cc:106
::std::string string
Definition: gtest.h:1979
ChromaMultiProp_t param
Definition: t_msumr.cc:19
ChromaProp_t param
Definition: t_bicgstab.cc:19
Gauge configuration structure.
Definition: cfgtype_io.h:16
Multi-propagator parameters.
Definition: qprop_io.h:61
GroupXML_t invParam
Definition: qprop_io.h:84
int main(int argc, char **argv)
Definition: t_msumr.cc:45