Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TensorFlow Bazel build failing

I'm building TensorFlow with Bazel using bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer as instructed to by the TensorFlow 'installing from sources' instructions.

I get the following error:

    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: EC2 g2.8xlarge machine running Ubuntu 14.04.2. Bazel version 0.1.5 (installed w/ bazel-0.1.5-jdk7-installer-linux-x86_64.sh).

I've tried Bazel 0.1.4 and 0.2.3 and I get the same error.

like image 366
rafaelcosman Avatar asked May 19 '16 02:05

rafaelcosman


1 Answers

I had the same issue building tensorflow in Ubuntu 16.04.

First of all ensure that you are using gcc version <= 4.8

In my case I had to install it doing:

For 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

For 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

Once having the right version of gcc and g++, I had to edit the CROSSTOOL file as follows:

gedit tensorflow_sources_folder/third_party/gpus/crosstool/CROSSTOOL

Search every ocurrence of this specific line:

tool_path { name: "gcc" path: "clang/bin/crosstool_wrapper_driver_is_not_gcc" }

And insert the following line exactly above it:

cxx_flag: "-D_FORCE_INLINES"

So the result must be:

cxx_flag: "-D_FORCE_INLINES"
tool_path { name: "gcc" path: "clang/bin/crosstool_wrapper_driver_is_not_gcc" }
like image 169
Martinez Mariano Avatar answered Nov 02 '22 10:11

Martinez Mariano