I could finally install Nvidia Titan XP + MacBook Pro + Akitio Node + Tensorflow + Keras
I wrote a gist with the procedure, hope it helps
Here is what I did:
This configuration worked for me, hope it helps
It is based on:
- macOS Sierra Version 10.12.6
- GPU Driver Version: 10.18.5 (378.05.05.25f01)
- CUDA Driver Version: 8.0.61
- cuDNN v5.1 (Jan 20, 2017), for CUDA 8.0: Need to register and download
- tensorflow-gpu 1.0.0
- Keras 2.0.8
Install GPU driver
- ShutDown your system, power it up again with pressing (⌘ and R) keys until you see , this will let you in Recovery Mode.
- From the Menu Bar click Utilities > Terminal and write ‘csrutil disable; reboot’ press enter to execute this command.
When your mac restarted, run this command in Terminal:
cd ~/Desktop; git clone https://github.com/goalque/automate-eGPU.git
chmod +x ~/Desktop/automate-eGPU/automate-eGPU.sh
Unplug your eGPU from your Mac, and restart. This is important if you did not unplug your eGPU you may end up with black screen after restarting.
When your Mac restarted, Open up Terminal and execute this command:
sudo ~/Desktop/automate-eGPU/./automate-eGPU.sh -a
- Plug your eGPU to your mac via TH2.
- Restart your Mac.
Install CUDA, cuDNN, Tensorflow and Keras
At this moment, Keras 2.08 needs tensorflow 1.0.0. Tensorflow-gpu 1.0.0 needs CUDA 8.0 and cuDNN v5.1 is the one that worked for me. I tried other combinations but doesn't seem to work
- Download and installing CUDA 8.0 CUDA Toolkit 8.0 GA2 (Feb 2017)
- Install it and follow the instructions
Set env variables
(If your bash_profile does not exist, create it. This is executed everytime you open a terminal window)
- Downloading and installing cuDNN (cudnn-8.0-osx-x64-v5.1) Need to register before downloading it
Copy cuDNN files to CUDA
sudo cp include/* /usr/local/cuda/include/
sudo cp lib/* /usr/local/cuda/lib/
Create envirenment and install tensorflow
conda create -n egpu python=3
source activate egpu
pip install tensorflow-gpu==1.0.0
Verify it works
Run the following script:
import tensorflow as tf
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
with tf.Session() as sess:
Install Keras in the envirenment and set tensorflow as backend:
pip install --upgrade --no-deps keras # Need no-deps flag to prevent from installing tensorflow dependency
KERAS_BACKEND=tensorflow python -c "from keras import backend"
Using TensorFlow backend.
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.8.0.dylib locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.5.dylib locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.8.0.dylib locally
I tensorflow/stream_executor/dso_loader.cc:126] Couldn't open CUDA library libcuda.1.dylib. LD_LIBRARY_PATH: /usr/local/cuda/lib:/usr/local/cuda:/usr/local/cuda/extras/CUPTI/lib
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.dylib locally
I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.8.0.dylib locally