Skip to content

Add an api to clear counter and metrics - #4109

Merged
JackCaoG merged 2 commits into
masterfrom
clear_counters_and__metrics
Oct 21, 2022
Merged

JackCaoG merged 2 commits into
masterfrom
clear_counters_and__metrics

Conversation

@JackCaoG

Copy link
Copy Markdown
Collaborator

Upstream version at https://github.com/pytorch/pytorch/blob/d9ff56ccc03cd5c2f95112ef3ec2316557f5699c/torch/csrc/lazy/core/metrics.h#L92 actually reset the counter instead of clearing it.

However I found it is more intuitive to clear the counters and there is no way to resert metrics(metrics can not be empty). I think I will submit a pr to update upstream later.

@JackCaoG
JackCaoG requested a review from alanwaketan October 20, 2022 02:51
@JackCaoG JackCaoG changed the title Add a api to clear counter and metrics Oct 20, 2022

@alanwaketan alanwaketan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM.

@JackCaoG

Copy link
Copy Markdown
Collaborator Author

I think I will have better luck to put this test in a separate file. It is a bad idea to clear all metrics for the test_operations.py

@JackCaoG
JackCaoG merged commit f0020b4 into master Oct 21, 2022
alanwaketan added a commit to pytorch/pytorch that referenced this pull request Nov 23, 2022
Summary:
This change allow MetricsArena to ResetMetrics too. And then rename
Reset to ResetCounters given that's what it does for real.

This matches pytorch/xla#4109.

Test Plan:
CI.
alanwaketan added a commit to pytorch/pytorch that referenced this pull request Nov 24, 2022
Summary:
This change allow MetricsArena to ResetMetrics too. And then rename
Reset to ResetCounters given that's what it does for real.

This matches pytorch/xla#4109.

Test Plan:
CI.
alanwaketan added a commit to pytorch/pytorch that referenced this pull request Nov 24, 2022
Summary:
This change allow MetricsArena to ResetMetrics too. And then rename
Reset to ResetCounters given that's what it does for real.

This matches pytorch/xla#4109.

Test Plan:
CI.
alanwaketan added a commit to pytorch/pytorch that referenced this pull request Nov 28, 2022
Summary:
This change allow MetricsArena to ResetMetrics too. And then rename
Reset to ResetCounters given that's what it does for real.

This matches pytorch/xla#4109.

Test Plan:
CI.
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Nov 28, 2022
Summary:
This change allow MetricsArena to ResetMetrics too. And then rename Reset to ResetCounters given that's what it does for real.

This matches pytorch/xla#4109, and is paired with pytorch/xla#4245.

Test Plan:
CI.

Pull Request resolved: #89606
Approved by: https://github.com/JackCaoG
kulinseth pushed a commit to kulinseth/pytorch that referenced this pull request Dec 10, 2022
Summary:
This change allow MetricsArena to ResetMetrics too. And then rename Reset to ResetCounters given that's what it does for real.

This matches pytorch/xla#4109, and is paired with pytorch/xla#4245.

Test Plan:
CI.

Pull Request resolved: pytorch#89606
Approved by: https://github.com/JackCaoG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants