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

Introduce timers with the @timeit_debug macro #50

Merged
merged 4 commits into from
May 18, 2020
Merged

Conversation

tkoskela
Copy link
Member

I'm tired of maintaining separate branches with timers. I discovered there is a @timeit_debug macro that can be enabled/disabled. I added a parameter that enables the timers and set it to disabled by default. I think we can merge this into master, the only downside I see is it makes the code a bit cluttered.

- Allows enabling/disabling timers
- Disabled by default
@tkoskela tkoskela requested a review from giordano May 18, 2020 13:48
Copy link
Member

@giordano giordano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we want to keep the timers in the long term, but I think that during development it's worth having them directly in the main branch.


tsunami_update!(@view(states.particles[:,ip]), hm, hn, fn, fm, fe, gg, params)
@timeit_debug timer "Particle State Update" begin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't try, but I think you can put @timeit_debug timer "Particle State Update" right before the for loop in the next line? That line becomes a bit long, but at least you don't need a whole new begin-end block here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you can't

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally I'd put the timer on the line inside the loop, but I think there was some issue with threads

@@ -91,6 +91,7 @@ Base.@kwdef struct tdac_params{T<:AbstractFloat}
obs_noise_amplitude::T = 1.0

random_seed::Int = 12345
enable_timers::Bool = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth documenting it or you prefer to keep this field out of casual users' reach?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right, forgot to update the docstring

@giordano giordano changed the title Tk/debug timers Introduce timers with the @timeit_debug macro May 18, 2020
@tkoskela tkoskela merged commit 433d509 into master May 18, 2020
@tkoskela tkoskela deleted the tk/debug-timers branch May 18, 2020 14:15
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

Successfully merging this pull request may close these issues.

2 participants