Created
November 5, 2017 14:45
-
-
Save fo40225/67cb3e83e4abd9d3a4798d5a6d643a55 to your computer and use it in GitHub Desktop.
tensorflow 1.3.0 on windows with avx2 & cuda by bazel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tensorflow 1.3.0 on windows with avx2 & cuda by bazel | |
win 10 1703 | |
msys2-x86_64-20161025.exe | |
anaconda3 4.4.0 | |
visual studio 2015 update 3 with c++ installed | |
cuda 8.0.61 | |
cudnn 6 | |
bazel 0.5.3 (C:\msys64\usr\bin\bazel.exe) | |
use "MSYS2 MSYS" shell | |
pacman -S git curl zip unzip patch | |
==== get source code ==== | |
git clone https://github.com/tensorflow/tensorflow.git -b v1.3.1 | |
// need those fix | |
https://github.com/tensorflow/tensorflow/pull/13525 | |
#undef ERROR | |
tensorflow\stream_executor\cuda\cuda_gpu_executor.cc:66 | |
tensorflow\core\common_runtime\gpu\gpu_tracer.cc:32 | |
https://github.com/tensorflow/tensorflow/issues/9470#issuecomment-298009422 | |
https://github.com/tensorflow/tensorflow/issues/9470#issuecomment-298352973 | |
https://github.com/tensorflow/tensorflow/pull/11901#discussion-diff-130701557L106 | |
remove fused_batch_norm_op from BUILD | |
== or == | |
git clone https://github.com/fo40225/tensorflow.git -b v1.3.1-bazel-windows-fix | |
cd tensorflow | |
# need remove "bash on Ubuntu on Windows" | |
export PYTHON_BIN_PATH="/c/Users/User/Anaconda3/python.exe" | |
export PYTHON_LIB_PATH="/c/Users/User/Anaconda3/lib/site-packages" | |
export BAZEL_PYTHON="/c/Users/User/Anaconda3/python.exe" | |
export BAZEL_SH="/c/msys64/usr/bin/bash.exe" | |
export PATH="/c/Users/User/Anaconda3:$PATH" | |
export PATH="/c/Users/User/Anaconda3/Scripts:$PATH" | |
./configure | |
You have bazel 0.5.3 installed. | |
Do you wish to build TensorFlow with MKL support? [y/N] | |
No MKL 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]: /arch:AVX2 | |
Do you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N] | |
No XLA support will be enabled for TensorFlow | |
Do you wish to build TensorFlow with VERBS support? [y/N] | |
No VERBS support will be enabled for TensorFlow | |
Do you wish to build TensorFlow with CUDA support? [y/N] Y | |
CUDA support will be enabled for TensorFlow | |
Please specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to default to CUDA 8.0]: | |
Please specify the location where CUDA 8.0 toolkit is installed. Refer to README.md for more details. [Default is C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0]: | |
Please specify the cuDNN version you want to use. [Leave empty to default to cuDNN 6.0]: | |
Please specify the location where cuDNN 6 library is installed. Refer to README.md for more details. [Default is C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0]: | |
Please specify a list of comma-separated Cuda compute capabilities you want to build with. | |
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus. | |
Please note that each additional compute capability significantly increases your build time and binary size. | |
[Default is: "6.1"]: | |
Do you wish to build TensorFlow with MPI support? [y/N] | |
MPI support will not be enabled for TensorFlow | |
Configuration finished | |
# bazel build --config=opt --keep_going --verbose_failures --action_env=USE_MSVC_WRAPPER=1 //tensorflow/tools/pip_package:build_pip_package | |
# bazel build --jobs 1 --config=opt --verbose_failures --action_env=USE_MSVC_WRAPPER=1 //tensorflow/tools/pip_package:build_pip_package | |
bazel build --config=opt --verbose_failures --action_env=USE_MSVC_WRAPPER=1 //tensorflow/tools/pip_package:build_pip_package | |
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg | |
pip install /tmp/tensorflow_pkg/tensorflow-1.3.1-cp36-cp36m-win_amd64.whl | |
python | |
import tensorflow as tf | |
node1 = tf.constant(3.0, dtype=tf.float32) | |
node2 = tf.constant(4.0) | |
sess = tf.Session() | |
print(sess.run([node1, node2])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment