How to add external header files during bazel/tensorflow build -
i trying add external header file (like opencl header file) experimentation tensorflow. tried add build file under tensorflow/core/build file:
# includes implementations of kernels built tensorflow. cc_library( name = "all_kernels", visibility = ["//visibility:public"], copts = tf_copts() + ["-ithird_party/include"], <==== line added
i have created softlink in directory location of these header files opencl driver (under tensorflow/third_party) (like ln -s /opt/opencl/ ) still complains has not found header file.
if add external header file directly (like /opt/opencl/cl/) complains external files cannot included (or such thing).
i not have root password copy these header files /usr/include/ too.
can explain how external header files tensorflow building?
thanks quick help.
i've faced similar problem when built tensorflow intel mkl , had add mkl headers. solution following:
create symlink headers third_party folder, like:
<your tensorflow folder>/third_party/opencl/include -> /opt/opencl/include
with command:
ln -s /opt/opencl/include <your tensorflow folder>/third_party/opencl
create simple build file
<your tensorflow folder>/third_party/opencl
folder:cc_library( name = "opencl", hdrs = glob(["include/cl/*.h"]), visibility = ["//visibility:public"], )
add deps target library:
cc_library( name = "all_kernels", visibility = ["//visibility:public"], copts = tf_copts() + ["-ithird_party/opencl/include"], deps = [ "//third_party/opencl", ... ], )
don't forget add compiler options either target library shown above or flag bazel:
bazel build --copt="-ithird_party/opencl/include" ...
Comments
Post a Comment