lattice / quda

QUDA is a library for performing calculations in lattice QCD on GPUs.
https://lattice.github.io/quda
Other
287 stars 94 forks source link

Improvements to HQ residual solves in CG #1387

Closed weinbe2 closed 1 year ago

weinbe2 commented 1 year ago

This PR provides an algorithmic solution to convergence issues with HQ residual solves noted in #1376 . In brief, instead of having one unified code path for "regular" L2-norm solves and HQ residual solves, this PR creates separate code path for solves requesting a HQ residual.

This new code path contained in a function hqsolve includes improved logic for tracking reliable updates based on the L2 residual as well as the HQ residual. In the interest of simplicity, this separate code path does not feature all of the optimizations in the traditional CG code. Since HQ solves typically take O(100) iterations, as opposed to thousands to tens of thousands of iterations for light quark solves, this seemed like an acceptable decision. Of note, this new code path still supports mixed precision.

The two key improvements in hqsolve are as follows:

In the case of my own reproducers, the first improvement addresses the issues @detar noted in #1376 . The second improvement leads to a great reduction in the number of iterations required for a HQ solve (much more in line with what is seen in MILC's CPU implementation) with the benefit of retaining mixed precision. This is due to removing the requirement of L2 breakdown before switching to HQ reliable updates.

Outstanding tasks:

weinbe2 commented 1 year ago

Update: @detar is doing a set of thorough correctness checks, thank you!!

weinbe2 commented 1 year ago

@detar confirmed offline that this PR addresses the issues he reported in #1376 , so I've removed the "draft" status of this PR and done some last bits of tidy-up.

@maddyscientist and/or @mathiaswagner can you give this PR a review/test run and let me know what you think? Barring any showstoppers, I'd like to get this in as-is sooner as opposed to later.

weinbe2 commented 1 year ago

Follow-up work is being tracked here: https://github.com/lattice/quda/issues/1389

weinbe2 commented 1 year ago

This passed a ctest -V, so once the latest round of Jenkins passes I'll hit merge