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 6 commits 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
@MrAnayDongre MrAnayDongre force-pushed the docs/fix-20807-device-stats-metrics branch 5 times, most recently from 798f9c9 to 2461f52 Compare June 17, 2025 03:42
@MrAnayDongre MrAnayDongre force-pushed the docs/fix-20807-device-stats-metrics branch from 1afe3a5 to c707a02 Compare June 26, 2025 02:11
@MrAnayDongre MrAnayDongre force-pushed the docs/fix-20807-device-stats-metrics branch from 271e5d7 to fd323ed Compare June 26, 2025 02:23
Copy link

stale bot commented Jul 19, 2025

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need further help see our docs: https://lightning.ai/docs/pytorch/latest/generated/CONTRIBUTING.html#pull-request or ask the assistance of a core contributor here or on Discord. Thank you for your contributions.

@stale stale bot added the won't fix This will not be worked on label Jul 19, 2025
@stale stale bot removed the won't fix This will not be worked on label Aug 8, 2025

The actual metrics depend on the active accelerator and the ``cpu_stats`` flag.

**CPU (via `psutil`)**
Copy link
Member

Choose a reason for hiding this comment

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

** really does not well represent the hierarchy in the headers, so let's rather use a nested lists

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