mirror of
https://github.com/paboyle/Grid.git
synced 2025-05-08 03:25:56 +01: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:
parent
e6cad3821c
commit
841a37f941
@ -56,14 +56,22 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::cout<<GridLogIterative << std::setprecision(4)<< "ConjugateGradient: k=0 residual "<<cp<<" rsq"<<rsq<<std::endl;
|
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;
|
int k;
|
||||||
for (k=1;k<=MaxIterations;k++){
|
for (k=1;k<=MaxIterations;k++){
|
||||||
|
|
||||||
c=cp;
|
c=cp;
|
||||||
|
|
||||||
Linop.HermOpAndNorm(p,mmp,d,qq);
|
|
||||||
|
|
||||||
|
MatrixTimer.Start();
|
||||||
|
Linop.HermOpAndNorm(p,mmp,d,qq);
|
||||||
|
MatrixTimer.Stop();
|
||||||
|
|
||||||
|
LinalgTimer.Start();
|
||||||
RealD qqck = norm2(mmp);
|
RealD qqck = norm2(mmp);
|
||||||
ComplexD dck = innerProduct(p,mmp);
|
ComplexD dck = innerProduct(p,mmp);
|
||||||
|
|
||||||
@ -77,11 +85,13 @@ public:
|
|||||||
psi= a*p+psi;
|
psi= a*p+psi;
|
||||||
p = p*b+r;
|
p = p*b+r;
|
||||||
|
|
||||||
|
LinalgTimer.Stop();
|
||||||
std::cout<<GridLogIterative<<"ConjugateGradient: Iteration " <<k<<" residual "<<cp<< " target"<< rsq<<std::endl;
|
std::cout<<GridLogIterative<<"ConjugateGradient: Iteration " <<k<<" residual "<<cp<< " target"<< rsq<<std::endl;
|
||||||
|
|
||||||
// Stopping condition
|
// Stopping condition
|
||||||
if ( cp <= rsq ) {
|
if ( cp <= rsq ) {
|
||||||
|
|
||||||
|
SolverTimer.Stop();
|
||||||
Linop.HermOpAndNorm(psi,mmp,d,qq);
|
Linop.HermOpAndNorm(psi,mmp,d,qq);
|
||||||
p=mmp-src;
|
p=mmp-src;
|
||||||
|
|
||||||
@ -94,7 +104,9 @@ public:
|
|||||||
std::cout<<GridLogMessage<<"ConjugateGradient: Converged on iteration " <<k
|
std::cout<<GridLogMessage<<"ConjugateGradient: Converged on iteration " <<k
|
||||||
<<" computed residual "<<sqrt(cp/ssq)
|
<<" computed residual "<<sqrt(cp/ssq)
|
||||||
<<" true residual "<<true_residual
|
<<" 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);
|
assert(true_residual/Tolerance < 1000.0);
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ namespace QCD {
|
|||||||
{
|
{
|
||||||
SiteHalfSpinor ret;
|
SiteHalfSpinor ret;
|
||||||
int mudag=mu;
|
int mudag=mu;
|
||||||
if (dag) {
|
if (!dag) {
|
||||||
mudag=(mu+Nd)%(2*Nd);
|
mudag=(mu+Nd)%(2*Nd);
|
||||||
}
|
}
|
||||||
switch(mudag) {
|
switch(mudag) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user