Skip to content

Conversation

@justusschock
Copy link
Member

@justusschock justusschock commented Nov 3, 2025

What does this PR do?

Adds a name function to Accelerator interface.

Allows accelerator type checks that are agnostic to the package.

E.g. isinstance(accelerator, lightning.fabric.CUDAAccelerator) doesn't work for lightning_fabric.CUDAAccelerator.
And in the future we can check for accelerator.name() == "cuda".

All of those checks we have inside the package are converted properly, but external code cannot properly rely on package-agnostic type-checks.

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

@github-actions github-actions bot added the fabric lightning.fabric.Fabric label Nov 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

⚡ Required checks status: All passing 🟢

Groups summary

🟢 pytorch_lightning: Tests workflow
Check ID Status
pl-cpu-guardian success

These checks are required after the changes to src/lightning/fabric/accelerators/accelerator.py, src/lightning/fabric/accelerators/cpu.py, src/lightning/fabric/accelerators/cuda.py, src/lightning/fabric/accelerators/mps.py, src/lightning/fabric/accelerators/xla.py, src/lightning/pytorch/accelerators/cpu.py, src/lightning/pytorch/accelerators/cuda.py, src/lightning/pytorch/accelerators/mps.py, src/lightning/pytorch/accelerators/xla.py.

🟢 pytorch_lightning: lit GPU
Check ID Status
pytorch.yml / Lit Job (nvidia/cuda:12.1.1-devel-ubuntu22.04, pytorch, 3.10) success
pytorch.yml / Lit Job (lightning, 3.12) success
pytorch.yml / Lit Job (pytorch, 3.12) success

These checks are required after the changes to src/lightning/pytorch/accelerators/cpu.py, src/lightning/pytorch/accelerators/cuda.py, src/lightning/pytorch/accelerators/mps.py, src/lightning/pytorch/accelerators/xla.py, src/lightning/fabric/accelerators/accelerator.py, src/lightning/fabric/accelerators/cpu.py, src/lightning/fabric/accelerators/cuda.py, src/lightning/fabric/accelerators/mps.py, src/lightning/fabric/accelerators/xla.py.

🟢 Benchmarks
Check ID Status
benchmark.yml / Lit Job (fabric) success
benchmark.yml / Lit Job (pytorch) success

These checks are required after the changes to src/lightning/fabric/accelerators/accelerator.py, src/lightning/fabric/accelerators/cpu.py, src/lightning/fabric/accelerators/cuda.py, src/lightning/fabric/accelerators/mps.py, src/lightning/fabric/accelerators/xla.py, src/lightning/pytorch/accelerators/cpu.py, src/lightning/pytorch/accelerators/cuda.py, src/lightning/pytorch/accelerators/mps.py, src/lightning/pytorch/accelerators/xla.py.

🟢 fabric: Docs
Check ID Status
docs-make (fabric, doctest) success
docs-make (fabric, html) success

These checks are required after the changes to src/lightning/fabric/accelerators/accelerator.py, src/lightning/fabric/accelerators/cpu.py, src/lightning/fabric/accelerators/cuda.py, src/lightning/fabric/accelerators/mps.py, src/lightning/fabric/accelerators/xla.py.

🟢 pytorch_lightning: Docs
Check ID Status
docs-make (pytorch, doctest) success
docs-make (pytorch, html) success

These checks are required after the changes to src/lightning/pytorch/accelerators/cpu.py, src/lightning/pytorch/accelerators/cuda.py, src/lightning/pytorch/accelerators/mps.py, src/lightning/pytorch/accelerators/xla.py.

🟢 lightning_fabric: CPU workflow
Check ID Status
fabric-cpu-guardian success

These checks are required after the changes to src/lightning/fabric/accelerators/accelerator.py, src/lightning/fabric/accelerators/cpu.py, src/lightning/fabric/accelerators/cuda.py, src/lightning/fabric/accelerators/mps.py, src/lightning/fabric/accelerators/xla.py, tests/tests_fabric/accelerators/test_registry.py.

🟢 lightning_fabric: lit GPU
Check ID Status
fabric.yml / Lit Job (nvidia/cuda:12.1.1-devel-ubuntu22.04, fabric, 3.10) success
fabric.yml / Lit Job (fabric, 3.12) success
fabric.yml / Lit Job (lightning, 3.12) success

These checks are required after the changes to src/lightning/fabric/accelerators/accelerator.py, src/lightning/fabric/accelerators/cpu.py, src/lightning/fabric/accelerators/cuda.py, src/lightning/fabric/accelerators/mps.py, src/lightning/fabric/accelerators/xla.py, tests/tests_fabric/accelerators/test_registry.py.

🟢 mypy
Check ID Status
mypy success

These checks are required after the changes to src/lightning/fabric/accelerators/accelerator.py, src/lightning/fabric/accelerators/cpu.py, src/lightning/fabric/accelerators/cuda.py, src/lightning/fabric/accelerators/mps.py, src/lightning/fabric/accelerators/xla.py, src/lightning/pytorch/accelerators/cpu.py, src/lightning/pytorch/accelerators/cuda.py, src/lightning/pytorch/accelerators/mps.py, src/lightning/pytorch/accelerators/xla.py.

🟢 install
Check ID Status
install-pkg-guardian success

These checks are required after the changes to src/lightning/fabric/accelerators/accelerator.py, src/lightning/fabric/accelerators/cpu.py, src/lightning/fabric/accelerators/cuda.py, src/lightning/fabric/accelerators/mps.py, src/lightning/fabric/accelerators/xla.py, src/lightning/pytorch/accelerators/cpu.py, src/lightning/pytorch/accelerators/cuda.py, src/lightning/pytorch/accelerators/mps.py, src/lightning/pytorch/accelerators/xla.py.


Thank you for your contribution! 💜

Note
This comment is automatically generated and updates for 70 minutes every 180 seconds. If you have any other questions, contact carmocca for help.

@codecov
Copy link

codecov bot commented Nov 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87%. Comparing base (739cf13) to head (fa06094).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #21325     +/-   ##
=========================================
+ Coverage      80%      87%     +7%     
=========================================
  Files         270      270             
  Lines       23764    23799     +35     
=========================================
+ Hits        19040    20629   +1589     
+ Misses       4724     3170   -1554     

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Nov 3, 2025
@github-actions github-actions bot added docs Documentation related dependencies Pull requests that update a dependency file labels Nov 3, 2025
@justusschock justusschock changed the title Add name to accelerator interface [blocked by #21327] Add name to accelerator interface Nov 3, 2025
@justusschock justusschock changed the base branch from master to remove_habana November 3, 2025 11:55
Base automatically changed from remove_habana to master November 3, 2025 17:11
@justusschock justusschock changed the title [blocked by #21327] Add name to accelerator interface Add name to accelerator interface Nov 3, 2025
@tchaton tchaton merged commit 32442c2 into master Nov 4, 2025
112 of 113 checks passed
@tchaton tchaton deleted the add_name_to_accelerator_interface branch November 4, 2025 08:47
justusschock added a commit that referenced this pull request Nov 5, 2025
@justusschock justusschock mentioned this pull request Nov 5, 2025
justusschock added a commit that referenced this pull request Nov 5, 2025
* Remove Support For Deprecated Habana (#21327)

* remove habana

* changelog

* remove from install

* update docs

* update

* update

* pytest match

* Add name to accelerator interface (#21325)

* changelog + rebase

* version.info bumo

* fix: Checkout and Git LFS fetch issue for pytorch docs workflow (#21219)

* ci: `uv` for `docs-build` (#21206)

replace pip with uv

Co-authored-by: Jirka Borovec <[email protected]>

* fix: failing ci linkcheck in markdown (#21222)

Update timeout and retry configuration
Increased timeout and adjusted retry settings.

* simplify lit CI config (#21220)

* simplify lit CI config

* Empty-Commit

* Empty-Commit

* Update

---------

Co-authored-by: Justus Schock <[email protected]>

* fix:docs build errors (#21286)

* docs: add 'typing.Union' to nitpick_ignore_regex in Sphinx configuration

* docs: add Supermicro link to linkcheck_ignore due to 403 error

* [Hotfix] Remove reference to `torch.jit.export` (#21292)

update docs

* Docs: drop deprecated project (#21250)

* drop dumping wheels after UV switch (#21217)

* chore(`ci/litjob`): fix and optimize GPU related tests (#21290)

* fix: add unzip to dependencies in pytorch workflow
* fix: update variable interpolation for PACKAGE_NAME in YAML workflows
* fix: update variable interpolation for PACKAGE_NAME in fabric workflow
* fix: disable CUDA_LAUNCH_BLOCKING to speed up tests
* apply suggestion

* remove integrations from Dockerfile

* Update readme (#21263)

Update LitServe description for clarity

* Update heading from 'Why PyTorch Lightning?' to 'Convert from PyTorch to PyTorch Lightning?'

* Fix heading formatting in README.md

* Add UTM parameters to links in README

Updated links in README to include UTM parameters for tracking.

* readme

readme

* readme updates

readme updates

* update readme

Update readme

* update

* update

* update

* update

* resolve docker builds

* update

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Bhimraj Yadav <[email protected]>
Co-authored-by: Shion Matsumoto <[email protected]>
Co-authored-by: Jirka Borovec <[email protected]>
Co-authored-by: Deependu <[email protected]>
Co-authored-by: Nicki Skafte Detlefsen <[email protected]>
Co-authored-by: William Falcon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file docs Documentation related fabric lightning.fabric.Fabric pl Generic label for PyTorch Lightning package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants