void DiracWilsonPC::prepare(cudaColorSpinorField* &src, cudaColorSpinorField* &sol, cudaColorSpinorField &x, cudaColorSpinorField &b, const QudaSolutionType solType) const { // we desire solution to preconditioned system if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) { src = &b; sol = &x; } else { // we desire solution to full system if (matpcType == QUDA_MATPC_EVEN_EVEN) { // src = b_e + k D_eo b_o DslashXpay(x.Odd(), b.Odd(), QUDA_EVEN_PARITY, b.Even(), kappa); src = &(x.Odd()); sol = &(x.Even()); } else if (matpcType == QUDA_MATPC_ODD_ODD) { // src = b_o + k D_oe b_e DslashXpay(x.Even(), b.Even(), QUDA_ODD_PARITY, b.Odd(), kappa); src = &(x.Even()); sol = &(x.Odd()); } else { errorQuda("MatPCType %d not valid for DiracWilsonPC", matpcType); } // here we use final solution to store parity solution and parity source // b is now up for grabs if we want } }
void DiracCloverPC::reconstruct(cudaColorSpinorField &x, const cudaColorSpinorField &b, const QudaSolutionType solType) const { if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) { return; } checkFullSpinor(x, b); bool reset = newTmp(&tmp1, b.Even()); // create full solution if (matpcType == QUDA_MATPC_EVEN_EVEN || matpcType == QUDA_MATPC_EVEN_EVEN_ASYMMETRIC) { // x_o = A_oo^-1 (b_o + k D_oe x_e) DiracWilson::DslashXpay(*tmp1, x.Even(), QUDA_ODD_PARITY, b.Odd(), kappa); CloverInv(x.Odd(), *tmp1, QUDA_ODD_PARITY); } else if (matpcType == QUDA_MATPC_ODD_ODD || matpcType == QUDA_MATPC_ODD_ODD_ASYMMETRIC) { // x_e = A_ee^-1 (b_e + k D_eo x_o) DiracWilson::DslashXpay(*tmp1, x.Odd(), QUDA_EVEN_PARITY, b.Even(), kappa); CloverInv(x.Even(), *tmp1, QUDA_EVEN_PARITY); } else { errorQuda("MatPCType %d not valid for DiracCloverPC", matpcType); } deleteTmp(&tmp1, reset); }
void DiracStaggered::MdagM(cudaColorSpinorField &out, const cudaColorSpinorField &in) const { if (!initDslash){ initDslashConstants(*fatGauge, in.Stride()); initStaggeredConstants(*fatGauge, *longGauge); } bool reset = newTmp(&tmp1, in); cudaColorSpinorField* mytmp = dynamic_cast<cudaColorSpinorField*>(&(tmp1->Even())); cudaColorSpinorField* ineven = dynamic_cast<cudaColorSpinorField*>(&(in.Even())); cudaColorSpinorField* inodd = dynamic_cast<cudaColorSpinorField*>(&(in.Odd())); cudaColorSpinorField* outeven = dynamic_cast<cudaColorSpinorField*>(&(out.Even())); cudaColorSpinorField* outodd = dynamic_cast<cudaColorSpinorField*>(&(out.Odd())); //even Dslash(*mytmp, *ineven, QUDA_ODD_PARITY); DslashXpay(*outeven, *mytmp, QUDA_EVEN_PARITY, *ineven, 4*mass*mass); //odd Dslash(*mytmp, *inodd, QUDA_EVEN_PARITY); DslashXpay(*outodd, *mytmp, QUDA_ODD_PARITY, *inodd, 4*mass*mass); deleteTmp(&tmp1, reset); }
// Full staggered operator void DiracStaggered::M(cudaColorSpinorField &out, const cudaColorSpinorField &in) const { bool reset = newTmp(&tmp1, in.Even()); DslashXpay(out.Even(), in.Odd(), QUDA_EVEN_PARITY, *tmp1, 2*mass); DslashXpay(out.Odd(), in.Even(), QUDA_ODD_PARITY, *tmp1, 2*mass); deleteTmp(&tmp1, reset); }
// Full staggered operator void DiracStaggered::M(cudaColorSpinorField &out, const cudaColorSpinorField &in) const { if (!initDslash){ initDslashConstants(*fatGauge, in.Stride()); initStaggeredConstants(*fatGauge, *longGauge); } bool reset = newTmp(&tmp1, in.Even()); DslashXpay(out.Even(), in.Odd(), QUDA_EVEN_PARITY, *tmp1, 2*mass); DslashXpay(out.Odd(), in.Even(), QUDA_ODD_PARITY, *tmp1, 2*mass); deleteTmp(&tmp1, reset); }
// FIXME: create kernel to eliminate tmp void DiracClover::M(cudaColorSpinorField &out, const cudaColorSpinorField &in) const { checkFullSpinor(out, in); cudaColorSpinorField *tmp=0; // this hack allows for tmp2 to be full or parity field if (tmp2) { if (tmp2->SiteSubset() == QUDA_FULL_SITE_SUBSET) tmp = &(tmp2->Even()); else tmp = tmp2; } bool reset = newTmp(&tmp, in.Even()); Clover(*tmp, in.Odd(), QUDA_ODD_PARITY); DslashXpay(out.Odd(), in.Even(), QUDA_ODD_PARITY, *tmp, -kappa); Clover(*tmp, in.Even(), QUDA_EVEN_PARITY); DslashXpay(out.Even(), in.Odd(), QUDA_EVEN_PARITY, *tmp, -kappa); deleteTmp(&tmp, reset); }
void DiracWilsonPC::reconstruct(cudaColorSpinorField &x, const cudaColorSpinorField &b, const QudaSolutionType solType) const { if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) { return; } // create full solution checkFullSpinor(x, b); if (matpcType == QUDA_MATPC_EVEN_EVEN) { // x_o = b_o + k D_oe x_e DslashXpay(x.Odd(), x.Even(), QUDA_ODD_PARITY, b.Odd(), kappa); } else if (matpcType == QUDA_MATPC_ODD_ODD) { // x_e = b_e + k D_eo x_o DslashXpay(x.Even(), x.Odd(), QUDA_EVEN_PARITY, b.Even(), kappa); } else { errorQuda("MatPCType %d not valid for DiracWilsonPC", matpcType); } }
void DiracCloverPC::prepare(cudaColorSpinorField* &src, cudaColorSpinorField* &sol, cudaColorSpinorField &x, cudaColorSpinorField &b, const QudaSolutionType solType) const { // we desire solution to preconditioned system if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) { src = &b; sol = &x; return; } bool reset = newTmp(&tmp1, b.Even()); // we desire solution to full system if (matpcType == QUDA_MATPC_EVEN_EVEN) { // src = A_ee^-1 (b_e + k D_eo A_oo^-1 b_o) src = &(x.Odd()); CloverInv(*src, b.Odd(), QUDA_ODD_PARITY); DiracWilson::DslashXpay(*tmp1, *src, QUDA_EVEN_PARITY, b.Even(), kappa); CloverInv(*src, *tmp1, QUDA_EVEN_PARITY); sol = &(x.Even()); } else if (matpcType == QUDA_MATPC_ODD_ODD) { // src = A_oo^-1 (b_o + k D_oe A_ee^-1 b_e) src = &(x.Even()); CloverInv(*src, b.Even(), QUDA_EVEN_PARITY); DiracWilson::DslashXpay(*tmp1, *src, QUDA_ODD_PARITY, b.Odd(), kappa); CloverInv(*src, *tmp1, QUDA_ODD_PARITY); sol = &(x.Odd()); } else if (matpcType == QUDA_MATPC_EVEN_EVEN_ASYMMETRIC) { // src = b_e + k D_eo A_oo^-1 b_o src = &(x.Odd()); CloverInv(*tmp1, b.Odd(), QUDA_ODD_PARITY); // safe even when *tmp1 = b.odd DiracWilson::DslashXpay(*src, *tmp1, QUDA_EVEN_PARITY, b.Even(), kappa); sol = &(x.Even()); } else if (matpcType == QUDA_MATPC_ODD_ODD_ASYMMETRIC) { // src = b_o + k D_oe A_ee^-1 b_e src = &(x.Even()); CloverInv(*tmp1, b.Even(), QUDA_EVEN_PARITY); // safe even when *tmp1 = b.even DiracWilson::DslashXpay(*src, *tmp1, QUDA_ODD_PARITY, b.Odd(), kappa); sol = &(x.Odd()); } else { errorQuda("MatPCType %d not valid for DiracCloverPC", matpcType); } // here we use final solution to store parity solution and parity source // b is now up for grabs if we want deleteTmp(&tmp1, reset); }
void DiracWilson::M(cudaColorSpinorField &out, const cudaColorSpinorField &in) const { checkFullSpinor(out, in); DslashXpay(out.Odd(), in.Even(), QUDA_ODD_PARITY, in.Odd(), -kappa); DslashXpay(out.Even(), in.Odd(), QUDA_EVEN_PARITY, in.Even(), -kappa); }
// Full staggered operator void DiracStaggered::M(cudaColorSpinorField &out, const cudaColorSpinorField &in) const { DslashXpay(out.Even(), in.Odd(), QUDA_EVEN_PARITY, in.Even(), 2*mass); DslashXpay(out.Odd(), in.Even(), QUDA_ODD_PARITY, in.Odd(), 2*mass); }