tensorflow serving GPU编译问题

编译gpu版本:bazel build -c opt --config=cuda --spawn_strategy=standalone //tensorflow_serving/model_servers:tensorflow_model_server

 

编译cpu版本:bazel build //tensorflow_serving/model_servers:tensorflow_model_server

问题1:

ERROR: no such target '@org_tensorflow//third_party/gpus/crosstool:crosstool': target 'crosstool' not declared in package 'third_party/gpus/crosstool' defined by /home/username/.cache/bazel/_bazel_jorge/2fd988219920b10e9ede8d3b5720f3d2/external/org_tensorflow/third_party/gpus/crosstool/BUILD.

解决:

 1 export TF_NEED_CUDA=1
 2 export TF_NEED_GCP=1
 3 export TF_NEED_JEMALLOC=1
 4 export TF_NEED_HDFS=0
 5 export TF_NEED_OPENCL=0
 6 export TF_ENABLE_XLA=0
 7 export TF_CUDA_VERSION=8.0
 8 export TF_CUDNN_VERSION=5
 9 export TF_CUDA_COMPUTE_CAPABILITIES="3.5,5.2,6.1"
10 export CUDA_TOOLKIT_PATH="/usr/local/cuda"
11 export CUDNN_INSTALL_PATH="/usr/local/cuda"
12 export GCC_HOST_COMPILER_PATH="/usr/bin/gcc"
13 export PYTHON_BIN_PATH="/home/opt/anaconda/envs/py2/bin/python"
14 export CC_OPT_FLAGS="-march=native"
15 export PYTHON_LIB_PATH="/home/opt/anaconda/envs/py2/lib/python2.7/site-packages"
16 
17 cd tensorflow
18 ./configure
19 cd ..
20 
21 # Ref: https://github.com/tensorflow/serving/issues/318#issuecomment-283498443
22 sed -i.bak 's/@org_tensorflow\/\/third_party\/gpus\/crosstool/@local_config_cuda\/\/crosstool:toolchain/g' tools/bazel.rc
23 
24 bazel build -c opt --config=cuda --spawn_strategy=standalone //tensorflow_serving/model_servers:tensorflow_model_server

详情:https://github.com/tensorflow/serving/issues/318

你可能感兴趣的:(tensorflow serving GPU编译问题)