Friday, January 12, 2018

How to install pytorch on mac osx high sierra 10.13.02 with egpu Akitio 3

Check my previous post on how to get Akitio 3 working on Mac OSX high sierra

http://olivernina.blogspot.com/2018/01/how-to-install-akitio-3-m6000-to-mac.html

This post is mainly on compiling and installing pytorch from source for Mac.
Installing pytorch in MacOS X with an external gpu could be cumbersome. I compiled pytorch from source before and there are a few main details to pay attention in order to succeed. I found this video that was helpful on getting this working.

https://www.youtube.com/watch?v=h8n6HrLfeJQ


The main instructions are as follows
Assuming you have your GPU working properly.

Install xcode. I got the version that comes with 10.13.02

Install homebrew as instructed in https://brew.sh/

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Update homebrew:

brew update

install anaconda. You can do it through brew or downloading the installer from their website.

Install cuda. Verify which version works with your driver. My driver is 378.10.10.10.25.102
You will also need to install the CUDA toolkit that will have the compiler and other tools for compiling CUDA code. My verison for the toolkit is 9.1.

Install cudnn. Also verify which version works with the CUDA version you have


clone pytorch from source

git clone --recursive https://github.com/pytorch/pytorch

According to pytorch you have to update some tools
conda install numpy pyyaml setuptools cmake cffi

Define path for cmake which is where your anaconda is,  in my case was:
export CMAKE_PREFIX_PATH=/Users/oliver/anaconda/

Make sure clang --version works with the CUDA you have. My setup works only with clang version 8.1.0 (clang-802.0.42)
Thus I need to go to https://developer.apple.com/download/more/
and download Command Line Tools for Xcode 8.3.2
Install the command line tools and then run
sudo xcode-select --switch /Library/Developer/CommandLineTools

Then compile and  install pytorch.

MACOSX_DEPLOYMENT_TARGET=10.13 CC=clang CXX=clang++ python setup.py install

That is it. Good luck!

How to install Akitio 3 and M6000 GPU to Mac Book air with High Sierra 10.13.02 through TB2

I was recently given an M6000 Nvidia GPU with an Akitio 3 box to work with my mac book air which is a mid 2013. My laptop was updated to the latest high Sierra Mac OSX 10.13.02.
The problem with my laptop and Akitio 3 is that my laptop has only a TB2 output. However, this can overcome by getting a USB-C (TB3) to TB2 adapter for mac. Thus I connected my Akitio egpu through my TB2 connection and the system was able to recognize the Akitio.

The next part was to install the drivers and software for the Akitio and GPU to work. This part is a little tricky since Nvidia still doesn't fully support all GPUs and people rely on third party software for this to work. Fortunately there is a good community that keeps the tools and forums up to date and make possible to figure out solutions for different systems.
After spending a large amount of time on different post and forums. I came across this page which made the difference.

It appears that some of the drivers need the egpu support tool described in this page. So I followed the steps in this page.

I first started with a fresh installation by removing all other drivers and cuda tools installed. I also didn’t have the egpu connected to the laptop until after all the software was installed.
I downloaded manually the drivers and cuda tools from nvidia. In my case I used
WebDriver-378.10.10.10.25.102.pkg
Cudadriver_387.99_macos.dmg

I did this by having System Integrity Protection (SIP) enable at first

Then installed the drivers and cuda

I then disabled SIP by restarting while pressing command+ R
I used the terminal and type csrutil disable

I then installed the nvidia-egpu-v4.zip tool that correspond to my driver and my high Sierra version [17C88]
I then did a hot plug on the egpu and it was recognized by the driver but it still didn’t show on the system information profile. I did a restart and finally the Nvidia driver and gpu were finally working.

Good luck with this.


-->