Skip to content

Conversation

GdoongMathew
Copy link
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 (Need Help)
  • 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
Contributor Author

GdoongMathew commented Aug 27, 2025

Copy link
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
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
Copy link
Contributor Author

On second thought, I may have oversimplified the question. It looks like the current implementation could cause issues with the DDP training strategy, since it tries to access a non-existent device ID on rank zero.

Thanks for your review @Borda & @justusschock , I’ll mark this PR as WIP for now. Any further suggestions are welcome~

@GdoongMathew GdoongMathew marked this pull request as draft August 28, 2025 12:47
@justusschock
Copy link
Member

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 I think that's fine. it's just important to reflect all available gpu types as that might impact memory etc.

@GdoongMathew GdoongMathew marked this pull request as ready for review August 28, 2025 16:19
@GdoongMathew
Copy link
Contributor Author

On second thought, I may have oversimplified the question. It looks like the current implementation could cause issues with the DDP training strategy, since it tries to access a non-existent device ID on rank zero.

Thanks for your review @Borda & @justusschock , I’ll mark this PR as WIP for now. Any further suggestions are welcome~

To follow up on my own concern: it seems the device_ids property refers to devices on the current node, not all devices across the world view. So the current implementation probably won’t cause any issues, aside from not being able to list device types from other nodes.

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.

Add device information to the accelerator config message
3 participants