Search code examples
tensorflowbazeltensorboard

how to compile the tutorial program on tensorflow


After configuring the tensorflow, I tried to run the command bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer

But an error occured which I tried every possible but failed to solve.

ERROR: Skipping '//tensorflow/cc:tutorials_example_trainer': error loading package 'tensorflow/cc': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):

File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 1042 _create_local_cuda_repository(repository_ctx)

File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 975, in _create_local_cuda_repository _host_compiler_includes(repository_ctx, cc)

File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 145, in _host_compiler_includes get_cxx_inc_directories(repository_ctx, cc)

File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 120, in get_cxx_inc_directories set(includes_cpp)

The set constructor for depsets is deprecated and will be removed. Please use the depset constructor instead. You can temporarily enable the deprecated set constructor by passing the flag --incompatible_disallow_set_constructor=false

WARNING: Target pattern parsing failed.

ERROR: error loading package 'tensorflow/cc': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):

File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 1042 _create_local_cuda_repository(repository_ctx)

File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 975, in _create_local_cuda_repository _host_compiler_includes(repository_ctx, cc)

File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 145, in _host_compiler_includes get_cxx_inc_directories(repository_ctx, cc)

File "/home/manyz/tensorflow/third_party/gpus/cuda_configure.bzl", line 120, in get_cxx_inc_directories set(includes_cpp)

The set constructor for depsets is deprecated and will be removed. Please use the depset constructor instead. You can temporarily enable the deprecated set constructor by passing the flag --incompatible_disallow_set_constructor=false

INFO: Elapsed time: 2.293s

FAILED: Build did NOT complete successfully (0 packages loaded) currently loading: tensorflow/cc

Note that: I've installed the CUDA8.0, cuDNN 5.0 and Bazel 0.6.0, My system is Ubuntu 16.04.


Solution

  • It seems there is already an issue open for this problem: https://github.com/tensorflow/tensorflow/issues/11859. Last comment says that the issue can be fixed by editing line 120 in tensorflow/third_party/gpus/cuda_configure.bzl. If that doesn't help I'd subscribe to the issue and wait for a fix.