tensorflow: cuda/cuda_config.h missing when compiling custom ops with nvcc

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes, see below.
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 16.04
  • TensorFlow installed from (source or binary): Source
  • TensorFlow version (use command below): v1.3.0-0-g9e76bf324 1.3.0
  • Python version: 3.5.2
  • Bazel version (if compiling from source): 0.5.4
  • CUDA/cuDNN version: 8.0.44 / 5.1.5
  • GPU model and memory: Any.
  • Exact command to reproduce: See below.

Describe the problem

When compiling a custom op using nvcc, which includes tensorflow/core/util/cuda_kernel_helper.h, I get the following error:

/usr/local/cuda-8.0/bin/nvcc -c -o ~/Code/libspn/build/ops/gather_columns_functor_gpu.cu.cc.o ~/Code/libspn/libspn/ops/gather_columns_functor_gpu.cu.cc -std=c++11 -x=cu -Xcompiler -fPIC -DGOOGLE_CUDA=1 --expt-relaxed-constexpr -I ~/.local/lib/python3.5/site-packages/tensorflow/include -gencode=arch=compute_35,"code=sm_35,compute_35" -gencode=arch=compute_52,"code=sm_52,compute_52" -gencode=arch=compute_61,"code=sm_61,compute_61"
In file included from ~/.local/lib/python3.5/site-packages/tensorflow/include/tensorflow/core/platform/default/stream_executor.h:26:0,
                 from ~/.local/lib/python3.5/site-packages/tensorflow/include/tensorflow/core/platform/stream_executor.h:24,
                 from ~/.local/lib/python3.5/site-packages/tensorflow/include/tensorflow/core/util/cuda_kernel_helper.h:26,
                 from ~/Code/libspn/libspn/ops/gather_columns_functor_gpu.cu.h:11,
                 from ~/Code/libspn/libspn/ops/gather_columns_functor_gpu.cu.cc:5:
~/.local/lib/python3.5/site-packages/tensorflow/include/tensorflow/stream_executor/dso_loader.h:32:30: fatal error: cuda/cuda_config.h: No such file or directory
compilation terminated.

Copying cuda_config.h to /site-packages/tensorflow/include/tensorflow/stream_executor/cuda solves the problem.

The same issue has been observed by several other users in #6602 (see the comments added after the issue was closed).

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 23 (6 by maintainers)

Most upvoted comments

I also encounter this problem in TF 1.4.0, any clue ?

I also encounter the same problem in TF 1.3.0. This error is introduced with #include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" /usr/local/lib/python3.5/dist-packages/tensorflow/include/tensorflow/stream_executor/dso_loader.h:32:30: fatal error: cuda/cuda_config.h: No such file or directory

@Queequeg92 I have it working under v1.5rc0 now, see https://github.com/cgtuebingen/tf_custom_op which requires installing from source or copying the cuda_config.h from #15002.