Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fprop_Standard_eo.cpp
Go to the documentation of this file.
1 
14 #include "fprop_Standard_eo.h"
15 
16 const std::string Fprop_Standard_eo::class_name = "Fprop_Standard_eo";
17 
18 //====================================================================
20 {
21  m_index->convertField(*m_Ueo, *U);
22 
24 }
25 
26 
27 //====================================================================
28 void Fprop_Standard_eo::invert_D(Field& xq, const Field& b, int& Nconv, double& diff)
29 {
30  const int Nin = b.nin();
31  const int Nvol = b.nvol();
32  const int Nex = b.nex();
33 
34  Field Be(Nin, Nvol / 2, Nex);
35  Field bo(Nin, Nvol / 2, Nex);
36  Field xe(Nin, Nvol / 2, Nex);
37 
38  int Nconv1 = 0;
39 
40  Fopr_eo *fopr = (Fopr_eo *)m_solver->get_fopr();
41 
42  fopr->set_mode("D");
43  fopr->preProp(Be, bo, b);
44 
45 #pragma omp parallel
46  {
47  m_solver->solve(xe, Be, Nconv1, diff);
48  }
49 
50  fopr->postProp(xq, xe, bo);
51 
52  //- NB. #mult is doubled for even-odd
53  Nconv = 2 * Nconv1;
54 }
55 
56 
57 //====================================================================
58 void Fprop_Standard_eo::invert_DdagD(Field& xq, const Field& b, int& Nconv, double& diff)
59 {
60  const int Nin = b.nin();
61  const int Nvol = b.nvol();
62  const int Nex = b.nex();
63 
64  Field Be(Nin, Nvol / 2, Nex);
65  Field bo(Nin, Nvol / 2, Nex);
66  Field xe(Nin, Nvol / 2, Nex);
67 
68  int Nconv1 = 0, Nconv2 = 0;
69  double diff1 = 1.0, diff2 = 1.0;
70 
71  Fopr_eo *fopr = (Fopr_eo *)m_solver->get_fopr();
72 
73  fopr->set_mode("Ddag");
74  fopr->preProp(Be, bo, b);
75 
76 #pragma omp parallel
77  {
78  m_solver->solve(xe, Be, Nconv1, diff1);
79  }
80 
81  fopr->postProp(xq, xe, bo);
82 
83  fopr->set_mode("D");
84  fopr->preProp(Be, bo, xq);
85 
86 #pragma omp parallel
87  {
88  m_solver->solve(xe, Be, Nconv2, diff2);
89  }
90 
91  fopr->postProp(xq, xe, bo);
92 
93  //- NB. #mult is doubled for even-odd
94  Nconv = 2 * (Nconv1 + Nconv2);
95 
96  //- rough estimate of diff
97  diff = (diff1 + diff2) / 2.0;
98 }
99 
100 
101 //====================================================================
103 {
104  const int NPE = CommonParameters::NPE();
105  const double eps = CommonParameters::epsilon_criterion();
106 
107  //- NB1 Nin = 2 * Nc * Nd, Nex = 1 for field_F
108  //- NB2 Nvol/2 for eo
109  const int Nin = 2 * CommonParameters::Nc() * CommonParameters::Nd();
110  const int Nvol = CommonParameters::Nvol();
111  const int Nex = 1;
112 
113  const double flop_fopr = m_solver->get_fopr()->flop_count();
114 
115  if (flop_fopr < eps) {
116  vout.crucial(m_vl, "Warning at %s: no fopr->flop_count() is available, setting flop = 0.0.\n", class_name.c_str());
117  return 0.0;
118  }
119 
120  const double flop_axpy = static_cast<double>(Nin * Nex * 2) * (Nvol / 2 * NPE);
121 
122  const double flop_preProp = flop_fopr + flop_axpy;
123  const double flop_solver = m_solver->flop_count();
124  const double flop_postProp = flop_fopr + flop_axpy;
125 
126  const double flop = flop_preProp + 2 * flop_solver + flop_postProp;
127 
128  return flop;
129 }
130 
131 
132 //====================================================================
133 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:503
static double epsilon_criterion()
void set_config(Field *)
virtual void set_config(Field *)=0
setting pointer to the gauge configuration.
virtual void postProp(Field &, const Field &, const Field &)=0
Container of Field-type object.
Definition: field.h:45
static const std::string class_name
int nvol() const
Definition: field.h:127
virtual Fopr * get_fopr()=0
void invert_D(Field &, const Field &, int &, double &)
void convertField(Field &eo, const Field &lex)
Definition: index_eo.cpp:20
int nin() const
Definition: field.h:126
Bridge::VerboseLevel m_vl
Definition: fprop.h:33
void invert_DdagD(Field &, const Field &, int &, double &)
virtual double flop_count()
returns the flop in giga unit
Definition: fopr.h:120
Base class of fermion operator family.
Definition: fopr_eo.h:34
int nex() const
Definition: field.h:128
virtual void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: fopr_eo.h:56
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
virtual void preProp(Field &, Field &, const Field &)=0
virtual void solve(Field &solution, const Field &source, int &Nconv, double &diff)=0
virtual double flop_count()=0