-
Notifications
You must be signed in to change notification settings - Fork 35
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
Replace std::pow with integer powers to amrex::Math::powi #1426
Conversation
@psharda @BenWibking do you want to look at the primordial chem changes? |
Is this for debug builds? |
for any build. It was pointed out to us that C++ no longer has an integer power variant of pow(). It looks like that was removed with C++11: |
On x86, gcc optimizes it out anyway: https://godbolt.org/z/z3nvW1vqM. Does this happen for GPU builds? I unfortunately can't parse nvptx to figure out if it's doing this in CUDA. |
Ah, well. It looks like gcc only optimizes For reference, this is also the case for Clang: https://godbolt.org/z/v7Yejv1M8 |
In general, NVIDIA will replace std::pow with the device functions |
It looks like our unit test passes, so I'm fine with this. We do have a lot of negative integer powers - just to be sure, does it handle those correctly? |
yes:
|
With updated network to reflect changes in pynucastro/pynucastro#709.
Added a script and CI to detect cases where we can potentially use powi instead of std::pow for integer powers.