错误建设tensorflow与cazu支持窗口与bazel
问题描述:
我想通过bazel编译Windows 10 64位CUDA支持TensorFlow。 这是我的系统是如何设置:错误建设tensorflow与cazu支持窗口与bazel
- 的Windows 10 64位
- 的Nvidia GeForce 1050与CUDA功能6.1
- CUDA工具包8.0 - >
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
- cuDNN V6.0 - >
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
- 巴泽勒0.7.0(更名为bazel.exe) - >
C:\Users\eliam\bazel\0.7.0
- MSYS2 64
- 十sorFlow主分支 - >
C:\Users\eliam\tensorflow
我也已经设置这些环境变量:
BAZEL_PYTHON=C:/Users/eliam/Miniconda3
BAZEL_SH=C:/msys64/usr/bin/bash.exe
BAZEL_VC=C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC
BAZEL_VS=C:/Program Files (x86)/Microsoft Visual Studio 14.0
CUDA_PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0
CUDA_TOOLKIT_PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0
LD_LIBRARY_PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/lib/x64
PYTHON_BIN_PATH=C:/Users/eliam/Miniconda3/python.exe
PYTHON_PATH=C:/Users/eliam/Miniconda3/python.exe
PYTHONPATH=C:/Users/eliam/Miniconda3/python.exe
PYTHON_LIB_PATH=C:/Users/eliam/Miniconda3/lib/site-packages
PATH=C:\Users\eliam\bazel\0.7.0;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include;%PATH%
巴泽勒设置了(https://docs.bazel.build/versions/master/install-windows.html)通过其网站所需要的所有步骤
MSYS2是(http://www.msys2.org/)
我设法完成了configure.py,没有问题。
python ./configure.py
You have bazel 0.7.0 installed.
Do you wish to build TensorFlow with XLA JIT support? [y/N]:
No XLA JIT support will be enabled for TensorFlow.
Do you wish to build TensorFlow with GDR support? [y/N]:
No GDR 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 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: 3.5,5.2]
Do you wish to build TensorFlow with MPI support? [y/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.
Configuration finished
之后,我设置一些其他的环境变量用下面的命令:
set BUILD_OPTS='--cpu=x64_windows_msvc --host_cpu=x64_windows_msvc --copt=/w --verbose_failures --experimental_ui --config=cuda'
为了防止这种错误
$ bazel build -c opt --config=cuda --verbose_failures --subcommands //tensorflow/cc:tutorials_example_trainer
..............
WARNING: The lower priority option '-c opt' does not override the previous value '-c opt'.
____Loading package: tensorflow/cc
____Loading package: @local_config_cuda//crosstool
____Loading package: @local_config_xcode//
ERROR: No toolchain found for cpu 'x64_windows'. Valid cpus are: [
k8,
piii,
arm,
darwin,
ppc,
].
____Elapsed time: 10.196s
然后我开始巴泽勒构建,使用下面的命令
bazel build -c opt $BUILD_OPTS //tensorflow/tools/pip_package:build_pip_package
这是问题出现的地方。这是完整日志的link。
任何想法为什么?
答
日志的重要组成部分,是这样的:
ERROR: C:/msys64/home/eliam/tensorflow/tensorflow/stream_executor/BUILD:52:1: C++ compilation of rule '//tensorflow/stream_executor:cuda_platform' failed (Exit 2).
tensorflow/stream_executor/cuda/cuda_platform.cc(48): error C3861: 'strcasecmp': identifier not found
tensorflow/stream_executor/cuda/cuda_platform.cc(50): error C3861: 'strcasecmp': identifier not found
tensorflow/stream_executor/cuda/cuda_platform.cc(52): error C3861: 'strcasecmp': identifier not found
Target //tensorflow/cc:tutorials_example_trainer failed to build
tensorflow/stream_executor/cuda/cuda_platform.cc(48)有strcmp
在里面。
编译器抱怨strcasecmp
,因此东西必须是#define
'strcmp
到strcasecmp
。无论如何,你可以用--verbose_failures
来运行这个版本吗?这将显示Bazel正在执行的命令。这可能暗示发生了什么。
而且,我看到这个在你的envvars中:
BAZEL_VC=C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC
BAZEL_VS=C:/Program Files (x86)/Microsoft Visual Studio 14.0
你只需要设置的其中之一。我建议保留BAZEL_VC
,因为它指向更新的编译器。我承认,当两种环境都被定义时,我不知道会发生什么,无论Bazel是否喜欢另一个。但我知道只有其中之一定义它可以正常工作。
'--cpu = x64_windows_msvc'和'错误:找不到找到cpu'x64_windows'的工具链' – talonmies
'这个错误已经用'set BUILD_OPTS ='解决了 - cpu = x64_windows_msvc --host_cpu = x64_windows_msvc --copt =/w --verbose_failures --experimental_ui --config = cuda',正如我在文章中所说的。 错误我不明白为什么发生的是帖子的最后一行(有一个链接到整个日志) – ParKein
@talonmies你能解释一下你的意思吗? – ParKein