Building Executable Files

Perform the following operations as the ATC installation user:

  1. Download the TensorFlow source code from https://github.com/tensorflow/tensorflow/archive/v1.15.0.tar.gz and upload it to any directory on the Linux server where ATC is located.
  2. Log in to the Linux server, switch to the path of the TensorFlow source code, and decompress the source package with the following command.
    tar -zxvf tensorflow-1.15.0.tar.gz
  3. Go to the extracted tensorflow-1.15.0 directory and install the patch.
    Obtain xlacompile.patch by following How Do I Obtain xlacompile.patch? Then, upload the patch to the tensorflow-1.15.0 directory on the Linux server and install the patch with the following command.
    patch -p1 < xlacompile.patch
  4. Switch to the tensorflow-1.15.0 directory and compile the xlacompile tool with the following command.
    bazel build --config=monolithic //tensorflow/compiler/aot:xlacompile

    It takes about 10 minutes to compile the tool. If you see information similar to the following displayed, your compilation is successful. If not, rectify the fault by referring to What Do I Do If "An error occurred during the fetch of repository 'io_bazel_rules_docker'" Is Displayed When Bazel Is Used?

    Target //tensorflow/compiler/aot:xlacompile up-to-date:
      bazel-bin/tensorflow/compiler/aot/xlacompile
    INFO: Elapsed time: 214.550s, Critical Path: 73.38s
    INFO: 1511 processes: 1511 local.
    INFO: Build completed successfully, 1513 total actions

    After successful compilation, you will find the executable file xlacompile in $HOME/.cache/bazel/_bazel_test/abd37aaac8a380ca5a3f13938322fcb2/external/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/compiler/aot. The path is for reference only.

    You can use the xlacompile executable file to convert a network with control flow operators into a network with function operators.

  5. Switch to the tensorflow-1.15.0 directory and compile the summarize_graph tool with the following command.
    bazel build --config=monolithic -c opt //tensorflow/tools/graph_transforms:summarize_graph

    If you see information similar to the following displayed, your compilation is successful.

    Target //tensorflow/tools/graph_transforms:summarize_graph up-to-date:
      bazel-bin/tensorflow/tools/graph_transforms/summarize_graph
    INFO: Elapsed time: 70.474s, Critical Path: 53.16s
    INFO: 1028 processes: 1028 local.
    INFO: Build completed successfully, 1053 total actions

    After successful compilation, you will find the executable file summarize_graph in $HOME/.cache/bazel/_bazel_test/abd37aaac8a380ca5a3f13938322fcb2/execroot/org_tensorflow/bazel-out/k8-opt/bin/tensorflow/tools/graph_transforms. The path is for reference only.

    You can use the executable file summarize_graph to view the input and output nodes of the network with control flow operators and construct the input and output configuration file config.pbtxt.