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

Release mode doesn't run std::isfinite, isnan, isinf etc. #1555

Open
danieldeidda opened this issue Dec 18, 2024 · 1 comment
Open

Release mode doesn't run std::isfinite, isnan, isinf etc. #1555

danieldeidda opened this issue Dec 18, 2024 · 1 comment
Assignees

Comments

@danieldeidda
Copy link
Collaborator

When installing STIR in release mode the cxx tag uses fast math however this does not allow to use some std functions like isfininit, isnan, isinf etc.
when installing with and withouth fast math math the stir_timing outputs are as follow:

Image

so mostly fast math does make thing slightly faster but not sure that it would make any significant difference in a reconstruction

@KrisThielemans
Copy link
Collaborator

Some more info on support is at https://en.cppreference.com/w/cpp/numeric/math/isnan

GCC and Clang support a -ffinite-math option (additionally implied by -ffast-math), which allows the respective compiler to assume the nonexistence of special IEEE-754 floating point values such as NaN, infinity, or negative zero. In other words, std::isnan is assumed to always return false under this option.

Suggestion is to

  • add a CMake variable ENABLE_FASTMATH defaulting to ON, which creates a preprocessor variable (via STIRConfig.h.in) STIR_WITH_fastmath
  • any utility/function that uses std::isfinite etc should throw an error #ifdef STIR_WITH_fastmath

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants