0

What the subject says.

I have a working Tensorflow installation via CUDA, CUDNN and pip. To examine a graph I followed a comment here which lead me to here, and accordingly I executed the command:

bazel build tensorflow/tools/graph_transforms:summarize_graph

Script kiddie that I am.

Ten minutes later I looked back at it and Bazel is furiously compiling C files with paths that look suspiciously like a source code checkout.

Is it actually compiling TF from source?!!!

Eric M
  • 1,027
  • 2
  • 8
  • 21

1 Answers1

1

Well yes, that is indeed what the bazel build command does.

If you look at the actual BUILD file (tensorflow/tools/graph_transform/BUILD) you'll see that it has its build rules and dependencies, which basically includes all the source code in that directory. The summarize_graph command's logic is included in those (you'll find that in summarize_graph_main.cc under the same directory).

You can follow the specific build rule to see what it does, or use a visualization tool. Here's what it looks like:

tf_cc_binary(
    name = "summarize_graph",
    copts = tf_copts(),
    linkstatic = 1,
    visibility = ["//visibility:public"],
    deps = [
        ":summarize_graph_main_lib",
    ],
)
Mat
  • 1,440
  • 1
  • 18
  • 38
  • Thanks, Mat. I never heard of Bazel until I started messing with TF. Were it a make system or cmake system I'd have known what I was looking at. – Eric M May 05 '19 at 23:34
  • 1
    Yeah I'm still a beginner at it too tbh, but having compiled TF a few times forced me to learn it a bit. Also btw you might want to take a look at the Python API to run such commands, you could avoid building the sources depending on what is supported etc. – Mat May 06 '19 at 00:46