使用 bazel 构建 Tensorflow:包括 TensorRT 标头

问题描述 投票:0回答:1

我正在我的 EC2 实例上编译 TensorFlow 以启用本机指令集。我对 bazel 完全陌生,并且对如何配置构建感到不知所措。

我遇到的唯一问题是编译无法使用我放在 /usr/local/TensorRT-8.6.1.6 的本地安装的 TensorRT 中的标头

首先我尝试将 TensorRT-8.6.1.6/include 添加到 PATH 中,但没有成功。仍然找不到标题。

然后我尝试添加 bazel copt

-I/usr/lib/TensorRT-8.6.1.6/include
,它抱怨“引用了执行根之外的路径”。

最后我尝试将该目录符号链接到源代码内部并使用

-ITensorRT-8.6.1.6/include
,最新的错误是

this rule is missing dependency declarations for the following files included by 'tensorflow/compiler/tf2tensorrt/stub/nvinfer_stub.cc':
  'TensorRT-8.6.1.6/include/NvInferRuntimeBase.h'
  'TensorRT-8.6.1.6/include/NvInferVersion.h'
  'TensorRT-8.6.1.6/include/NvInferRuntimePlugin.h'

我不知道为什么链接到像 TensorRT 这样常见的张量流依赖项如此困难。我对 bazel 的了解不够,无法包含这些标头。

tensorflow gcc bazel tensorrt
1个回答
0
投票

您可以使用本地存储库规则,然后指向 /use ,然后将其用作tensorflow目标中的依赖项

© www.soinside.com 2019 - 2024. All rights reserved.