简体   繁体   中英

How to compile tensorflow to link already compiled grpc library using bazel?

I cloned tensorflow (version 1.2) from github repo. I am having some problem with grpc in distributed tensorflow. Basically I want to compile tensorflow (1.2) with latest grpc library.

I downloaded and compiled grpc library so I have library files and the headers. How do I instruct bazel to take this already compiled library files and headers, while building tensorflow.

There's no easy way. If I were to do this, I'd clone tensorflow, and update tensorflow/workspace.bzl to pull newer grpc version, or replace patched_http_archive with new_local_repository or new_http_archive . I assume you'd need to apply the patch from third_party/grpc . Then you should be able to build tensorflow using default procedure: ./configure , and bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package .

Quickly scanning through tensorflow BUILD files it seems tensorflow uses third_party dependencies of grpc (eg nanopb ), so having a compiled library and headers wouldn't be enought anyway. If you insisted on using your prebuilt grpc, you'd need to provide these dependencies, and update BUILD files and WORKSPACE file. Bazel doesn't have this feature 'replace repository with its outputs' built-in yet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM