You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CUDA headers not found when implementing GPU kernel for user-op #375
I am following the tutorial to implement a user-op. I have three files dna_encode_op.cc, dna_encode_op_gpu.cu.cc, and dna_encode_op.h.
I have configured TensorFlow with GPU support using ./configure. However, during compilation of dna_encode_op_gpu.cu.cc, Bazel doesn't find the CUDA headers:
INFO: From Compiling tensorflow/core/user_ops/dna_encode_op_gpu.cu.cc [for host]:
In file included from ./tensorflow/core/framework/tensor_types.h:4:0,
from tensorflow/core/user_ops/dna_encode_op_gpu.cu.cc:8:
./third_party/eigen3/unsupported/Eigen/CXX11/Tensor:55:18: fatal error: cuda.h: No such file or directory
#include <cuda.h>
^
compilation terminated.
ERROR: /home/hannes/git/DNAflow_internal/tensorflow/core/BUILD:339:1: C++ compilation of rule '//tensorflow/core:user_ops_op_lib' failed: crosstool_wrapper_driver_is_not_gcc failed: error executing command third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object ... (remaining 50 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
Building the included ops works well, so I'm wondering whether I have to modify BUILD - however, there is no mention of this in the tutorials.
Btw, I discovered that when I move my files from user_ops/ to kernels/ they compile fine. So it seems BUILD is using different rules for user_ops/ and kernels/, with the CUDA headers not being included for user ops.
Thanks for the report -- we're trying to figure out a better solution to custom ops than the user_ops directory, and in doing so should hopefully address these cuda header issues.
The instructions work fine for CPU-only ops, but seem to be insufficient for building an op with a GPU kernel. A slightly modified BUILD works fine though (for GPU-only kernels):
I think it would be great to have a bit more details in the docs, and maybe even have a bazel rule for building custom ops, similar to tf_kernel_library().
@hannes-brt hi, I encountered similar issues when I want to add a custom op which is implemented on GPU. You said it works when you copies these files from user_ops to kernels. Did you just copy the .h,.cc,.cu.cc to tensorflow/cores/kernels or did you also add build target in tensorflow/cores/kernels/BUILD?
Activity
hannes-brt commentedon Dec 1, 2015
Btw, I discovered that when I move my files from
user_ops/tokernels/they compile fine. So it seemsBUILDis using different rules foruser_ops/andkernels/, with the CUDA headers not being included for user ops.vrv commentedon Dec 1, 2015
Thanks for the report -- we're trying to figure out a better solution to custom ops than the user_ops directory, and in doing so should hopefully address these cuda header issues.
keveman commentedon Feb 9, 2016
I added instructions for building ops and kernels outside of TensorFlow source tree. Please have a look to see if it fits your need.
vrv commentedon Feb 19, 2016
(Reopen if this new feature isn't working as expected)
psycharo-zz commentedon Mar 9, 2016
The instructions work fine for CPU-only ops, but seem to be insufficient for building an op with a GPU kernel. A slightly modified
BUILDworks fine though (for GPU-only kernels):I think it would be great to have a bit more details in the docs, and maybe even have a bazel rule for building custom ops, similar to
tf_kernel_library().stomachacheGE commentedon May 29, 2019
@hannes-brt hi, I encountered similar issues when I want to add a custom op which is implemented on GPU. You said it works when you copies these files from
user_opstokernels. Did you just copy the.h,.cc,.cu.cctotensorflow/cores/kernelsor did you also add build target intensorflow/cores/kernels/BUILD?Merge pull request tensorflow#375 from ROCmSoftwarePlatform/dockerfil…
Update XNNPACK and related dependencies
Update XNNPACK and related dependencies
Update XNNPACK and related dependencies
Update XNNPACK and related dependencies
Update XNNPACK and related dependencies
Update XNNPACK and related dependencies
Update XNNPACK and related dependencies
Update XNNPACK and related dependencies
Update XNNPACK and related dependencies
Update XNNPACK and related dependencies
Update XNNPACK and related dependencies