-
Notifications
You must be signed in to change notification settings - Fork 50
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
Issue warnings for non-Release builds #701
base: main
Are you sure you want to change the base?
Issue warnings for non-Release builds #701
Conversation
a838186
to
16b9b57
Compare
So, you pretty much add this printout to every single executable as I can see it. 🤔 Would it not be easier to just print a warning when What I'm thinking of is a file called int checkOptimization() {
#if ...
std::cerr << ...;
#endif
}
static const int dummy = checkOptimization(); It's a bit of a hack, but I've sort of enjoyed how RooFit has been printing a greeting message to its users with the same "trick" since forever. 🤔 |
No, putting this straight into core is not a good idea; this is really just for the examples executables. Also, I would prefer this message to be at the same place as the performance results. Otherwise they will simply be overlooked. |
16b9b57
to
fd34bb2
Compare
Updated to affect only the throughput examples. |
fd34bb2
to
98989e9
Compare
A common pitfall when using traccc seems to be that people build it in non-Release mode and then get poor performance. This commit adds a bunch of warning prints to make sure that the code will inform you if you try to run it in non-Release mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shoot, wanted to make all comments part of the review...
You sure want users to notice these messages. 😆 3 printouts per job. 😮 (I'm on board though.)
@@ -0,0 +1,27 @@ | |||
/** TRACCC library, part of the ACTS project (R&D line) | |||
* | |||
* (c) 2022 CERN for the benefit of the ACTS project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* (c) 2022 CERN for the benefit of the ACTS project | |
* (c) 2024 CERN for the benefit of the ACTS project |
#if !defined(TRACCC_BUILD_TYPE_IS_RELEASE) || !defined(NDEBUG) || \ | ||
defined(_DEBUG) | ||
#define TRACCC_OPTIMIZATION_WARNING() \ | ||
do { \ | ||
std::cout \ | ||
<< "WARNING: traccc was built without Release mode, without the " \ | ||
"`NDEBUG` flag, or (on MSVC) with the `_DEBUG` flag. " \ | ||
"Performance is guaranteed to be much lower and compute " \ | ||
"performance results should be considered unreliable!" \ | ||
<< std::endl; \ | ||
} while (false) | ||
#else | ||
#define TRACCC_OPTIMIZATION_WARNING() \ | ||
do { \ | ||
} while (false) | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming back to this... Why a macro at this point? A void optimization_warning()
function would seem perfectly adequate here. The extra function call is not really an issue, it's all happening during the initialization of the throughput applications. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I have no idea what the GitHub UI is doing now... 😕
Ping! It would be nice to put this in after some further changes. |
A common pitfall when using traccc seems to be that people build it in non-Release mode and then get poor performance. This commit adds a bunch of warning prints to make sure that the code will inform you if you try to run it in non-Release mode.