-
Notifications
You must be signed in to change notification settings - Fork 387
Provide a non-invasive fix for the stopwatch issue #3582
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
Provide a non-invasive fix for the stopwatch issue #3582
Conversation
Fix problems and tidy up code
@JanVogelsang Concerning the placement of the and corresponding locations, consider what happens when we add nodes to the network in Here, So the assertion must only be tested when we actually have a threaded timer, i.e., inside the No, strictly speaking, we could argue that timers started/stopped from parallel contexts should always use a timer array. The |
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.
@JanVogelsang Very nice work! I just added one suggestion for a comment.
BTW, I have checked all four detailed/threaded combinations and they work as intended. Very nice that now only the actually active timers show in the kernel dictionary. |
Co-authored-by: Hans Ekkehard Plesser <[email protected]>
I see, so essentially we have two different non-threaded timer types:
|
I would state it the other way around. I would consider timers such as Stopwatch< StopwatchGranularity::Normal,
StopwatchParallelism::MasterOnly > sw_construction_create_; which are explicitly defined as Then we have timers declared as thread-parallel, e.g., Stopwatch< StopwatchGranularity::Normal,
StopwatchParallelism::Threaded > sw_communicate_prepare_; which we coerce to run master-only when |
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.
Thanks for fixing this so quickly. All my tests with the various configuration options were successful.
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.
Thank you for this contribution. 👍
This PR is a simplified version of #3581 which doesn't require C++20.
It simplifies the stopwatch implementation by combining all template specializations into a single one which uses
if constexpr
constructs and some cleverstd::conditional_t
usage to use the correct timer containers and functionality based on compile flags.