3
votes

I'm trying to compile a sample program which uses Tensorflow core, with CUDA support on Windows 10 64bit via Bazel on the following environments:

  • Windows 10 64 bit
  • CUDA Toolkit 9.0
  • CUDNN 9.0
  • Tensorflow 1.9
  • Bazel 0.16

I went through the configure.py successfully, I added the CUDA and the CUDNN location.

This is my Bazel BUILD file:

cc_binary(
  name = "mnistpredict.dll",
  srcs = ["mnist.cc", "MNIST.h"],
  deps = [
      "//tensorflow/core:tensorflow",
  ],
  linkshared=1
)

I try to compile with this command: bazel build //tensorflow/loadgraph:mnistpredict.dll

ERROR: C:/users/laci/downloads/tensorflow-1.9.0/tensorflow/loadgraph/BUILD:1:1: error loading package 'tensorflow/core': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last): File "C:/users/laci/downloads/tensorflow-1.9.0/third_party/gpus/cuda_configure.bzl", line 1166 _create_local_cuda_repository(repository_ctx) File "C:/users/laci/downloads/tensorflow-1.9.0/third_party/gpus/cuda_configure.bzl", line 995, in _create_local_cuda_repository _get_cuda_config(repository_ctx) File "C:/users/laci/downloads/tensorflow-1.9.0/third_party/gpus/cuda_configure.bzl", line 750, in _get_cuda_config _cudnn_version(repository_ctx, cudnn_install_base..., ...) File "C:/users/laci/downloads/tensorflow-1.9.0/third_party/gpus/cuda_configure.bzl", line 466, in _cudnn_version find_cuda_define(repository_ctx, cudnn_header_dir, "c...", ...) File "C:/users/laci/downloads/tensorflow-1.9.0/third_party/gpus/cuda_configure.bzl", line 422, in find_cuda_define auto_configure_fail(("Error reading %s: %s" % (str(h...))) File "C:/users/laci/downloads/tensorflow-1.9.0/third_party/gpus/cuda_configure.bzl", line 210, in auto_configure_fail fail(("\n%sCuda Configuration Error:%...)))

Cuda Configuration Error: Error reading C:/Users/laci/Downloads/cudnn-9.0-windows10-x64-v7.1/cuda/include/cudnn.h: java.io.IOException: ERROR: src/main/native/windows/processes-jni.cc(239): CreateProcessW("grep" --color=never -A1 -E "#define CUDNN_MAJOR" C:/Users/laci/Downloads/cudnn-9.0-windows10-x64-v7.1/cuda/include/cudnn.h): The system cannot find the file specified.

and referenced by '//tensorflow/loadgraph:mnistpredict.dll' ERROR: Analysis of target '//tensorflow/loadgraph:mnistpredict.dll' failed; build aborted: Analysis failed INFO: Elapsed time: 1.612s INFO: 0 processes. FAILED: Build did NOT complete successfully (2 packages loaded) currently loading: tensorflow/core

When I try it without CUDA support, I can compile it successfully.

1

1 Answers

2
votes

It was looking for grep.exe under %PATH% but failed. Either adding Git\bin to %PATH% or install grep for Windows will do the trick.

It had taken me several days to finally build a tensorflow-gpu 1.10 whl on Windows 7 64 bit with bazel + msys2.