mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Mrhs prep
This commit is contained in:
parent
9f40467e24
commit
cd15abe9d1
@ -26,11 +26,6 @@ Author: Peter Boyle <pboyle@bnl.gov>
|
|||||||
*************************************************************************************/
|
*************************************************************************************/
|
||||||
/* END LEGAL */
|
/* END LEGAL */
|
||||||
#include <Grid/Grid.h>
|
#include <Grid/Grid.h>
|
||||||
#include <Grid/lattice/PaddedCell.h>
|
|
||||||
#include <Grid/stencil/GeneralLocalStencil.h>
|
|
||||||
//#include <Grid/algorithms/GeneralCoarsenedMatrix.h>
|
|
||||||
#include <Grid/algorithms/iterative/AdefGeneric.h>
|
|
||||||
#include <Grid/algorithms/iterative/BlockConjugateGradient.h>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Grid;
|
using namespace Grid;
|
||||||
@ -486,6 +481,8 @@ slurm-1482367.out:Grid : Message : 6169.469330 s : HDCG: Pcg converged in 487 it
|
|||||||
|
|
||||||
DeflatedGuesser<CoarseVector> DeflCoarseGuesser(evec,eval);
|
DeflatedGuesser<CoarseVector> DeflCoarseGuesser(evec,eval);
|
||||||
|
|
||||||
|
MultiRHSDeflation<CoarseVector> MrhsGuesser;
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
// Build a coarse space solver
|
// Build a coarse space solver
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
@ -609,7 +606,7 @@ slurm-1482367.out:Grid : Message : 6169.469330 s : HDCG: Pcg converged in 487 it
|
|||||||
typedef HermitianLinearOperator<MultiGeneralCoarsenedMatrix_t,CoarseVector> MrhsHermMatrix;
|
typedef HermitianLinearOperator<MultiGeneralCoarsenedMatrix_t,CoarseVector> MrhsHermMatrix;
|
||||||
MrhsHermMatrix MrhsCoarseOp (mrhs);
|
MrhsHermMatrix MrhsCoarseOp (mrhs);
|
||||||
MemoryManager::Print();
|
MemoryManager::Print();
|
||||||
#if 0
|
#if 1
|
||||||
{
|
{
|
||||||
CoarseVector rh_res(CoarseMrhs);
|
CoarseVector rh_res(CoarseMrhs);
|
||||||
CoarseVector rh_guess(CoarseMrhs);
|
CoarseVector rh_guess(CoarseMrhs);
|
||||||
@ -617,19 +614,39 @@ slurm-1482367.out:Grid : Message : 6169.469330 s : HDCG: Pcg converged in 487 it
|
|||||||
|
|
||||||
rh_res= Zero();
|
rh_res= Zero();
|
||||||
rh_guess= Zero();
|
rh_guess= Zero();
|
||||||
|
|
||||||
|
std::cout << "*************************"<<std::endl;
|
||||||
|
std::cout << " MrhsGuesser importing"<<std::endl;
|
||||||
|
std::cout << "*************************"<<std::endl;
|
||||||
|
MrhsGuesser.ImportEigenBasis(evec,eval);
|
||||||
|
std::vector<CoarseVector> BlasGuess(nrhs,Coarse5d);
|
||||||
|
std::vector<CoarseVector> BlasSource(nrhs,Coarse5d);
|
||||||
for(int r=0;r<nrhs;r++){
|
for(int r=0;r<nrhs;r++){
|
||||||
random(CRNG,c_src);
|
random(CRNG,BlasSource[r]);
|
||||||
|
}
|
||||||
|
|
||||||
|
MrhsGuesser.DeflateSources(BlasSource,BlasGuess);
|
||||||
|
|
||||||
|
for(int r=0;r<nrhs;r++){
|
||||||
|
std::cout << "*************************"<<std::endl;
|
||||||
|
std::cout << "**** DeflCoarseGuesser &&&&& "<<std::endl;
|
||||||
|
std::cout << "*************************"<<std::endl;
|
||||||
|
c_src=BlasSource[r];
|
||||||
DeflCoarseGuesser(c_src,c_res);
|
DeflCoarseGuesser(c_src,c_res);
|
||||||
|
std::cout << "Deflated guess "<< norm2(c_res)<<std::endl;
|
||||||
|
std::cout << "Blas deflated guess "<< norm2(BlasGuess[r])<<std::endl;
|
||||||
|
std::cout << "*************************"<<std::endl;
|
||||||
|
BlasGuess[r] = BlasGuess[r] - c_res;
|
||||||
|
std::cout << "Diff " <<norm2(BlasGuess[r])<<std::endl;
|
||||||
|
std::cout << "*************************"<<std::endl;
|
||||||
InsertSlice(c_res,rh_res,r,0);
|
InsertSlice(c_res,rh_res,r,0);
|
||||||
InsertSlice(c_res,rh_guess,r,0);
|
InsertSlice(c_res,rh_guess,r,0);
|
||||||
InsertSlice(c_src,rh_src,r,0);
|
InsertSlice(c_src,rh_src,r,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryManager::Print();
|
|
||||||
coarseCG(MrhsCoarseOp,rh_src,rh_res);
|
coarseCG(MrhsCoarseOp,rh_src,rh_res);
|
||||||
MemoryManager::Print();
|
|
||||||
//redo with block CG
|
//redo with block CG ?
|
||||||
|
|
||||||
for(int r=0;r<nrhs;r++){
|
for(int r=0;r<nrhs;r++){
|
||||||
std::cout << " compare to single RHS "<<r<<"/"<<nrhs<<std::endl;
|
std::cout << " compare to single RHS "<<r<<"/"<<nrhs<<std::endl;
|
||||||
ExtractSlice(c_src,rh_src,r,0);
|
ExtractSlice(c_src,rh_src,r,0);
|
||||||
@ -645,7 +662,7 @@ slurm-1482367.out:Grid : Message : 6169.469330 s : HDCG: Pcg converged in 487 it
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
MemoryManager::Print();
|
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
// fine solve
|
// fine solve
|
||||||
//////////////////////////////////////
|
//////////////////////////////////////
|
||||||
@ -653,12 +670,23 @@ slurm-1482367.out:Grid : Message : 6169.469330 s : HDCG: Pcg converged in 487 it
|
|||||||
|
|
||||||
// std::vector<RealD> los({2.0,2.5}); // Nbasis 40 == 36,36 iters
|
// std::vector<RealD> los({2.0,2.5}); // Nbasis 40 == 36,36 iters
|
||||||
// std::vector<RealD> los({2.0});
|
// std::vector<RealD> los({2.0});
|
||||||
std::vector<RealD> los({2.5});
|
// std::vector<RealD> los({2.5});
|
||||||
|
|
||||||
// std::vector<int> ords({7,8,10}); // Nbasis 40 == 40,38,36 iters (320,342,396 mults)
|
// std::vector<int> ords({7,8,10}); // Nbasis 40 == 40,38,36 iters (320,342,396 mults)
|
||||||
// std::vector<int> ords({7}); // Nbasis 40 == 40 iters (320 mults)
|
// std::vector<int> ords({7}); // Nbasis 40 == 40 iters (320 mults)
|
||||||
// std::vector<int> ords({9}); // Nbasis 40 == 40 iters (320 mults)
|
// std::vector<int> ords({9}); // Nbasis 40 == 40 iters (320 mults)
|
||||||
std::vector<int> ords({9});
|
|
||||||
|
// 148 outer
|
||||||
|
// std::vector<RealD> los({1.0});
|
||||||
|
// std::vector<int> ords({24});
|
||||||
|
|
||||||
|
// 162 outer
|
||||||
|
// std::vector<RealD> los({2.5});
|
||||||
|
// std::vector<int> ords({9});
|
||||||
|
|
||||||
|
// ??? outer
|
||||||
|
std::vector<RealD> los({2.0});
|
||||||
|
std::vector<int> ords({7});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Smoother opt @56 nbasis, 0.04 convergence, 192 evs
|
Smoother opt @56 nbasis, 0.04 convergence, 192 evs
|
||||||
@ -778,14 +806,16 @@ Conclusion: higher order smoother is doing better. Much better. Use a Krylov smo
|
|||||||
#if 1
|
#if 1
|
||||||
MemoryManager::Print();
|
MemoryManager::Print();
|
||||||
DoNothingGuesser<CoarseVector> DoNothing;
|
DoNothingGuesser<CoarseVector> DoNothing;
|
||||||
HPDSolver<CoarseVector> HPDSolveMrhs(MrhsCoarseOp,coarseCG,DoNothing);
|
HPDSolver<CoarseVector> HPDSolveMrhs(MrhsCoarseOp,CG,DoNothing);
|
||||||
|
HPDSolver<CoarseVector> HPDSolveMrhsSloppy(MrhsCoarseOp,CGsloppy,DoNothing);
|
||||||
TwoLevelADEF2mrhs<LatticeFermion,CoarseVector,Subspace>
|
TwoLevelADEF2mrhs<LatticeFermion,CoarseVector,Subspace>
|
||||||
HDCGmrhs(1.0e-8, 500,
|
HDCGmrhs(1.0e-8, 500,
|
||||||
FineHermOp,
|
FineHermOp,
|
||||||
CGsmooth,
|
CGsmooth,
|
||||||
HPDSolveSloppy, // Never used
|
// HPDSolveSloppy, // Never used
|
||||||
HPDSolve, // Used in Vstart
|
// HPDSolve, // Used in Vstart
|
||||||
HPDSolveMrhs, // Used in M1
|
HPDSolveMrhsSloppy, // Used in M1
|
||||||
|
HPDSolveMrhs, // Used in Vstart
|
||||||
DeflCoarseGuesser, // single RHS guess used in M1
|
DeflCoarseGuesser, // single RHS guess used in M1
|
||||||
CoarseMrhs, // Grid needed to Mrhs grid
|
CoarseMrhs, // Grid needed to Mrhs grid
|
||||||
Aggregates);
|
Aggregates);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user