如何在tensorflow上编译教程程序

how to compile the tutorial program on tensorflow

配置tensorflow后,我尝试运行命令 bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer

但是出现了一个错误,我想尽一切办法都没有解决。

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

注意:我已经安装了CUDA8.0、cuDNN 5.0和Bazel 0.6.0,我的系统是Ubuntu 16.04.

似乎已经有针对此问题的问题:https://github.com/tensorflow/tensorflow/issues/11859。最后一条评论说这个问题可以通过编辑 tensorflow/third_party/gpus/cuda_configure.bzl 中的第 120 行来解决。如果这没有帮助,我会订阅这个问题并等待修复。