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

Cleaned up isWilson/isStaggered/isDwf/getStencilSteps routines #1488

Merged
merged 14 commits into from
Sep 17, 2024

Conversation

weinbe2
Copy link
Contributor

@weinbe2 weinbe2 commented Aug 30, 2024

This PR addresses issue #1098 and extends it to the getStencilSteps function as well, replacing various functions that look like this:

bool isWilsonType() const
    {
      return (Type() == typeid(DiracWilson).name() || Type() == typeid(DiracWilsonPC).name()
              || Type() == typeid(DiracClover).name() || Type() == typeid(DiracCloverPC).name()
              || Type() == typeid(DiracCloverHasenbuschTwist).name()
              || Type() == typeid(DiracCloverHasenbuschTwistPC).name() || Type() == typeid(DiracTwistedMass).name()
              || Type() == typeid(DiracTwistedMassPC).name() || Type() == typeid(DiracTwistedClover).name()
              || Type() == typeid(DiracTwistedCloverPC).name()) ?
        true :
        false;
    }

And turning them into Dirac abstract functions so each individual class is "forced" to define it so functions like isWilsonType, etc, don't need to be manually updated each time (or, more realistically, don't accidentally get forgotten).

There are some other functions that could this be applied to, hermitian() and hasSpecialMG(), but it seemed reasonable to leave those as false unless proven otherwise.

This PR now replaces those above functions with one-stop shop static Dirac::[...] functions that can query if various QudaDslashType or QudaDiracType enums correspond to Wilson, dwf, or staggered operators. The various Dirac* classes then query these static functions as appropriate. There is scope to apply these functions elsewhere in QUDA.

This PR also fixes a small bug in split grid for staggered vs asqtad type fermions.

@weinbe2 weinbe2 requested a review from a team as a code owner August 30, 2024 15:40
@weinbe2 weinbe2 added the bug label Sep 10, 2024
Copy link
Member

@maddyscientist maddyscientist left a comment

Choose a reason for hiding this comment

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

Aside from trivial comment, which can likely be ignored, this is good to go.

lib/dirac.cpp Outdated Show resolved Hide resolved
@maddyscientist
Copy link
Member

cscs-ci run

@weinbe2 weinbe2 merged commit fcf0262 into develop Sep 17, 2024
14 checks passed
@weinbe2 weinbe2 deleted the feature/is-dirac-type-cleanup branch September 17, 2024 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants