Skip to content

Commit

Permalink
add stopping criterion norm2 call
Browse files Browse the repository at this point in the history
  • Loading branch information
upsj committed Feb 5, 2021
1 parent faa1a62 commit 19f9867
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
5 changes: 3 additions & 2 deletions core/solver/bicg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,15 @@ void Bicg<ValueType>::apply_impl(const LinOp *b, LinOp *x) const

/* Memory movement summary:
* Per iteration:
* 13.5n * values + matrix/preconditioner storage
* 14n * values + matrix/preconditioner storage
* Two iterations:
* 27n * values + matrix/preconditioner storage + conj storage
* 28n * values + matrix/preconditioner storage + conj storage
* 2x SpMV: 4n * values + storage + conj storage
* 2x Preconditioner: 4n * values + storage + conj storage
* 2x dot 4n
* 1x step 1 (axpys) 6n
* 1x step 2 (axpys) 9n
* 1x norm2 residual n
*/
while (true) {
get_preconditioner()->apply(r.get(), z.get());
Expand Down
5 changes: 3 additions & 2 deletions core/solver/bicgstab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,17 @@ void Bicgstab<ValueType>::apply_impl(const LinOp *b, LinOp *x) const

/* Memory movement summary:
* Per iteration:
* 14.5n * values + matrix/preconditioner storage
* 15.5n * values + matrix/preconditioner storage
* Two iterations:
* 29n * values + 2 * matrix/preconditioner storage
* 31n * values + 2 * matrix/preconditioner storage
* 2x SpMV: 4n * values + 2 * storage
* 2x Preconditioner: 4n * values + 2 * storage
* 3x dot 6n
* 1x norm2 n
* 1x step 1 (fused axpys) 4n
* 1x step 2 (axpy) 3n
* 1x step 3 (fused axpys) 7n
* 2x norm2 residual 2n
*/
while (true) {
++iter;
Expand Down
3 changes: 2 additions & 1 deletion core/solver/cg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@ void Cg<ValueType>::apply_impl(const LinOp *b, LinOp *x) const

int iter = -1;
/* Memory movement summary:
* 17n * values + matrix/preconditioner storage
* 18n * values + matrix/preconditioner storage
* 1x SpMV: 2n * values + storage
* 1x Preconditioner: 2n * values + storage
* 2x dot 4n
* 1x step 1 (axpy) 3n
* 1x step 2 (axpys) 6n
* 1x norm2 residual n
*/
while (true) {
get_preconditioner()->apply(r.get(), z.get());
Expand Down
5 changes: 3 additions & 2 deletions core/solver/cgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,16 @@ void Cgs<ValueType>::apply_impl(const LinOp *b, LinOp *x) const
int iter = 0;
/* Memory movement summary:
* Per iteration:
* 13.5n * values + matrix/preconditioner storage
* 14n * values + matrix/preconditioner storage
* Two iterations:
* 27n * values + 2 * matrix/preconditioner storage
* 28n * values + 2 * matrix/preconditioner storage
* 2x SpMV: 4n * values + 2 * storage
* 2x Preconditioner: 4n * values + 2 * storage
* 2x dot 4n
* 1x step 1 (fused axpys) 5n
* 1x step 2 (fused axpys) 4n
* 1x step 3 (axpys) 6n
* 1x norm2 residual n
*/
while (true) {
r->compute_dot(r_tld.get(), rho.get());
Expand Down
3 changes: 2 additions & 1 deletion core/solver/fcg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,13 @@ void Fcg<ValueType>::apply_impl(const LinOp *b, LinOp *x) const

int iter = -1;
/* Memory movement summary:
* 20n * values + matrix/preconditioner storage
* 21n * values + matrix/preconditioner storage
* 1x SpMV: 2n * values + storage
* 1x Preconditioner: 2n * values + storage
* 3x dot 6n
* 1x step 1 (axpy) 3n
* 1x step 2 (fused axpys) 7n
* 1x norm2 residual n
*/
while (true) {
get_preconditioner()->apply(r.get(), z.get());
Expand Down

0 comments on commit 19f9867

Please sign in to comment.