From 13713b2a76dc055ac65d9fb1578d00c0be6ae8fb Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Fri, 5 Apr 2024 01:04:40 -0400 Subject: [PATCH] Much faster little dirac operator calculation --- .../GeneralCoarsenedMatrixMultiRHS.h | 215 +++++++++++++++++- 1 file changed, 210 insertions(+), 5 deletions(-) diff --git a/Grid/algorithms/multigrid/GeneralCoarsenedMatrixMultiRHS.h b/Grid/algorithms/multigrid/GeneralCoarsenedMatrixMultiRHS.h index 5737ffd7..30bb7029 100644 --- a/Grid/algorithms/multigrid/GeneralCoarsenedMatrixMultiRHS.h +++ b/Grid/algorithms/multigrid/GeneralCoarsenedMatrixMultiRHS.h @@ -285,6 +285,7 @@ public: Aggregation & Subspace, GridBase *CoarseGrid) { +#if 0 std::cout << GridLogMessage<< "GeneralCoarsenMatrixMrhs "<< std::endl; GridBase *grid = Subspace.FineGrid; @@ -362,7 +363,7 @@ public: blockZAXPY(phaF[p],pha[p],one,zz); } - // Could save on storage here + // Could save on temporary storage here std::vector _A; _A.resize(geom_srhs.npoint,CoarseGrid); @@ -390,6 +391,7 @@ public: // Could do this with a block promote or similar BLAS call via the MultiRHSBlockProjector with a const matrix. for(int k=0;k > Projector; + Projector.Allocate(nbasis,grid,CoarseGrid); + Projector.ImportBasis(Subspace.subspace); + + const int npoint = geom_srhs.npoint; + + Coordinate clatt = CoarseGrid->GlobalDimensions(); + int Nd = CoarseGrid->Nd(); + /* + * Here, k,l index which possible momentum/shift within the N-points connected by MdagM. + * Matrix index i is mapped to this shift via + * geom.shifts[i] + * + * conj(pha[block]) proj[k (which mom)][j (basis vec cpt)][block] + * = \sum_{l in ball} e^{i q_k . delta_l} < phi_{block,j} | MdagM | phi_{(block+delta_l),i} > + * = \sum_{l in ball} e^{iqk.delta_l} A_ji^{b.b+l} + * = M_{kl} A_ji^{b.b+l} + * + * Must assemble and invert matrix M_k,l = e^[i q_k . delta_l] + * + * Where q_k = delta_k . (2*M_PI/global_nb[mu]) + * + * Then A{ji}^{b,b+l} = M^{-1}_{lm} ComputeProj_{m,b,i,j} + */ + Eigen::MatrixXcd Mkl = Eigen::MatrixXcd::Zero(npoint,npoint); + Eigen::MatrixXcd invMkl = Eigen::MatrixXcd::Zero(npoint,npoint); + ComplexD ci(0.0,1.0); + for(int k=0;k phaF(npoint,grid); + std::vector pha(npoint,CoarseGrid); + + CoarseVector coarseInner(CoarseGrid); + + tphase=-usecond(); + typedef typename CComplex::scalar_type SComplex; + FineComplexField one(grid); one=SComplex(1.0); + FineComplexField zz(grid); zz = Zero(); + for(int p=0;p _A; + _A.resize(geom_srhs.npoint,CoarseGrid); + + // Count use small chunks than npoint == 81 and save memory + std::vector _MphaV; + _MphaV.resize(npoint,grid); + + std::vector ComputeProj(npoint,CoarseGrid); + CoarseVector FT(CoarseGrid); + for(int i=0;ioSites(); + autoView( A_v , _A[k], AcceleratorWrite); + autoView( FT_v , FT, AcceleratorRead); + accelerator_for(sss, osites, 1, { + for(int j=0;j