Introducing Accelerated PyTorch Training on Mac in v1.12

https://pytorch.org/blog/introducing-accelerated-pytorch-training-on-mac

Does this feature support AMD GPUs with Metal or only M1 support?

Does v1.12 nightly build support the Apple Metal only with source?

Hello dbl001, M1 macs and macs with AMD gpus should support the MPS backend for PyTorch. For any additional insight, it might be better to look at their thread on MPS support - https://discuss.pytorch.org/t/about-the-mps-category/151972

I've been experimenting with the new build and I'm not sure I'm seeing any signs that the GPU is being used. The activity monitor GPU window doesn't spike when I train a classifier on the CIFAR set. The torch.cuda.is_available() value is still false, which I guess you’d expect, but if I create a tensor, tensor.device still shows CPU. All torch.device() are still set to cuda. Is it working on a metal GPU now without saying it’s working on a gpu or something? Are there new torch properties for metal to replace the cuda ones? Does the gpu engage without any indication that it does?

Thanks!

It is now supported. The name of the Torch device is "mps" (for both older Intel macs with AMD GPUs and newer Macs with Apple Silicon). This is discussed in Apple docs and in this Pytorch thread. Nothing special is required, other than pip-installing the packages. (Note that the Apple docs are slightly out of date in that you no longer need to use nightly pytorch builds to have support for mps.) You can check this works with torch.rand(3, 3, device='mps'), which will fail if mps is not available.

As a tangent, for Tensorflow, you need to install the tensorflow-metal pypi dependency, discussed in Apple docs here. You can check this worked with tensorflow.config.list_physical_devices() (should include GPU:0 in the list)

Introducing Accelerated PyTorch Training on Mac in v1.12
 
 
Q