我正在按照TensorFlow 'installing from sources' instructions的指示使用bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer
与Bazel建立TensorFlow。
我收到以下错误:
ERROR: /home/ubuntu/tensorflow/tensorflow/stream_executor/BUILD:5:1: C++ compilation of rule '//tensorflow/stream_executor:stream_e
xecutor' failed: crosstool_wrapper_driver_is_not_gcc failed: error executing command third_party/gpus/crosstool/clang/bin/crosstool
_wrapper_driver_is_not_gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter -Wno-fr
ee-nonheap-object ... (remaining 87 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exite
d with status 1.
tensorflow/stream_executor/cuda/cuda_dnn.cc: In function 'cudnnConvolutionFwdAlgo_t perftools::gputools::cuda::{anonymous}::ToConvF
orwardAlgo(perftools::gputools::dnn::AlgorithmType)':
tensorflow/stream_executor/cuda/cuda_dnn.cc:269:10: error: 'CUDNN_CONVOLUTION_FWD_ALGO_FFT' was not declared in this scope
case CUDNN_CONVOLUTION_FWD_ALGO_FFT:
...
Stack:运行Ubuntu 14.04.2的EC2 g2.8xlarge机器。 Bazel版本0.1.5(安装w bazel-0.1.5-jdk7-installer-linux-x86_64.sh
)。
我尝试过Bazel 0.1.4和0.2.3,我得到了同样的错误。
答案 0 :(得分:3)
我在Ubuntu 16.04中构建tensorflow也遇到了同样的问题。
首先确保您使用的是gcc版本< = 4.8
在我的情况下,我必须安装它:
对于gcc
sudo apt-get install gcc-4.8
sudo update-alternatives --remove-all gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
对于g ++
sudo apt-get install g++-4.8
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10
一旦拥有正确版本的gcc和g ++,我必须按如下方式编辑CROSSTOOL文件:
gedit tensorflow_sources_folder/third_party/gpus/crosstool/CROSSTOOL
搜索此特定行的每个发生点:
tool_path { name: "gcc" path: "clang/bin/crosstool_wrapper_driver_is_not_gcc" }
并在其正上方插入以下行:
cxx_flag: "-D_FORCE_INLINES"
所以结果必须是:
cxx_flag: "-D_FORCE_INLINES"
tool_path { name: "gcc" path: "clang/bin/crosstool_wrapper_driver_is_not_gcc" }