Report MPS as the accelerator in accelerate env - #4158
Open
xquantize wants to merge 1 commit into
Open
Conversation
…ction chain in Copy-and-paste the text below in your GitHub issue - `Accelerate` version: 1.15.0.dev0 - Platform: macOS-26.5.2-arm64-arm-64bit - `accelerate` bash location: /Users/zaneneave/Documents/Research/accelerate/.venv/bin/accelerate - Python version: 3.12.13 - Numpy version: 2.5.2 - PyTorch version: 2.13.0 - PyTorch accelerator: MPS - System RAM: 18.00 GB - MPS type: Apple M3 Pro - `Accelerate` default config: Not found checked CUDA, XPU, MLU, SDAA, MUSA, NPU and NEURON but not MPS, so on Apple Silicon it reported 'PyTorch accelerator: N/A' despite MPS being available. Add an MPS branch (via is_mps_available) plus a corresponding 'MPS type' line reporting the chip name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
accelerate envreportsPyTorch accelerator: N/Aon Apple Silicon. The accelerator-detection chain inenv_commandchecks CUDA, XPU, MLU, SDAA, MUSA, NPU and NEURON, but not MPS, so on a Mac with a working MPS backend it falls through to "N/A", and the diagnostic that your issue template asks users to paste under-reports their hardware.This adds an MPS branch (using the existing
is_mps_availablehelper) to both the accelerator-name chain and the device-type chain, so it now reports:Before (M3 Pro, macOS, torch 2.13):
After:
The
MPS typevalue is read at runtime viasysctl machdep.cpu.brand_string(macOS-only, which is fine since MPS is Apple-only), with aplatform.processor()fallback if that call fails. Verified manually on Apple Silicon. Happy to gate the sysctl call onplatform.system() == "Darwin"or change theMPS typesource if you'd prefer.Fixes # (issue)
Before submitting
Who can review?
@SunMarc — this touches the CLI (
accelerate env).