From 7909683f3b514e23f1960dd52a4f772ee51b4327 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Wed, 17 Jan 2024 16:21:07 -0500 Subject: [PATCH] MultiRHS --- Grid/algorithms/iterative/AdefGeneric.h | 39 ++++++++++--------------- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/Grid/algorithms/iterative/AdefGeneric.h b/Grid/algorithms/iterative/AdefGeneric.h index b63db1ba..474a6b1d 100644 --- a/Grid/algorithms/iterative/AdefGeneric.h +++ b/Grid/algorithms/iterative/AdefGeneric.h @@ -69,7 +69,7 @@ class TwoLevelCG : public LinearFunction virtual void operator() (const Field &src, Field &x) { - std::cout << GridLogMessage<<"HDCG: fPcg starting"< ///////////////////////////// // Set up history vectors ///////////////////////////// - int mmax = 2; + int mmax = 3; std::cout << GridLogMessage<<"HDCG: fPcg allocating"<Barrier(); std::vector > p(nrhs); for(int r=0;r // Compute z = M x (for *all* RHS) PcgM1(r,z); - + std::cout << GridLogMessage<<"HDCG::fPcg M1 complete"<Barrier(); + RealD max_rn=0.0; for(int rhs=0;rhsgrid); std::vector Min(nrhs,this->grid); + std::cout << " mrhs PcgM1 Min "<coarsegrid); CoarseField PleftMss_proj(this->coarsegrid); CoarseField PleftProjMrhs(this->coarsegridmrhs); CoarseField PleftMss_projMrhs(this->coarsegridmrhs); + std::cout << " mrhs Coarse ops "<grid->Barrier(); - std::cout << " Calling smoother for "<grid->Barrier(); this->_Smoother(in[rhs],Min[rhs]); - this->grid->Barrier(); - std::cout << " smoother done "<grid->Barrier(); this->_FineLinop.HermOp(Min[rhs],out[rhs]); - this->grid->Barrier(); - std::cout << " Hermop for "<grid->Barrier(); axpy(tmp,-1.0,out[rhs],in[rhs]); // tmp = in - A Min - this->grid->Barrier(); - std::cout << " axpy "<grid->Barrier(); this->_Aggregates.ProjectToSubspace(PleftProj,tmp); // can optimise later - this->grid->Barrier(); - std::cout << " project "<grid->Barrier(); InsertSlice(PleftProj,PleftProjMrhs,rhs,0); - this->grid->Barrier(); - std::cout << " insert rhs "<grid->Barrier(); this->_CoarseGuesser(PleftProj,PleftMss_proj); - this->grid->Barrier(); - std::cout << " insert guess "<grid->Barrier(); InsertSlice(PleftMss_proj,PleftMss_projMrhs,rhs,0); } + MemoryManager::Print(); std::cout << " Coarse solve "<_CoarseSolverMrhs(PleftProjMrhs,PleftMss_projMrhs); // Ass^{-1} [in - A Min]_s + std::cout << " Coarse solve done"<_Aggregates.PromoteFromSubspace(PleftMss_proj,tmp);// tmp = Q[in - A Min] + // std::cout << " add for "<