Skip to content

Instantly share code, notes, and snippets.

@thomaswilley
Last active January 6, 2018 19:59
Show Gist options
  • Save thomaswilley/c616b4206ae2f6c5f0953aaf51a58d85 to your computer and use it in GitHub Desktop.
Save thomaswilley/c616b4206ae2f6c5f0953aaf51a58d85 to your computer and use it in GitHub Desktop.
Build Tensorflow: OS X High Sierra with CPU optimizations for python3.6
# Reference guide from Google: https://www.tensorflow.org/install/install_sources
# assumes python3 and pip3 installed (/usr/local/python3.6), along with homebrew
# python pkgs path: `python3 -m site` (/usr/local/lib/python3.6/site-packages)
# --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-msse4.1 --copt=-msse4.2
# ^ these are some potential CPU optimizations but just allowing the ./configurewizard to do its thing and use -march=native
# also seems to work fine for just CPU optim.
$ brew install bazel # v.0.9.0
$ pip3 install numpy six wheel
$ git clone https://github.com/tensorflow/tensorflow.git
$ ./configure # (and then follow the wizard
$ bazel build --config=opt --incompatible_load_argument_is_label=false //tensorflow/tools/pip_package:build_pip_package
# convert the build output into a whl for use in a virtualenv/python3.6 & pip install it as needed...
$ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
$ sudo pip install /tmp/tensorflow_pkg/<whateveritis...>.whl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment