Running PyTorch on the M1 GPU
pytorchapple-silicongpu-trainingdeep-learningbenchmark
Abstraction: Benchmark of PyTorch M1 GPU support via MPS backend for deep learning training
Key points:
- PyTorch officially added M1 GPU support via the
torch.device("mps")backend (May 2022, nightly release; targeting v1.12 stable) - M1 Pro GPU trains VGG16/CIFAR-10 3.5x faster than M1 Pro CPU; inference is 5x faster (1.69 min vs 8.51 min)
- PyTorch's own benchmark showed M1 Ultra GPU ~8x faster than M1 Ultra CPU for training, ~21x faster for inference
- M1 GPU still significantly slower than modern Nvidia GPUs (RTX 3060, 3080); M1 Ultra Mac Studio (~$5K) comes closest to competitive GPU performance
- Convolutional networks consume notably more RAM on M1 GPU vs CUDA GPU; swapping is a risk on memory-constrained MacBooks
- PyTorch MPS installer is ~45 MB vs ~750 MB for the CUDA 10.2 version; early release had a memory leak fixed in the May 22 nightly
Connections: Pytorch · Apple · GPU Acceleration · Deep Learning · Apple Silicon
Source: https://sebastianraschka.com/blog/2022/pytorch-m1-gpu.html