Skip to content

DOC: Clarify DeviceStatsMonitor logged metrics #20895

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MrAnayDongre
Copy link

@MrAnayDongre MrAnayDongre commented Jun 11, 2025

What does this PR do?

This PR addresses issue #20807 by adding detailed documentation for the metrics logged by DeviceStatsMonitor.

The key clarifications include:

  • The source of metrics (CPU via psutil, CUDA GPU via torch.cuda.memory_stats, and other accelerators via accelerator.get_device_stats()).
  • The naming convention for logged keys: DeviceStatsMonitor.{hook_name}/{base_metric_name}.
  • Explicitly states that GPU compute utilization is not logged by default for CUDA devices, with a pointer to torch.cuda.memory_stats() for the full list of memory metrics.
  • Provides examples for common CPU, CUDA, and other accelerator (TPU, MPS) metrics.
  • Includes a minor update to profiler_basic.rst to align with these clarifications and link to the API docs.

This documentation aims to help users understand what statistics to expect when using DeviceStatsMonitor with different hardware configurations.

Fixes #20807

No breaking changes are introduced by this documentation update.

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:

Reviewer checklist
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

📚 Documentation preview 📚: https://pytorch-lightning--20895.org.readthedocs.build/en/20895/

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Jun 11, 2025
@Borda Borda changed the title DOC: Clarify DeviceStatsMonitor logged metrics (#20807) DOC: Clarify DeviceStatsMonitor logged metrics Jun 12, 2025
@@ -45,6 +45,23 @@ class DeviceStatsMonitor(Callback):
ModuleNotFoundError:
If ``psutil`` is not installed and CPU stats are monitored.

Logged Metrics:
Copy link
Member

Choose a reason for hiding this comment

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

Raises: or Args: are Sphinx-specific keywords compared to Logged Metrics:, so pls let's move it just to the top of this docstring

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, @Borda! I've moved the 'Logged Metrics' section to the top of the docstring as requested in commit dcd1042.

Copy link
Member

Choose a reason for hiding this comment

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

well, I still see it without change

@MrAnayDongre MrAnayDongre force-pushed the docs/fix-20807-device-stats-metrics branch from 6f17537 to dcd1042 Compare June 12, 2025 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pl Generic label for PyTorch Lightning package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DeviceStatsMonitor lacks documentation
2 participants