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

Specifying granular masses and tolerances for multishift tests #1401

Closed weinbe2 closed 1 year ago

weinbe2 commented 1 year ago

This very narrow PR adds command line arguments for specifying custom masses, tolerances, and HQ tolerances for each shift in multishift solves for both staggered and Wilson-type solves. The default behavior is to base masses off the mass (with extended shifts adding 0.01 * i * i, as before) and to use tol and tol_hq for all of the shifts, but the flags --multishift-masses, --multishift-tol, and multishift-tols-hq can be used to override this behavior.

Examples below are for staggered; remove the --dslash-type staggered --compute-fat-long true --test 5 to test Wilson-type operators.

4-shift solve with default masses, tols:

./staggered_invert_test --dim 8 8 8 8 --dslash-type staggered --compute-fat-long true --prec double --prec-sloppy single --test 5 --multishift 4

4-shift solve with custom masses, default tols:

./staggered_invert_test --dim 8 8 8 8 --dslash-type staggered --compute-fat-long true --prec double --prec-sloppy single --test 5 --multishift 4 --multishift-masses 0.01 0.02 0.03 0.04

4-shift solve with custom masses and tolerances:

./staggered_invert_test --dim 8 8 8 8 --dslash-type staggered --compute-fat-long true --prec double --prec-sloppy single --test 5 --multishift 4 --multishift-masses 0.01 0.02 0.03 0.04 --multishift-tols 1e-4 1e-5 1e-6 1e-7

If the number of masses, etc, does not agree with the argument to --multishift the tests will intentionally error out.

Outstanding work is minimal:

maddyscientist commented 1 year ago

The term masses isn’t appropriate for Wilson and it would be more appropriate to call these offsets or shifts. Similarly, the scaling that’s been applied in invert_test doesn’t make sense, since we would want ideally to just specify raw numbers from the poles from RHMC.

How about a flag —multishift-offset to specify the raw (unscaled) shifts for Wilson like solvers and for staggered it could work with either the offset or masses option, with the rescaling only being applied when the masses option is specified?

weinbe2 commented 1 year ago

The term masses isn’t appropriate for Wilson and it would be more appropriate to call these offsets or shifts. Similarly, the scaling that’s been applied in invert_test doesn’t make sense, since we would want ideally to just specify raw numbers from the poles from RHMC.

How about a flag —multishift-offset to specify the raw (unscaled) shifts for Wilson like solvers and for staggered it could work with either the offset or masses option, with the rescaling only being applied when the masses option is specified?

I applied your suggestion for Wilson-type fermions. There are too many conventions under the hood for staggered fermions for me to want to "poke the bear" on handling shifts vs masses at this time...