Open BlackRockJL opened 1 year ago
In principle it could be done - not sure how much work that would represent.
However the biggest pre-requisite is a python metal library sufficiently established and maintained (like pycuda/cupy for cuda, pyopencl for OpenCL) so that it is worth the effort.
There's https://github.com/baldand/py-metal-compute but no update in 2 years, and https://github.com/metal-stack/metal-python.
+1 for this feature
You can use the OpenCL backend to access the GPU on Apple silicon.
Running the example, you get,
Selected device: Apple M1 Max
( 800 768 16)[2D] dt= 3.79 ms 154.55 Gbytes/s [norm=0]
Oh amazing! I did not know that OpenCL is still a thing for mac since apple claimed it’s deprecated. So you just selected the OpenCL backend and it runs natively (without Rosetta)? Thank you! :)
I found a discussion about OpenCL and macOS if someone is interested in some other background.
So you just selected the OpenCL backend and it runs natively (without Rosetta)?
Yes. On Apple Silicon, the OpenCL CPU backend is gone and only the OpenCL Metal backend is available.
And it's well-tested, see on an M1 mac mini: http://ftp.esrf.fr/pub/scisoft/PyNX/pyvkfft-test/pyvkfft-test-2023-07-31-apple-m1/pyvkfft-test.html
Hey, awesome work! Are there plans to add a Metal backend support for Apple silicon? :) An update for VkFFT was recently released enabling Metal backends from their side.