TLDR
ソースから更の(NVIDIA-GPU等のない)Macにビルドする
https://www.tensorflow.org/install/install_sources を参考のこと
keras がそのうちにmacのGPUで動く何かのエンジンに対応するらしいの楽しみだけどエンジンの名前忘れた…。
commands
# ソース取得
git clone https://github.com/tensorflow/tensorflow && cd tensorflow
# ビルドに先立って必要なツールのインストール
brew cask install caskroom/versions/java8
brew install bazel coreutils
pip3 install numpy six wheel
# `which python3` / 選択肢は XLA-JIT 以外デフォルトでは {No,<default>} でよさそう
# / 数十分立ってからビルド失敗とかされてきつい
./configure
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
# ビルドしたものを pip で入れる
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
pip install /tmp/tensorflow_pkg/tensorflow*.whl
./configure
時のログ
You have bazel 0.9.0-homebrew installed.
Please specify the location of python. [Default is /usr/bin/python]: /usr/local/bin/python3
Found possible Python library paths:
/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
/Users/murata/.homesick/repos/dotfiles/module/python3
Please input the desired Python library path to use. Default is [/usr/local/Cellar/python3/3.6.4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages]
Do you wish to build TensorFlow with Google Cloud Platform support? [Y/n]: n
No Google Cloud Platform support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Hadoop File System support? [Y/n]: n
No Hadoop File System support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Amazon S3 File System support? [Y/n]: n
No Amazon S3 File System support will be enabled for TensorFlow.
Do you wish to build TensorFlow with XLA JIT support? [y/N]: y
XLA JIT support will be enabled for TensorFlow.
Do you wish to build TensorFlow with GDR support? [y/N]: n
No GDR support will be enabled for TensorFlow.
Do you wish to build TensorFlow with VERBS support? [y/N]: n
No VERBS support will be enabled for TensorFlow.
Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: N
No OpenCL SYCL support will be enabled for TensorFlow.
Do you wish to build TensorFlow with CUDA support? [y/N]: N
No CUDA support will be enabled for TensorFlow.
Do you wish to build TensorFlow with MPI support? [y/N]: N
No MPI support will be enabled for TensorFlow.
Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native]:
Add "--config=mkl" to your bazel command to build with MKL support.
Please note that MKL on MacOS or windows is still not supported.
If you would like to use a local MKL instead of downloading, please set the environment variable "TF_MKL_ROOT" every time before build.
Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: N
Not configuring the WORKSPACE for Android builds.