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

Add a timer util that adapts to a torch.device. #399

Merged
merged 2 commits into from
Dec 13, 2022
Merged

Conversation

luisenp
Copy link
Contributor

@luisenp luisenp commented Dec 8, 2022

Removes boilerplate. Can be used as

from thesus.utils import Timer

with Timer("cuda:0") as timer:
   some_stuff
print(timer.elapsed_time)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 8, 2022
Copy link
Contributor

@fantaosha fantaosha left a comment

Choose a reason for hiding this comment

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

LGTM!

@luisenp luisenp merged commit 963178d into main Dec 13, 2022
@luisenp luisenp deleted the lep.timer_util branch December 13, 2022 14:17
@mhmukadam
Copy link
Member

mhmukadam commented Jan 2, 2023

Nice, might want to add the usage as comments above the class code. LGTM!

@luisenp
Copy link
Contributor Author

luisenp commented Jan 12, 2023

from thesus.utils import Timer

with Timer("cuda:0") as timer:
   some_stuff
print(timer.elapsed_time)

Added in 556d6ba

suddhu pushed a commit to suddhu/theseus that referenced this pull request Jan 21, 2023
* Add a timer util that adapts to a torch.device.

* Fix Timer so it returns self on enter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants