-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add time values as sampler stats for NUTS #3986
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
Conversation
AlexAndorra
left a comment
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.
Neat, thanks @aseyboldt ! Left some comments below
|
I forgot to check when the time functions were added to the stdlib. The nanosecond versions are new in 3.7. We still want to support 3.6 for some time? |
AlexAndorra
left a comment
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.
Just a couple questions below before approving
| "perf_counter_diff_ns": perf_end - perf_start, | ||
| "process_time_diff_ns": process_end - process_start, | ||
| "perf_counter_ns": perf_end, | ||
| "perf_counter_diff": perf_end - perf_start, |
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.
Just a suggestion: why not call this perf_time_diff? I find it more explicit and it matches process_time_diff
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.
I see why perf_time_diff might be nicer, I just followed the naming of the function in time, so that it's easier to see what clock is used exactly. But counter is a bit confusing...
| "perf_counter_ns": perf_end, | ||
| "perf_counter_diff": perf_end - perf_start, | ||
| "process_time_diff": process_end - process_start, | ||
| "perf_counter_start": perf_start, |
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.
Same comment on the name, and out of curiosity: why did switch from perf_end to perf_start?
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.
Again, I think the choice it kind of arbitrary. We can reconstruct the other one since we have the difference.
I just thought it might be a bit more intuitive to have the start of the draw as an absolute value.
|
Is it something we should considered push to top level api so that it is available for all step_methods? FWIW, I think it is fine for it to be a HMC only method, and change later if there are feature request - just want to bring up this point. |
|
Also needs note in release notes. |
|
@junpenglao That would be useful, but we don't have a way to easily add sampler stats to all samplers at once, since they have to be declared in the step method itself. If users implement their own step methods (does anyone?) that would be a breaking change. At least unless we change some code in the trace backends to allow for missing or undeclared stats. @twiecki done |
AlexAndorra
left a comment
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.
Sorry, just one last nitpick 😜
|
I'm also fine with dropping Python 3.6, I know it's just a small thing here with an easy work-around but I think being progressive here is a good thing. |
|
Good news about 1 week ago, then (via https://numpy.org/neps/nep-0029-deprecation_policy.html):
|
|
@aseyboldt I see. +1 to dropping py3.6 |
|
Great, let's drop it then!
…On Wed, Jul 1, 2020 at 4:34 PM Junpeng Lao ***@***.***> wrote:
@aseyboldt <https://github.com/aseyboldt> I see.
+1 to dropping py3.6
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3986 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFETGAYNIAJT64T6MCRK2TRZNCPDANCNFSM4ONFUG3Q>
.
|
Co-authored-by: Alexandre ANDORRA <[email protected]>
|
Dropping 3.6 is fine, but maybe the float version is better after all. :-) |
AlexAndorra
left a comment
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.
All good now, thanks @aseyboldt ! I agree with you on the seconds vs. nanoseconds stuff
Problem is fixed now and this is blocking merge
This PR adds three more sampler stats for NUTS and HMC: "process_time_diff_ns" and "perf_counter_diff_ns" and "perf_counter_ns".
During debugging it can be useful to see how long it took to compute each sample, and for issues involving blas/openmp it can also be useful to see the difference between process time and wall time.
The names are taken from the python time module: https://docs.python.org/3/library/time.html#time.perf_counter
This can be used like this: