python - 编译支持GPU的Tensorflow时,遇到CUDA_TOOLKIT_PATH未绑定(bind)变量

标签 python c++ tensorflow bazel

我正在关注 this link编译支持 GPU 的 Tensorflow。在 ./configure 之后,我输入 bazel build --config=opt --config=cuda//tensorflow/tools/pip_package:build_pip_package。在编译过程中,我看到以下错误。

ERROR: /home/super/.cache/bazel/_bazel_super/6fad3aac5da8510114d7933cea773172/external/nccl_archive/BUILD.bazel:139:1: Executing genrule @nccl_archive//:device_code_fatbin_h failed (Exit 1)
/bin/bash: CUDA_TOOLKIT_PATH: unbound variable
Target //tensorflow/tools/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.973s, Critical Path: 0.12s
INFO: 4 processes: 4 local.
FAILED: Build did NOT complete successfully

我检查了 .tf_configure.bazelrc 文件并定义了 CUDA_TOOLKIT_PATH

build --action_env PYTHON_BIN_PATH="/home/super/anaconda3/envs/tf/bin/python"
build --action_env PYTHON_LIB_PATH="/home/super/anaconda3/envs/tf/lib/python3.6/site-packages"
build --python_path="/home/super/anaconda3/envs/tf/bin/python"
build:xla --define with_xla_support=true
build --config=xla
build --action_env TF_NEED_OPENCL_SYCL="0"
build --action_env TF_NEED_ROCM="0"
build --action_env TF_NEED_CUDA="1"
build --action_env CUDA_TOOLKIT_PATH="/usr/local/cuda"
build --action_env TF_CUDA_VERSION="10.0"
build --action_env CUDNN_INSTALL_PATH="/usr/local/cuda-10.0"
build --action_env TF_CUDNN_VERSION="7"
build --action_env TF_NCCL_VERSION=""
build --action_env TF_CUDA_COMPUTE_CAPABILITIES="5.2"
build --action_env LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64"
build --action_env TF_CUDA_CLANG="0"
build --action_env GCC_HOST_COMPILER_PATH="/usr/bin/gcc"
build --config=cuda
test --config=cuda
build:opt --copt=-march=native
build:opt --copt=-Wno-sign-compare
build:opt --host_copt=-march=native
build:opt --define with_default_optimizations=true
build:v2 --define=tf_api_version=2

我的 .bashrc 有以下内容。

export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/loca/cuda
export CUDA_TOOLKIT_PATH=/usr/local/cuda

我的环境设置如下。

  • 巴泽尔 0.18.0
  • CUDA 10.0
  • cuDNN 7.3.1
  • Ubuntu 16.04

对发生的事情有什么想法吗?

最佳答案

我的假设是您正在尝试直接从 master 分支进行编译。我早些时候遇到了同样的问题,但在查看已发布的版本 (v1.12.0-rc2) 后,我能够毫无问题地编译 TensorFlow。尝试 git checkout v1.12.0-rc2 然后再次运行 ./configure 和 bazel 编译。主分支更新非常频繁。我的想法是,在我们尝试安装时构建已损坏。

关于python - 编译支持GPU的Tensorflow时,遇到CUDA_TOOLKIT_PATH未绑定(bind)变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53076293/

相关文章:

python - 关于 sympy.printing.mathml 中的括号错误

python - Groupby 来自另一个(相同行数)数据框的列

c++ - 如何正确地将参数从结构传递给函数?

c++ - 在 C++ 中将值与自然数进行比较

python - 你如何使用 TensorFlow Graphkeys 获取所有权重?

python - 使用更快的 RCNN Inception Resnet 进行迁移学习 |为什么在第一个检查点之后的每个步骤都会保存新的检查点?

python - 如何获取 CountVectorizer feature_names 以便设置它们,而不是按字母顺序排列?

C++:我应该将构造函数主体中分配给的指针成员初始化为 NULL 吗?

Tensorflow - 多 GPU 不适用于模型(输入)或计算梯度

python - Pandas 条形图切断了x轴的两端