3 ms·
Recently I bought a Mac Studio and wanted to experiment with Apple's GPU-accelerated ML API under the Metal Performance Shaders framework. I downloaded a sampl
by pavlov 4y ago
Recently I bought a Mac Studio and wanted to experiment with Apple's GPU-accelerated ML API under the Metal Performance Shaders framework.
I downloaded a sample code project from WWDC 2019:
https://developer.apple.com/documentation/metalperformanceshaders/training_a_neural_network_with_metal_performance_shaders https://developer.apple.com/documentation/metalperformancesh...
It didn't build on latest Xcode on the Mac Studio. I'm experienced with Cocoa and Apple's APIs, but couldn't fix the problem in 30 minutes of poking around.
Then I found another sample code project from WWDC 2020 which is apparently using a similarly named but different API for the same purpose:
https://developer.apple.com/documentation/metalperformanceshadersgraph/training_a_neural_network_using_mps_graph https://developer.apple.com/documentation/metalperformancesh...
This one looked promising, but failed with a runtime assertion and I was unable to figure it out.
At this point I wish Apple spent more effort on making their existing frameworks usable. If the only available sample code doesn't even work on a brand new Mac, the API isn't going to be used by third parties.
- Invictus0 4y agoI agree. It's a miracle anything gets written for iOS at all. Poking around in Apple's documentation is just miserable.
- hedgehog 4y agoDepending what you want to do you do you might find it faster to prototype with the Python bindings: https://coremltools.readme.io/docs/model-prediction https://coremltools.readme.io/docs/model-prediction
- pavlov 4y agoI don't want to use CoreML or Python, I wanted to learn about the lower-level implementation using Metal Performance Shaders. And the only available sample code doesn't even run. This is sadly not a unique situation for Apple's more specialized public frameworks — they're more like semi-private because nobody outside Apple can make them work.
- hedgehog 4y agoAh, yeah, and that's an improvement over the historical state of their ML support. For inference the M1 is a nice platform (fastish and power efficient) but for research and training not fast or well supported enough to justify not using NVIDIA.