From b7b164ea249ba01024c6c570b8b00943c05e014f Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Thu, 3 Sep 2020 21:54:20 -0400 Subject: [PATCH] Test operator and deebug code --- Grid/algorithms/CoarsenedMatrix.h | 115 ++++++++++++++++++++++++++---- 1 file changed, 103 insertions(+), 12 deletions(-) diff --git a/Grid/algorithms/CoarsenedMatrix.h b/Grid/algorithms/CoarsenedMatrix.h index 79befbdd..9cffaed0 100644 --- a/Grid/algorithms/CoarsenedMatrix.h +++ b/Grid/algorithms/CoarsenedMatrix.h @@ -102,8 +102,8 @@ public: Aggregation(GridBase *_CoarseGrid,GridBase *_FineGrid,int _checkerboard) : CoarseGrid(_CoarseGrid), FineGrid(_FineGrid), - subspace(nbasis,_FineGrid), - checkerboard(_checkerboard) + checkerboard(_checkerboard), + subspace(nbasis,_FineGrid) { }; @@ -335,7 +335,7 @@ public: } } coalescedWrite(out_v[ss](b),res); - }); + }); for(int p=0;pMdirComms(in); int ndim = in.Grid()->Nd(); @@ -459,10 +459,58 @@ public: geom(CoarseGrid._ndimension), hermitian(hermitian_), Stencil(&CoarseGrid,geom.npoint,Even,geom.directions,geom.displacements,0), - A(geom.npoint,&CoarseGrid) + A(geom.npoint,&CoarseGrid) { }; + void Test(Aggregation &_Aggregates,GridBase *FineGrid,LinearOperatorBase > &linop) + { + typedef Lattice FineField; + CoarseVector Cin(_grid); + CoarseVector Cout(_grid); + CoarseVector CFout(_grid); + + FineField Fin(FineGrid); + FineField Fout(FineGrid); + + + std::vector seeds({1,2,3,4,5}); + GridParallelRNG RNG(_grid); RNG.SeedFixedIntegers(seeds); + gaussian(RNG,Cin); + + _Aggregates.PromoteFromSubspace(Cin,Fin); + _Aggregates.ProjectToSubspace(Cin,Fin); + + std::cout << GridLogMessage<< "************ "<M(Cin,Cout); + std::cout << GridLogMessage<< " Cout "< > &linop, Aggregation & Subspace) { @@ -499,6 +547,8 @@ public: CoarseScalar InnerProd(Grid()); + size_t free,total; + cudaMemGetInfo(&free,&total); std::cout << "ForceHermitian "< bc(FineGrid->_ndimension,0); + blockPick(Grid(),phi,tmp,bc); // Pick out a block + linop.Op(tmp,Mphi); // Apply big dop + blockProject(iProj,Mphi,Subspace.subspace); // project it and print it + std::cout<