Installing TensorFlow 1.2 / 1.3 from source with GPU support on macOS
Mattias Arro
1234

Thanks for your post. It helps to build from source tensorflow r1.3.

The GPU version works great on iMac27 2017 with 1080Ti in Akitio Node.

Here is ‘build history’:

$ tar xvzf cudnn-8.0-osx-x64-v6.0.tgz
$ sudo cp -v -R cuda/* /usr/local/cuda/
$ brew install python3
$ brew switch bazel 0.5.2

$ python3 -m venv ~/venv/tf_gpu
$ source ~/venv/tf_gpu/bin/activate
$ pip3 install six numpy wheel
$ git clone https://github.com/tensorflow/tensorflow
$ cd tensorflow/
$ git checkout r1.3
$ ./configure. #compute capability is here: https://developer.nvidia.com/cuda-gpus. 6.1 for 1080ti
$ bazel build — config=opt — config=cuda //tensorflow/tools/pip_package:build_pip_package
$ bazel-bin/tensorflow/tools/pip_package/build_pip_package ~/Code/Packages/tensorflow_pkg
$ pip3 install ~/Code/Packages/tensorflow_pkg/tensorflow-1.3.0-cp36-cp36m-macosx_10_12_x86_64.whl

And list of underwater stones :)

  1. “nvcc fatal : The version (‘80100’) of the host compiler (‘Apple clang’) is not supported”. Solution: Use the same version of XCODE as specified at http://docs.nvidia.com/cuda/cuda-installation-guide-mac-os-x/index.html#axzz4rAPmEgc3
  2. /usl/local/cuda/libcuda.dylib not found Solution: Don’t uncheck anything in Cuda installer:) Leave options as default, including Cuda Driver
  3. dyld: Library not loaded: @rpath/libcudart.8.0.dylib 
    Solution:
    export CUDA_HOME=/usr/local/cuda
    export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/extras/CUPTI/lib
    export LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
    export PATH=$DYLD_LIBRARY_PATH:$PATH
  4. ld: library not found for -lgomp
    Solution:
    is in your post. Thanks again!
    diff — git a/third_party/gpus/cuda/BUILD.tpl b/third_party/gpus/cuda/BUILD.tpl
    index f7610dd..102026b 100644
     — — a/third_party/gpus/cuda/BUILD.tpl
    +++ b/third_party/gpus/cuda/BUILD.tpl
    @@ -95,7 +95,6 @@ cc_library(
    data = [“lib/%{cusolver_lib}”],
    includes = [“include”],
    linkstatic = 1,
    - linkopts = [“-lgomp”],
    visibility = [“//visibility:public”],
    )

Which version of …?
macOS: 10.12.6
NVIDIA Web Driver: 378.05.05.25f01 installed by automate-eGPU.sh v1.0.1 from https://egpu.io/forums/mac-setup/automate-egpu-sh-is-reborn-with-amd-polaris-fiji-support-for-macos/paged/10/#post-18859
CUDA Driver Version: 8.0.90 (Cuda installer + Cuda patch)
CudaNN: 6
XCode: $ gcc -v
Configured with: — prefix=/Library/Developer/CommandLineTools/usr — with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.