CHROMA
multi_syssolver_quda_clover_params.cc
Go to the documentation of this file.
2 #include "chromabase.h"
3 #include "io/xml_group_reader.h"
4 #include "chroma_config.h"
5 
6 
7 
8 using namespace QDP;
9 
10 namespace Chroma {
11 
12  MultiSysSolverQUDACloverParams::MultiSysSolverQUDACloverParams(XMLReader& xml,
13  const std::string& path)
14  {
15  XMLReader paramtop(xml, path);
16 
17  read(paramtop, "MaxIter", MaxIter);
18  read(paramtop, "RsdTarget", RsdTarget);
19  read(paramtop, "CloverParams", CloverParams);
20  read(paramtop, "AntiPeriodicT", AntiPeriodicT);
21 
22  read(paramtop, "Delta", Delta);
23 
24 
25  read(paramtop, "SolverType", solverType);
26 
27  if ( paramtop.count("Verbose") > 0 ) {
28  read(paramtop, "Verbose", verboseP);
29  }
30  else {
31  verboseP = false;
32  }
33  if ( paramtop.count("AsymmetricLinop") > 0 ) {
34  read(paramtop, "AsymmetricLinop", asymmetricP);
35  }
36  else {
37  asymmetricP = false; // Symmetric is default
38  }
39 
40  if( paramtop.count("CudaPrecision") > 0 ) {
41  read(paramtop, "CudaPrecision", cudaPrecision);
42  }
43  else {
44  cudaPrecision = DEFAULT;
45  }
46 
47  if( paramtop.count("CudaSloppyPrecision") > 0 ) {
48  read(paramtop, "CudaSloppyPrecision", cudaSloppyPrecision);
49  }
50  else {
51  cudaSloppyPrecision = DEFAULT;
52  }
53 
54  if( paramtop.count("CudaRefinementPrecision") > 0 ) {
55  read(paramtop, "CudaRefinementPrecision", cudaRefinementPrecision);
56  }
57  else {
58  cudaRefinementPrecision = DEFAULT;
59  }
60 
61  if( paramtop.count("CudaReconstruct") > 0 ) {
62  read(paramtop, "CudaReconstruct", cudaReconstruct);
63  }
64  else {
65  cudaReconstruct = RECONS_12;
66  }
67 
68  if( paramtop.count("CudaSloppyReconstruct") > 0 ) {
69  read(paramtop, "CudaSloppyReconstruct", cudaSloppyReconstruct);
70  }
71  else {
72  cudaSloppyReconstruct = RECONS_12;
73  }
74 
75  if( paramtop.count("CudaRefinementReconstruct") > 0 ) {
76  read(paramtop, "CudaRefinementReconstruct", cudaRefinementReconstruct);
77  }
78  else {
79  cudaRefinementReconstruct = RECONS_12;
80  }
81 
82  if( paramtop.count("AxialGaugeFix") > 0 ) {
83  read(paramtop, "AxialGaugeFix", axialGaugeP);
84  }
85  else {
86  axialGaugeP = false;
87  }
88 
89  if( paramtop.count("SilentFail") > 0) {
90  read(paramtop, "SilentFail", SilentFailP);
91  }
92  else {
93  SilentFailP = false;
94  }
95 
96  if( paramtop.count("RsdToleranceFactor") > 0 ) {
97  read(paramtop, "RsdToleranceFactor", RsdToleranceFactor);
98  }
99  else {
100  RsdToleranceFactor = Real(10); // Tolerate an order of magnitude difference by default.
101  }
102 
103  if( paramtop.count("AutotuneDslash") > 0 ) {
104  read(paramtop, "AutotuneDslash", tuneDslashP);
105  }
106  else {
107  tuneDslashP = false;
108  }
109  QDPIO::cout << "tuneDslasP = " << tuneDslashP << std::endl;
110 
111 
112  if( paramtop.count("GCRInnerParams") > 0 ) {
113  innerParams = new GCRInnerSolverParams(paramtop, "./GCRInnerParams");
114  innerParamsP = true;
115  }
116  else {
117  innerParamsP = false;
118  }
119 
120  if ( paramtop.count("CheckShifts") == 1 ) {
121  read(paramtop, "CheckShifts", checkShiftsP );
122  }
123  // Backward compatibility
124  if( paramtop.count("check_shifts") == 1) {
125  read(paramtop, "check_shifts", checkShiftsP) ;
126  }
127 
128  if( paramtop.count("Pipeline") == 1 ) {
129  read(paramtop, "Pipeline", Pipeline);
130  }
131  else {
132  Pipeline = 1;
133  }
134 
135  }
136 
137  void read(XMLReader& xml, const std::string& path,
139  {
141  p = tmp;
142  }
143 
144  void write(XMLWriter& xml, const std::string& path,
146  push(xml, path);
147  write(xml, "MaxIter", p.MaxIter);
148  write(xml, "RsdTarget", p.RsdTarget);
149  write(xml, "CloverParams", p.CloverParams);
150  write(xml, "AntiPeriodicT", p.AntiPeriodicT);
151  write(xml, "Delta", p.Delta);
152  write(xml, "SolverType", p.solverType);
153  write(xml, "Verbose", p.verboseP);
154  write(xml, "AsymmetricLinop", p.asymmetricP);
155  write(xml, "CudaPrecision", p.cudaPrecision);
156  write(xml, "CudaReconstruct", p.cudaReconstruct);
157  write(xml, "CudaSloppyPrecision", p.cudaSloppyPrecision);
158  write(xml, "CudaSloppyReconstruct", p.cudaSloppyReconstruct);
159  write(xml, "AxialGaugeFix", p.axialGaugeP);
160  write(xml, "SilentFail", p.SilentFailP);
161  write(xml, "RsdToleranceFactor", p.RsdToleranceFactor);
162  write(xml, "CheckShifts", p.checkShiftsP);
163  write(xml, "AutotuneDslash", p.tuneDslashP);
164  write(xml, "Pipeline", p.Pipeline);
165 
166  if( p.innerParamsP ) {
167  write(xml, "GCRInnerParams", *(p.innerParams));
168  }
169  pop(xml);
170 
171  }
172 
173 
174 
175 }
Primary include file for CHROMA library code.
Double tmp
Definition: meslate.cc:60
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
void write(XMLWriter &xml, const std::string &path, const MultiSysSolverQUDACloverParams &p)
void read(XMLReader &xml, const std::string &path, MultiSysSolverQUDACloverParams &p)
@ RECONS_12
Definition: enum_quda_io.h:80
::std::string string
Definition: gtest.h:1979
push(xml_out,"Cooled_Topology")
pop(xml_out)
Read an XML group as a std::string.