Skip to content

Draft: Feature/tweak NekLinSysIter

BOYANG XIA requested to merge xby2233/nektar:feature/TweakNekLinSysIter into master

Issue/feature addressed

Sometimes, we don't need to solve the linear system accurately. Or maybe we just hope to do a fixed number of iterations. This usually happens when one uses an iterative solver as a smoother in multigrid. So this MR makes NekLinSysIter suitable as a smoother and also adds small tweaks to improve the performance.

Proposed solution

  • SolveSystem is general for all including non-iterative solvers. So we need a new public interface other than SolveSystem to return actual iterations and the error at the final step.
  • Let users control whether to produce errors when the system is not converged.
  • Do not waste time checking errors for every iteration, if the intention is not to solve it accurately or just hoping to do a fixed number of iterations. Let users control this behaviour.
  • The presence of map in Dot2() operation introduces branching (if-else), hindering optimizations. If we can check if the map is all one in advance, then we can remove it from Dot().
  • Change the definition of DoNekSysFixPointIte(rhs, x0, x) to DoNekSysFixPointIte(rhs, x, r). Here x holds the initial guess at input and the solution at output. r is the final residual (b-Ax). This design removes unnecessary memory copies.( x -> x0 )

Implementation

See codes and comments

Tests

Suggested reviewers

Please suggest any people who would be appropriate to review your code.

Notes

Please add any other information that could be useful for reviewers.

Checklist

  • Functions and classes, or changes to them, are documented.
  • User guide/documentation is updated.
  • Changelog is updated.
  • Suitable tests added for new functionality.
  • Contributed code is correctly formatted. (See the contributing guidelines).
  • License added to any new files.
  • No extraneous files have been added (e.g. compiler output or test data files).
Edited by BOYANG XIA

Merge request reports

Loading