3 ms·
Can anyone explain why it's hard to get GPU-accelerated ML libraries such as Torch running on a Mac (Intel or M1/M2)?
by simonw 4y ago
Can anyone explain why it's hard to get GPU-accelerated ML libraries such as Torch running on a Mac (Intel or M1/M2)?
- atty 4y agoIn each library, their operations need to be implemented for each backend separately (CPU, GPU, TPU, etc). All of these libraries support CUDA as their default GPU implementation because it’s by far the largest in terms of market share. But since Apple GPUs do not implement CUDA or a translation layer (they use Metal, Apples graphics and compute acceleration library), that means all those mathematical operations need to be rewritten targeting Metal before torch can even communicate usefully with an M1/M2 GPU. That doesn’t even touch on the fact that different backends need to have work scheduled on them slightly differently. Some expect a graph of operations to be submitted, some are just submitted as a series of asynchronous operations, etc. Also just wanted to point out that torch does support Apple GPUs now, however.
- spullara 4y agoThe nightly of PyTorch does run on the M1 GPU.