Skip to content

Add device_name classmethod in Accelerator.#21112

Open
GdoongMathew wants to merge 38 commits intoLightning-AI:masterfrom
GdoongMathew:feat/device_name
Open

Add device_name classmethod in Accelerator.#21112
GdoongMathew wants to merge 38 commits intoLightning-AI:masterfrom
GdoongMathew:feat/device_name

Conversation

@GdoongMathew
Copy link
Copy Markdown
Contributor

@GdoongMathew GdoongMathew commented Aug 24, 2025

What does this PR do?

Fixes #17355

  • 1 GPU
GPU available: NVIDIA GeForce RTX 3050 4GB Laptop GPU, using: 1 devices.
TPU available: False, using: 0 TPU cores
HPU available: False, using: 0 HPUs
  • 2 GPUs (Kaggle)
>>> t = Trainer(devices=2)
INFO: GPU available: Tesla T4, using: 2 devices.
INFO: TPU available: False, using: 0 TPU cores
INFO: HPU available: False, using: 0 HPUs
  • No cuda GPU available
GPU available: False, using: 0 devices.
TPU available: False, using: 0 TPU cores
HPU available: False, using: 0 HPUs
  • MPS
GPU available: Apple M1 Pro, using: 1 devices.
TPU available: False, using: 0 TPU cores
HPU available: False, using: 0 HPUs
  • XLA (Kaggle)
GPU available: False, using: 0 devices.
TPU available: v3-8, using: 8 TPU cores
HPU available: False, using: 0 HPUs
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--21112.org.readthedocs.build/en/21112/

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Aug 24, 2025
@GdoongMathew GdoongMathew changed the title [WIP] Add device_name classmethod in Accelerator. Add device_name classmethod in Accelerator. Aug 26, 2025
@GdoongMathew

This comment was marked as off-topic.

@GdoongMathew
Copy link
Copy Markdown
Contributor Author

GdoongMathew commented Aug 27, 2025

Copy link
Copy Markdown
Member

@justusschock justusschock left a comment

Choose a reason for hiding this comment

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

How would you handle heterogeneous gpu types? E.g. say I have one 3090 and one 4090 in my workstation. This doesn't handle it at all.

@GdoongMathew
Copy link
Copy Markdown
Contributor Author

How would you handle heterogeneous gpu types? E.g. say I have one 3090 and one 4090 in my workstation. This doesn't handle it at all.

Hi @justusschock , based on the change, the output should look something like

GPU available: RTX 3090, RTX 4090, using: 2 devices.

that being said, if the setup is more complex - for example 2 x 3090 and 1 x 4090 - the current output might not fully reflect that.

@GdoongMathew

This comment has been minimized.

@GdoongMathew GdoongMathew marked this pull request as draft August 28, 2025 12:47
@GdoongMathew
Copy link
Copy Markdown
Contributor Author

Hi @Borda , a friendly ping for a review ~

@Borda
Copy link
Copy Markdown
Collaborator

Borda commented Oct 22, 2025

Hi @Borda , a friendly ping for a review ~

unfortunatly, I am not in a position to approve a feature type PR, lest ping @ethanwharris

# Conflicts:
#	src/lightning/pytorch/accelerators/xla.py
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 4, 2025

Codecov Report

❌ Patch coverage is 74.00000% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 79%. Comparing base (7d2de87) to head (ea2767d).
⚠️ Report is 46 commits behind head on master.
✅ All tests successful. No failed tests found.

❗ There is a different number of reports uploaded between BASE (7d2de87) and HEAD (ea2767d). Click for more details.

HEAD has 1312 uploads less than BASE
Flag BASE (7d2de87) HEAD (ea2767d)
cpu 328 33
python 30 3
lightning_fabric 88 0
pytest 163 0
python3.10 30 3
lightning 150 15
python3.13 29 3
python3.12 89 9
python3.11 60 6
python3.12.7 90 9
pytorch2.1 30 6
pytest-full 165 33
pytorch2.3 15 3
pytorch2.5.1 15 3
pytorch2.2.2 15 3
pytorch2.8 30 6
pytorch_lightning 90 18
pytorch2.9 15 3
pytorch2.7 15 3
pytorch2.6 15 3
pytorch2.4.1 15 3
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #21112     +/-   ##
=========================================
- Coverage      87%      79%     -8%     
=========================================
  Files         270      267      -3     
  Lines       24071    24055     -16     
=========================================
- Hits        20867    18986   -1881     
- Misses       3204     5069   +1865     

# Conflicts:
#	src/lightning/pytorch/CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accelerator has conflicts pl Generic label for PyTorch Lightning package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add device information to the accelerator config message

4 participants