Skip to content

Commit

Permalink
Relaxed the convergence and tolerance failure checks to allow differe…
Browse files Browse the repository at this point in the history
…nces beyond first six meaningful digits
  • Loading branch information
kvoronin-intel authored and luszczek committed Feb 17, 2022
1 parent e649826 commit b1f1702
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/CG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ int CG(const SparseMatrix & A, CGData & data, const Vector & b, Vector & x,
normr0 = normr;

// Start iterations

for (int k=1; k<=max_iter && normr/normr0 > tolerance; k++ ) {
// Convergence check has a "safety" factor of 1.0e-6
for (int k=1; k<=max_iter && normr/normr0 > tolerance * (1.0 + 1.0e-6); k++ ) {
TICK();
if (doPreconditioning)
ComputeMG(A, r, z); // Apply preconditioner
Expand Down
3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ int main(int argc, char * argv[]) {
totalNiters_ref += niters;
}
if (rank == 0 && err_count) HPCG_fout << err_count << " error(s) in call(s) to reference CG." << endl;
double normr_ref = normr;
double refTolerance = normr / normr0;

// Call user-tunable set up function.
Expand Down Expand Up @@ -283,7 +284,7 @@ int main(int argc, char * argv[]) {
double last_cummulative_time = opt_times[0];
ierr = CG( A, data, b, x, optMaxIters, refTolerance, niters, normr, normr0, &opt_times[0], true);
if (ierr) ++err_count; // count the number of errors in CG
if (normr / normr0 > refTolerance) ++tolerance_failures; // the number of failures to reduce residual
if (1e6 * (normr - normr_ref > normr0)) ++tolerance_failures; // the number of failures to reduce residual

// pick the largest number of iterations to guarantee convergence
if (niters > optNiters) optNiters = niters;
Expand Down

0 comments on commit b1f1702

Please sign in to comment.