Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dbarnes/486fc02f98046048f7d6bfd5908d561a to your computer and use it in GitHub Desktop.
Save dbarnes/486fc02f98046048f7d6bfd5908d561a to your computer and use it in GitHub Desktop.
OSX Sierra + Titan Xp eGPU. Tensorflow 1.2.1. + CUDA 8 + cuDNN 6

OSX Sierra + Titan Xp eGPU. Tensorflow 1.2.1. + CUDA 8 + cuDNN 6

This gist summarises the tensorflow related steps I took to get the above combo working.

When its all tested in c++ I'll update the instructions fully (and add anything I forgot below).

But in summary ( with the current master dd06643cf098ed362212ce0f76ee746951466e81 ):

I have uploaded the pip wheel which I believe should work if you have the same setup but no promises (built for compute capability 3.5, 5.2, 6.0 and named tensorflow-gpu). Install with (not sure dropbox allows this direct linking):

pip install http://dl.dropboxusercontent.com/s/reo3pkz6dn33u8k/tensorflow_gpu-1.2.1-cp27-cp27m-macosx_10_11_x86_64.whl

Or download then install

https://www.dropbox.com/s/reo3pkz6dn33u8k/tensorflow_gpu-1.2.1-cp27-cp27m-macosx_10_11_x86_64.whl?dl=1

pip install tensorflow_gpu-1.2.1-cp27-cp27m-macosx_10_11_x86_64.whl

  • CUDA 8.0.61
    • export PATH=/usr/local/cuda/bin:$PATH
    • export LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH
    • export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH
  • cuDNN 6.0.21
  • NVidia Web Driver 378.05.05.15f01
  • LLVM but older command line tools to keep nvcc happy (xcode-select version 2347)
  • Add libgomp from GCC... to the library paths (brew install gcc)
    • export LD_LIBRARY_PATH=/usr/local/Cellar/gcc/7.1.0/lib/gcc/7:$LD_LIBRARY_PATH
    • export DYLD_LIBRARY_PATH=/usr/local/Cellar/gcc/7.1.0/lib/gcc/7:$DYLD_LIBRARY_PATH
  • Normal configure steps (set your CUDA compute capability)
  • Export your library paths to the bazel build with --action_env LD_LIBRARY_PATH="$LD_LIBRARY_PATH". Not sure if this is necessary but was needed at one point, Ill try when I next build and drop it from here if unecessary. So for example if you also want libtensorflow.so :
    • bazel build --config=opt --config=cuda --show_result 100 //tensorflow/tools/pip_package:build_pip_package //tensorflow/python/tools:freeze_graph //tensorflow/python/tools:optimize_for_inference //tensorflow:libtensorflow.so //tensorflow/cc:tutorials_example_trainer --action_env LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
  • Build pip package if you want to use python
    • bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
  • Install
    • sudo pip install /tmp/tensorflow_pkg/<OUTPUT_WHEEL>.whl

Let me know if you have any problems as im sure I forgot some steps

@tscholak
Copy link

tscholak commented Oct 9, 2017

I was able to solve/circumvent the problem by applying this patch to ./third_party/gpus/cuda/BUILD.tpl:

--- a/third_party/gpus/cuda/BUILD.tpl
+++ b/third_party/gpus/cuda/BUILD.tpl
@@ -109,7 +109,7 @@ cc_library(
         ".",
         "cuda/include",
     ],
-    linkopts = ["-lgomp"],
+    linkopts = ["-L/opt/local/lib/gcc7/libgomp.dylib"],
     linkstatic = 1,
     visibility = ["//visibility:public"],
 )

see alse https://metakermit.com/2017/compiling-tensorflow-with-gpu-support-on-a-macbook-pro/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment