Skip to content

Commit

Permalink
Update example with convergence logger
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikvn committed Mar 29, 2021
1 parent 7a0cf23 commit 2b9afa1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ int main(int argc, char *argv[])
.on(exec))
.on(exec);
// Create solver
solver_gen->add_logger(logger);
auto solver = solver_gen->generate(A);


Expand All @@ -148,11 +149,14 @@ int main(int argc, char *argv[])
auto res = gko::initialize<real_vec>({0.0}, exec);
A->apply(lend(one), lend(x), lend(neg_one), lend(b));
b->compute_norm2(lend(res));
auto impl_res = gko::as<real_vec>(logger->get_implicit_sq_resnorm());

std::cout << "Initial residual norm sqrt(r^T r):\n";
write(std::cout, lend(initres));
std::cout << "Final residual norm sqrt(r^T r):\n";
write(std::cout, lend(res));
std::cout << "Implicit residual norm squared (r^2):\n";
write(std::cout, lend(impl_res));

// Print solver statistics
std::cout << "CG iteration count: " << logger->get_num_iterations()
Expand Down
4 changes: 4 additions & 0 deletions examples/adaptiveprecision-blockjacobi/doc/results.dox
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Final residual norm sqrt(r^T r):
%%MatrixMarket matrix array real general
1 1
5.69384e-06
Implicit residual norm squared (r^2):
%%MatrixMarket matrix array real general
1 1
1.27043e-15
CG iteration count: 5
CG execution time [ms]: 0.080041

Expand Down

0 comments on commit 2b9afa1

Please sign in to comment.