Ah, got it — you’re talking pure GPGPU (general-purpose GPU computing), not ML frameworks piggybacking on GPU support.
In that case, Apple Silicon (M1/M2/M3) does support GPGPU via Metal, but Python access is limited and not straightforward. Here’s the landscape:
Metal is Apple’s graphics and compute API (like CUDA or OpenCL). It’s powerful but not directly accessible from Python without a wrapper. Options include:
There are experimental wrappers like PyMetal — very limited and often outdated.
You can use pyobjc to interface with Objective-C and call Metal APIs. This requires:
- Writing Metal shader functions in
.metal files
- Compiling them
- Managing GPU buffers manually in Python
It’s complex, but feasible if you’re familiar with Metal + Python + ObjC interop.
This is a more realistic path:
- Write your compute-heavy code in Swift using Metal.
- Expose it as a Python module using
pybind11, cffi, or ctypes.
This gives you full GPGPU power without waiting for Python ecosystem support.
Apple deprecated OpenCL in favor of Metal. While pyopencl can run, Apple doesn’t support OpenCL on Apple Silicon GPUs anymore, so it’s CPU only or non-functional.
ArrayFire once had Metal support on the roadmap, but currently it does not support Metal (only CUDA/OpenCL), and thus is not viable on M-series Macs.
You can offload GPGPU to JS using GPU.js and call it from Python via subprocess or a local HTTP bridge — a clever hack, but not native Python.
- No native, user-friendly GPGPU Python libs for Metal yet.
- If you’re serious: Write GPU code in Swift with Metal and bridge it to Python.
- For prototyping, consider using NumPy+Numba on CPU (they’re fast on M1/M2 CPUs).
- OpenCL is deprecated and doesn’t run on M-series GPU.
Want a simple example of using Metal from Swift for a compute shader, or guidance on bridging to Python?