QUDA  v1.1.0
A library for QCD on GPUs
inv_xsd_quda.cpp
Go to the documentation of this file.
1 #include <cstdio>
2 #include <cstdlib>
3 #include <cmath>
4 #include <iostream>
5 
6 #include <quda_internal.h>
7 #include <color_spinor_field.h>
8 #include <blas_quda.h>
9 #include <dslash_quda.h>
10 #include <invert_quda.h>
11 #include <util_quda.h>
12 #include <sys/time.h>
13 
14 namespace quda {
15 
17  Solver(mat, mat, mat, mat, param, profile)
18  {
19  sd = new SD(mat,param,profile);
20  for(int i=0; i<4; ++i) R[i] = param.overlap_precondition*comm_dim_partitioned(i);
21  }
22 
25  if(init){
26  delete xx;
27  delete bx;
28  }
29  delete sd;
31  }
32 
34  {
35  if(!init){
37  for(int i=0; i<4; ++i) csParam.x[i] += 2*R[i];
38  xx = new cudaColorSpinorField(csParam);
39  bx = new cudaColorSpinorField(csParam);
40  init = true;
41  }
42 
43  int parity = mat.getMatPCType();
44  copyExtendedColorSpinor(*bx, b, QUDA_CUDA_FIELD_LOCATION, parity, NULL, NULL, NULL, NULL);
46 
47  sd->operator()(*xx,*bx); // actuall run SD
48 
49  // copy the interior region of the solution back
50  copyExtendedColorSpinor(x, *xx, QUDA_CUDA_FIELD_LOCATION, parity, NULL, NULL, NULL, NULL);
51  return;
52  }
53 
54 } // namespace quda
QudaMatPCType getMatPCType() const
Definition: dirac_quda.h:1911
TimeProfile & profile
Definition: invert_quda.h:471
const DiracMatrix & mat
Definition: invert_quda.h:465
SolverParam & param
Definition: invert_quda.h:470
XSD(const DiracMatrix &mat, SolverParam &param, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
virtual ~XSD()
int comm_dim_partitioned(int dim)
void mat(void *out, void **link, void *in, int dagger_bit, int mu, QudaPrecision sPrecision, QudaPrecision gPrecision)
QudaParity parity
Definition: covdev_test.cpp:40
@ QUDA_CUDA_FIELD_LOCATION
Definition: enum_quda.h:326
void exchangeExtendedGhost(cudaColorSpinorField *spinor, int R[], int parity, qudaStream_t *stream_p)
@ QUDA_PROFILE_FREE
Definition: timer.h:111
void copyExtendedColorSpinor(ColorSpinorField &dst, const ColorSpinorField &src, QudaFieldLocation location, const int parity, void *Dst, void *Src, void *dstNorm, void *srcNorm)
ColorSpinorParam csParam
Definition: pack_test.cpp:25
QudaGaugeParam param
Definition: pack_test.cpp:18
qudaStream_t * streams
Definition: device.cpp:15
bool is_preconditioner
verbosity to use for preconditioner
Definition: invert_quda.h:238