Skip to content

Conversation

fnhirwa
Copy link
Contributor

@fnhirwa fnhirwa commented Jun 17, 2025

What does this PR do?

Fixes #20451

This PR adds support for the auto variable for accelerator and devices in the Fabric CLI.

  • When auto is passed to --accelerator we now detect whether the machine has either mps, cuda, or cpu and dynamically runs on the available device, this is the same case when no accelerator is specified.

  • For auto in the --devices argument the devices default to 1 as specified in the docstring of the argument here

No breaking changes were introduced.

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--20913.org.readthedocs.build/en/20913/

@github-actions github-actions bot added the fabric lightning.fabric.Fabric label Jun 17, 2025
@fnhirwa fnhirwa marked this pull request as draft June 17, 2025 10:12
Copy link

codecov bot commented Jun 17, 2025

Codecov Report

Attention: Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Project coverage is 87%. Comparing base (3138305) to head (4f88200).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #20913   +/-   ##
=======================================
- Coverage      87%      87%   -0%     
=======================================
  Files         268      268           
  Lines       23442    23453   +11     
=======================================
+ Hits        20394    20401    +7     
- Misses       3048     3052    +4     

@fnhirwa fnhirwa marked this pull request as ready for review June 17, 2025 10:59
@fnhirwa fnhirwa marked this pull request as draft June 17, 2025 15:23
@fnhirwa fnhirwa marked this pull request as ready for review June 19, 2025 10:33
@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Jun 22, 2025
@Borda Borda changed the title Fabric: Enable auto for devices and accelerator cli` arguments Fabric: Enable "auto" for devices and accelerator as cli arguments Jun 23, 2025
@Borda Borda merged commit 6e90049 into Lightning-AI:master Jun 24, 2025
141 of 144 checks passed
@fnhirwa fnhirwa deleted the fabric branch July 11, 2025 10:27
Borda added a commit that referenced this pull request Aug 13, 2025
#20913)

* add auto option for accelerator and device
* use auto detect accelerator and add auto to the unit tests

---------

Co-authored-by: Jirka Borovec <[email protected]>
(cherry picked from commit 6e90049)
Borda added a commit that referenced this pull request Aug 13, 2025
#20913)

* add auto option for accelerator and device
* use auto detect accelerator and add auto to the unit tests

---------

Co-authored-by: Jirka Borovec <[email protected]>
(cherry picked from commit 6e90049)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fabric lightning.fabric.Fabric pl Generic label for PyTorch Lightning package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: Invalid value for '--accelerator': 'auto' is not one of 'cpu', 'gpu', 'cuda', 'mps', 'tpu'.
2 participants