Tensorflow r1.12及tensorflow serving r1.12 GPU版本编译遇到的问题

1、git clone tensorflow serving 及tensorflow代码

2、

ERROR: /root/.cache/bazel/_bazel_root/f71d782da17fd83c84ed6253a342a306/external/local_config_cuda/crosstool/BUILD:4:1:
 Traceback (most recent call last):
        File "/root/.cache/bazel/_bazel_root/f71d782da17fd83c84ed6253a342a306/external/local_config_cuda/crosstool/BUILD", line 4
                error_gpu_disabled()
        File "/root/.cache/bazel/_bazel_root/f71d782da17fd83c84ed6253a342a306/external/local_config_cuda/crosstool/error_gpu_disabled.bzl", line 3, in error_gpu_disabled
                fail("ERROR: Building with --config=c...")
ERROR: Building with --config=cuda but TensorFlow is not configured to build with GPU support. Please re-run ./configure and enter 'Y' at the prompt to build with GPU support.
ERROR: no such target '@local_config_cuda//crosstool:toolchain': target 'toolchain' not declared in package 'crosstool
' defined by /root/.cache/bazel/_bazel_root/f71d782da17fd83c84ed6253a342a306/external/local_config_cuda/crosstool/BUILD
INFO: Elapsed time: 0.093s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

解决办法:

export TF_NEED_CUDA="1"

3、看起来./configure配置全部不能生效,因此需要自己配置变量指引cuda、cudnn、nccl等所有的非默认路径

解决办法:通过变量设置

export PATH=$PATH:/env/bazel-0.15.0/bin
export TF_NEED_CUDA="1"
export CUDNN_INSTALL_PATH="/usr/local/cudnn7.3_cuda9.0"
export CUDA_INSTALL_PATH="/usr/local/cuda-9.0"
export TF_CUDA_VERSION="9.0"
export TF_CUDNN_VERSION="7"
export TF_NCCL_VERSION="2.2"
export NCCL_INSTALL_PATH="/env/nccl_2.2.13-1+cuda9.0_x86_64"
export TEST_TMPDIR=/home

失败,遇到nvcc检测cuda版本与设置不一致的问题。最后放弃,转而r1.13

猜你喜欢

转载自www.cnblogs.com/zl1991/p/11465111.html