Skip to content

Instantly share code, notes, and snippets.

@matt-deboer
Forked from to-bee/tensorflow-gpu-sierra
Last active December 27, 2017 16:55
Show Gist options
  • Save matt-deboer/c04a0ebc4e3da95951cb51c17a139087 to your computer and use it in GitHub Desktop.
Save matt-deboer/c04a0ebc4e3da95951cb51c17a139087 to your computer and use it in GitHub Desktop.
Build tensorflow with gpu support on OSX Sierra
disable sip in recovery mode
start recovery mode with Cmd + R on startup
start terminal
csrutil disable
download and install cuda 9.1
download cuDNN v7.0 for cuda 9 (register first)
install xcode 8.3
current xcode version is not supported
https://srikanthpagadala.github.io/notes/2016/11/07/enable-gpu-support-for-tensorflow-on-macos
• download Xcode 8.3.3 from the apple developer website
• rename XCode.App -> XCode_8.3.3.App, and move to /Applications folder
• run sudo xcode-select -s /Applications/XCode_8.3.3.App
move cuda libs
cd /Users/tobi/Downloads
sudo mv -v cuda/lib/libcudnn* /usr/local/cuda/lib
sudo mv -v cuda/include/cudnn.h /usr/local/cuda/include
clone git
git clone --recurse-submodules https://github.com/tensorflow/tensorflow
git checkout tag v1.4.1
add to .bash_profile
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=$CUDA_HOME/bi:$DYLD_LIBRARY_PATH:$PATH
activate venv
source .virtualenv/bin/activate
uninstall old tensorflow version
pip uninstall tensorflow
pip uninstall tensorflow-gpu
avoid missing rpath error
https://github.com/tensorflow/tensorflow/issues/4187
cd /Users/tobi/tensorflow/
touch -t YYYYMMDDhhmm.SS genrule-setup.sh
configure
check your gpu prerequisites:
http://stackoverflow.com/questions/33651810/the-minimum-required-cuda-capability-is-3-5
https://developer.nvidia.com/cuda-gpus?nocache=1492985895
TF_UNOFFICIAL_SETTING=1 ./configure
build
bazel build --config=cuda --config=opt --action_env PATH --action_env LD_LIBRARY_PATH --action_env DYLD_LIBRARY_PATH //tensorflow/tools/pip_package:build_pip_package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment