-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RLlib] Support for mps (Apple Metal) GPUs in torch #28321
Comments
As per this discussion, even if ray doesn't detect metal GPUs as resources, that's pretty easy to work around. So even just adding support in rllib itself would be useful. Could we simply try mps devices if there aren't any CUDA devices found? If so, this might just be a couple of additional lines of code. |
GPU support for m1 would be great! |
Would also like to see this happen! |
Waiting for this too:) |
Same, that would help a lot :) |
Would love to see this happen! |
+1 this would be great |
Hey, any update for rlib/Ray? Anything we can do to help? |
It would be nice to address this issue. I think it should be quite straightforward. After playing around, currently it does not work only because I'm currently monkey-patching import torch
device_count_orig = torch.cuda.device_count
def device_count():
if torch.backends.mps.is_available():
return 1
return device_count_orig()
torch.cuda.device_count = device_count |
I was eager to try that and added GPU to my learner configs.
and adding
and using
Then i see Unfortunately it doesn't tune and "idles" in |
Description
Torch on MacOS supports GPU acceleration on Metal GPUs (AMD GPUs on Intel Macs and Apple GPUs on M1/M2) through the
mps
backend now. It would be nice if ray / rllib could make use of this.As far as I understand, the only change that is needed as far as torch is concerned is to do
torch.device("mps")
instead oftorch.device("cuda...")
, so this would be a relatively small addition in rllib'storch_policy_v2
. I'm less clear on what would be needed for other parts of ray to recognise mps devices as GPU resources.As a side note, in case anyone comes across this looking for GPU support on MacOS, it seems this already works for tf2, using tensorflow-metal. Just
pip install tensorflow-metal
and setframework
totf2
(not justtf
), and rllib should see and use your AMD or Apple GPU.Use case
It would be nice to have GPU acceleration for quick local debugging sessions.
The text was updated successfully, but these errors were encountered: