1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Fix to WilsonCompressor that fixes a bug in comms phase due to the sign change on gamma

matrix in hopping term.
Add logging of time spent in CG.
This commit is contained in:
paboyle 2015-12-29 23:49:41 +00:00
parent e6cad3821c
commit 841a37f941
2 changed files with 17 additions and 5 deletions

View File

@ -56,14 +56,22 @@ public:
}
std::cout<<GridLogIterative << std::setprecision(4)<< "ConjugateGradient: k=0 residual "<<cp<<" rsq"<<rsq<<std::endl;
GridStopWatch LinalgTimer;
GridStopWatch MatrixTimer;
GridStopWatch SolverTimer;
SolverTimer.Start();
int k;
for (k=1;k<=MaxIterations;k++){
c=cp;
Linop.HermOpAndNorm(p,mmp,d,qq);
MatrixTimer.Start();
Linop.HermOpAndNorm(p,mmp,d,qq);
MatrixTimer.Stop();
LinalgTimer.Start();
RealD qqck = norm2(mmp);
ComplexD dck = innerProduct(p,mmp);
@ -77,11 +85,13 @@ public:
psi= a*p+psi;
p = p*b+r;
LinalgTimer.Stop();
std::cout<<GridLogIterative<<"ConjugateGradient: Iteration " <<k<<" residual "<<cp<< " target"<< rsq<<std::endl;
// Stopping condition
if ( cp <= rsq ) {
SolverTimer.Stop();
Linop.HermOpAndNorm(psi,mmp,d,qq);
p=mmp-src;
@ -94,7 +104,9 @@ public:
std::cout<<GridLogMessage<<"ConjugateGradient: Converged on iteration " <<k
<<" computed residual "<<sqrt(cp/ssq)
<<" true residual "<<true_residual
<<" target "<<Tolerance<<std::endl;
<<" target "<<Tolerance;
std::cout<<" Time elapsed: Total "<< SolverTimer.Elapsed() << " Matrix "<<MatrixTimer.Elapsed() << " Linalg "<<LinalgTimer.Elapsed();
std::cout<<std::endl;
assert(true_residual/Tolerance < 1000.0);

View File

@ -27,7 +27,7 @@ namespace QCD {
{
SiteHalfSpinor ret;
int mudag=mu;
if (dag) {
if (!dag) {
mudag=(mu+Nd)%(2*Nd);
}
switch(mudag) {