PyTorch with GPU on Macos (10.13.4) by

PyTorch with GPU on Macos (10.13.4)

Last update: 8 months ago Tag : pytorch, macos, hackintosh

Well, PyTorch is a deeplearning platform developed by facebook based on torch, but is now fully utilised python. Before it was a wrapper for torch under the lua language.

So, now everything in macos is limited, you got no ports other than USB-C, no GPU other than Radeon or integrated intel hd, or using external gpu, again you have to use the USB-C or thunderbolt 3 to use it, though using some hacks you still can run external gpu using thunderbolt 2, but still, it's a waste of bandwidth and does not worth the money and efforts.

Now I'm working on Asus FX503VM machine, because of two things: Nvidia 1060 and machine learning. Actually I successfully installed every machine learning thing or two in Ubuntu 16.04 (just upgraded to 18.04), to name a few: tensorflow with GPU, pytorch GPU, mxnet GPU, darknet GPU, everything GPU enabled.

But as a long time macos user, I can't help to install the hackintosh to it, and do everything machine learning or two on top of it.

Long story short: macos 10.13.4, fluidly running well, some hiccups but safely ignorable, such as no elan touchpad yet (it's I2C, not PS/2 like always), nvidia brightness setting is not working yet, now I just use the brightness slider to reduce the flares. Basically you just need a unibeast created USB installer and some kexts which I put in clover, so no need to modify the internal macos file structure.

Now the machine learning part. I use python3 from brew package instead of the overly popular anaconda.

For tensorflow, I don't built myself, just fetch the readily prebuilt by a dude out there. It's tensorflow 1.6 version, and I'll wait the latest one. Here is the link.. To run this prebuilt library, you need to install the Cuda 9.1 and Cudnn 7 first. Of course you already install the nvidia web driver from the very beginning.

For pytorch, I found no prebuilt binary shared by anyone, so I have to build it myself. Here are the steps:

  1. Download and install CLT 8.3.2
  2. brew install cmake
  3. git clone --recursive
  4. cd pytorch
  5. CC=clang CXX=clang++ python install
  6. Wait for some minutes, and it will be ready

Ok, enough for now...

Share this post: