CHROMA
syssolver_linop_clover_quda_multigrid_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \QUDA MULTIGRID Clover solver.
3  */
4 // comment
9 #include "io/aniso_io.h"
10 
11 
12 #include "handle.h"
15 #include "meas/glue/mesplq.h"
16 // QUDA Headers
17 #include <quda.h>
18 // #include <util_quda.h>
20 
21 namespace Chroma
22 {
23  namespace LinOpSysSolverQUDAMULTIGRIDCloverEnv
24  {
25 
26  //! Anonymous namespace
27  namespace
28  {
29  //! Name to be used
30  const std::string name("QUDA_MULTIGRID_CLOVER_INVERTER");
31 
32  //! Local registration flag
33  bool registered = false;
34  }
35 
36 
37 
39  const std::string& path,
40  Handle< FermState< LatticeFermion, multi1d<LatticeColorMatrix>, multi1d<LatticeColorMatrix> > > state,
41 
43  {
44  return new LinOpSysSolverQUDAMULTIGRIDClover(A, state,SysSolverQUDAMULTIGRIDCloverParams(xml_in, path));
45  }
46 
47  //! Register all the factories
48  bool registerAll()
49  {
50  bool success = true;
51  if (! registered)
52  {
54  registered = true;
55  }
56  return success;
57  }
58  }
59 
60  SystemSolverResults_t
61  LinOpSysSolverQUDAMULTIGRIDClover::qudaInvert(const CloverTermT<T, U>& clover,
62  const CloverTermT<T, U>& invclov,
63  const T& chi_s,
64  T& psi_s) const{
65 
66  SystemSolverResults_t ret;
67 
68  T mod_chi;
69 
70  // Copy source into mod_chi, and zero the off-parity
71  mod_chi[rb[0]] = zero;
72 
73 
74  if( invParam.asymmetricP ) {
75  //
76  // symmetric
77  // Solve with M_symm = 1 - A^{-1}_oo D A^{-1}ee D
78  //
79  // Chroma M = A_oo ( M_symm )
80  //
81  // So M x = b => A_oo (M_symm) x = b
82  // => M_symm x = A^{-1}_oo b = chi_mod
83  invclov.apply(mod_chi, chi_s, PLUS, 1);
84  }
85  else {
86  mod_chi[rb[1]] = chi_s;
87  }
88 
89 #ifndef BUILD_QUDA_DEVIFACE_SPINOR
90  void* spinorIn =(void *)&(mod_chi.elem(rb[1].start()).elem(0).elem(0).real());
91  void* spinorOut =(void *)&(psi_s.elem(rb[1].start()).elem(0).elem(0).real());
92 #else
93  // void* spinorIn = GetMemoryPtr( mod_chi.getId() );
94  // void* spinorOut = GetMemoryPtr( psi_s.getId() );
95  void* spinorIn;
96  void* spinorOut;
97  GetMemoryPtr2(spinorIn,spinorOut,mod_chi.getId(),psi_s.getId())
98 
99 #endif
100 
101  // Do the solve here
102  StopWatch swatch1;
103  swatch1.reset();
104  swatch1.start();
105  invertQuda(spinorOut, spinorIn, (QudaInvertParam*)&quda_inv_param);
106  swatch1.stop();
107 
108 
109  QDPIO::cout << solver_string<< "time="<< quda_inv_param.secs <<" s" ;
110  QDPIO::cout << "\tPerformance="<< quda_inv_param.gflops/quda_inv_param.secs<<" GFLOPS" ;
111  QDPIO::cout << "\tTotal Time (incl. load gauge)=" << swatch1.getTimeInSeconds() <<" s"<<std::endl;
112 
113  ret.n_count =quda_inv_param.iter;
114  ret.resid = quda_inv_param.true_res;
115  return ret;
116 
117  }
118 
119 
120 }
121 
Anisotropy parameters.
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
static T & Instance()
Definition: singleton.h:432
Class for counted reference semantics.
Wilson Dslash linear operator.
static bool registered
Local registration flag.
const std::string name
Name to be used.
LinOpSystemSolver< LatticeFermion > * createFerm(XMLReader &xml_in, const std::string &path, Handle< FermState< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > > state, Handle< LinearOperator< LatticeFermion > > A)
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
@ PLUS
Definition: chromabase.h:45
A(A, psi, r, Ncb, PLUS)
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
Double zero
Definition: invbicg.cc:106
::std::string string
Definition: gtest.h:1979
Periodic ferm state and a creator.
Register linop system solvers that solve M*psi=chi.
Factory for solving M*psi=chi where M is not hermitian or pos. def.
LatticeFermion T
Definition: t_clover.cc:11