我正在尝试在Windows7 64位上构建张量流以加速CPU计算(SSE,AVX)。我正在使用bazel和msys64进行构建和配置:
(intel35) c:\Projects\Atari\tensorflow>bash ./configure
You have bazel 0.7.0 installed.
Please specify the location of python. [Default is E:\Programs\Anaconda3\envs\intel35\python.exe]:
Do you wish to build TensorFlow with XLA JIT support? [y/N]: n
Do you wish to build TensorFlow with GDR support? [y/N]: n
Do you wish to build TensorFlow with VERBS support? [y/N]: n
Do you wish to build TensorFlow with CUDA support? [y/N]: n
Do you wish to build TensorFlow with MPI support? [y/N]: n
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.
Configuration finished
之后我用bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
构建了一个脚本,最后得到一个错误:
ERROR: C:/users/denis/appdata/local/temp/_bazel_denis/wkdcwyhr/external/protobuf_archive/BUILD:656:1: C++ compilation of rule '@protobuf_archive//:python/google/protobuf/internal/_api_implementation.so' failed (Exit 1).
C:\users\denis\appdata\local\temp\_bazel_denis\wkdcwyhr\execroot\org_tensorflow\external\protobuf_archive\python\google\protobuf\internal\api_implementation.cc
: fatal error C1083: Cannot open compiler generated file: '': Invalid argument
cl : Command line warning D9002 : ignoring unknown option '-march=native'
cl : Command line warning D9002 : ignoring unknown option '-march=native'
____Building complete.
Target //tensorflow/tools/pip_package:build_pip_package failed to build
出了什么问题?也许我应该使用其他一些配置选项?
答案 0 :(得分:3)
TensorFlow使用以下脚本在Windows上使用Bazel进行构建和测试: tensorflow/tools/ci_build/windows/cpu/pip/build_tf_windows.sh
设置基本上是:
运行./configure
bazel build -c opt --config=monolithic --copt=-w --host_copt=-w --verbose_failures tensorflow/tools/pip_package:build_pip_package
对于Cannot open compiler generated file: '': Invalid argument
错误,您很有可能在Windows上达到260个字符的路径限制。
请将TMPDIR
设置为较短的路径,例如C:/tmp
。它将取代C:/users/denis/appdata/local/temp
,并有望缓解长路径问题。