Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BiCGStab and CG implementations: possible improvements #3587

Closed
wants to merge 24 commits into from

Conversation

eebasso
Copy link
Contributor

@eebasso eebasso commented Oct 6, 2023

Summary

Corrects some possible minor inefficiencies in the implementation of biconjugate gradient stabilized (BiCGStab) and conjugate gradient (CG) methods defined in MLCGSolverT class. The changes have not been tested yet. This should lead to no change in the outcomes, but hopefully will be faster by reducing memory usage and copy operations.

Additional background

See the attached pdf for a more in-depth explanation and comparison of current vs proposed
implementations. BiCGStab and CG algorithm summary.pdf

Checklist

The proposed changes:

  • improves computational efficiency


MF sorig(ba, dm, ncomp, nghost, MFInfo(), factory);
MF p (ba, dm, ncomp, nghost, MFInfo(), factory);
MF r (ba, dm, ncomp, nghost, MFInfo(), factory);
MF s (ba, dm, ncomp, nghost, MFInfo(), factory);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable s can be eliminated by using residual r

@@ -225,7 +215,14 @@ MLCGSolverT<MF>::solve_bicgstab (MF& sol, const MF& rhs, RT eps_rel, RT eps_abs)
{
ret = 4; break;
}
rho_1 = rho;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to save old rho as we only need rhTv to compute beta

@eebasso eebasso changed the title [WIP] BiCGStab and CG implementations: possible improvements BiCGStab and CG implementations: possible improvements Oct 27, 2023
@WeiqunZhang
Copy link
Member

@eebasso A number of regression tests have failed. Some of them were just roundoff errors, but some produced NaNs.

https://ccse.lbl.gov/pub/GpuRegressionTesting/AMReX/2023-11-01-003/index.html
https://ccse.lbl.gov/pub/RegressionTesting1/AMReX/2023-11-01-001/index.html

If it makes sense, baybe you could split this into a few small PRs.

@eebasso
Copy link
Contributor Author

eebasso commented Nov 2, 2023

I think splitting up into multiple PRs is quite reasonable. Shall I update this PR with a smaller change or close it and make a new PR ?

@WeiqunZhang
Copy link
Member

It might be cleaner to start new PRs.

@eebasso eebasso closed this Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants