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:

  1. 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 
  2. create simple build file <your tensorflow folder>/third_party/opencl folder:

    cc_library(     name = "opencl",     hdrs = glob(["include/cl/*.h"]),     visibility = ["//visibility:public"], ) 
  3. add deps target library:

    cc_library(     name = "all_kernels",     visibility = ["//visibility:public"],     copts = tf_copts() + ["-ithird_party/opencl/include"],     deps = [         "//third_party/opencl",          ...     ], ) 
  4. don't forget add compiler options either target library shown above or flag bazel:

     bazel build --copt="-ithird_party/opencl/include" ... 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -