lattice / quda

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

Clean up hard-coded loop bounds #1461

Open dmcdougall opened 5 months ago

dmcdougall commented 5 months ago

Opening a ticket for dicussion/todo item.

The character of bugs such as the one fixed by #1459 can easily be avoided by not duplicating hard-coded constants. If QUDA is willing to chew a C++17 requirement, I think one can use std::size to retrieve the size of the input array arguments, store it in a variable, and re-use the variable.

maddyscientist commented 5 months ago

We already have a C++17 requirement, so that's not a problem. Absolutely we should be removing hard-coded constants, though in general I think these quantities should be derived from parameters, rather than queried from size(). E.g., in #1459, the quantity 9 comes from nColor * nColor where nColor = 3.

Anyway, leaving this issue open, and we can close this when we eventually get around to this....