Testing out the M2 Max for Machine Learning
Published on: Jan 26, 2023Filed under: Technology
I purchased my budget gaming PC in an emergency. It was a patch job of a machine, and like so many patch jobs, it stuck around far longer than any temporary fix ought to. But, a few weeks ago, I caught a Mac Rumor that the new M2 MacBook Pros would be available shortly.
So, I retired the patch job and upgraded to a M2 Max - largely as a standard of living upgrade. The PC could run Docker or Anaconda - but not both. And it took literally minutes to start a project running Django and React.
Because I’m a nerd, I wanted to do the digital equivalent of a drag race [1], and ran the same model on various platforms to see how much throwing money improves small things.
So, I ran this model 5 times:
- Cheap desktop CPU-only [2]
- Using a Nvidia 1060 3gb graphics card [3]
- Google Colab with an A100-SXM4-40gb ML-focused card [4]
- Apple M2 Max, CPU-only [5]
- Apple M2 Max 30-core GPU
There were a couple of interesting learnings here.
First - when dealing with a small dataset, even a cheap graphics card is a dramatic improvement.
Second, considering that A100 card [6] is 24x the price of the 1060 [7], I’d expect more than 75% improvement.
Finally, for processing in a laptop, the M2 Max did impressively well. I expect this kind of output matches something like a desktop 3070, albeit in a much smaller package.
Bonus - if you’re currently trying to install the Metal plugin to use Tensorflow [8] [9] with your brand new M2 machine, the plugin is currently messed up.
Use the following command to get an earlier, working version of Metal.
pip install tensorflow-macos==2.9 tensorflow-metal==0.5.0