Populate TF_TENSORRT_VERSION during configuration process.
PiperOrigin-RevId: 254059615
This commit is contained in:
parent
c3f3aa8c9a
commit
f9c8169d8f
@ -202,6 +202,7 @@ tensorflow/third_party/tensorrt/BUILD
|
||||
tensorflow/third_party/tensorrt/build_defs.bzl.tpl
|
||||
tensorflow/third_party/tensorrt/BUILD.tpl
|
||||
tensorflow/third_party/tensorrt/tensorrt_configure.bzl
|
||||
tensorflow/third_party/tensorrt/tensorrt/include/tensorrt_config.h.tpl
|
||||
tensorflow/third_party/kafka/config.patch
|
||||
tensorflow/third_party/kafka/BUILD
|
||||
tensorflow/third_party/android/BUILD
|
||||
|
@ -27,5 +27,6 @@ cc_library(
|
||||
"//tensorflow/stream_executor/platform",
|
||||
"@com_google_absl//absl/strings",
|
||||
"@local_config_cuda//cuda:cuda_headers",
|
||||
"@local_config_tensorrt//:tensorrt_headers",
|
||||
],
|
||||
)
|
||||
|
@ -24,6 +24,7 @@ limitations under the License.
|
||||
#include "tensorflow/stream_executor/lib/path.h"
|
||||
#include "tensorflow/stream_executor/platform/logging.h"
|
||||
#include "tensorflow/stream_executor/platform/port.h"
|
||||
#include "third_party/tensorrt/tensorrt_config.h"
|
||||
|
||||
namespace stream_executor {
|
||||
namespace internal {
|
||||
@ -32,10 +33,6 @@ namespace {
|
||||
string GetCudaVersion() { return TF_CUDA_VERSION; }
|
||||
string GetCudaLibVersion() { return TF_CUDA_LIB_VERSION; }
|
||||
string GetCudnnVersion() { return TF_CUDNN_VERSION; }
|
||||
|
||||
// TODO(laigd): populate the version string during configuration process. For
|
||||
// now hardcoded version 5 since 4.0 is not supported anyway.
|
||||
#define TF_TENSORRT_VERSION "5"
|
||||
string GetTensorRTVersion() { return TF_TENSORRT_VERSION; }
|
||||
|
||||
port::StatusOr<void*> GetDsoHandle(const string& name, const string& version) {
|
||||
|
@ -157,6 +157,7 @@ genrule(
|
||||
"@jpeg//:LICENSE.md",
|
||||
"@lmdb//:LICENSE",
|
||||
"@local_config_sycl//sycl:LICENSE.text",
|
||||
"@local_config_tensorrt//:LICENSE",
|
||||
"@nasm//:LICENSE",
|
||||
"@nsync//:LICENSE",
|
||||
"@png_archive//:LICENSE",
|
||||
@ -228,6 +229,7 @@ genrule(
|
||||
"@jpeg//:LICENSE.md",
|
||||
"@lmdb//:LICENSE",
|
||||
"@local_config_sycl//sycl:LICENSE.text",
|
||||
"@local_config_tensorrt//:LICENSE",
|
||||
"@nasm//:LICENSE",
|
||||
"@nsync//:LICENSE",
|
||||
"@png_archive//:LICENSE",
|
||||
|
@ -181,6 +181,7 @@ filegroup(
|
||||
"@keras_applications_archive//:LICENSE",
|
||||
"@lmdb//:LICENSE",
|
||||
"@local_config_sycl//sycl:LICENSE.text",
|
||||
"@local_config_tensorrt//:LICENSE",
|
||||
"@nasm//:LICENSE",
|
||||
"@nsync//:LICENSE",
|
||||
"@pasta//:LICENSE",
|
||||
|
5
third_party/tensorrt/BUILD.tpl
vendored
5
third_party/tensorrt/BUILD.tpl
vendored
@ -11,7 +11,10 @@ exports_files(["LICENSE"])
|
||||
|
||||
cc_library(
|
||||
name = "tensorrt_headers",
|
||||
hdrs = [":tensorrt_include"],
|
||||
hdrs = [
|
||||
"tensorrt/include/tensorrt_config.h",
|
||||
":tensorrt_include"
|
||||
],
|
||||
include_prefix = "third_party/tensorrt",
|
||||
strip_include_prefix = "tensorrt/include",
|
||||
)
|
||||
|
21
third_party/tensorrt/tensorrt/include/tensorrt_config.h.tpl
vendored
Normal file
21
third_party/tensorrt/tensorrt/include/tensorrt_config.h.tpl
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef TENSORRT_TENSORRT_INCLUDE_CONFIG_H_
|
||||
#define TENSORRT_TENSORRT_INCLUDE_CONFIG_H_
|
||||
|
||||
#define TF_TENSORRT_VERSION "%{tensorrt_version}"
|
||||
|
||||
#endif // TENSORRT_TENSORRT_INCLUDE_CONFIG_H_
|
26
third_party/tensorrt/tensorrt_configure.bzl
vendored
26
third_party/tensorrt/tensorrt_configure.bzl
vendored
@ -61,6 +61,9 @@ def _create_dummy_repository(repository_ctx):
|
||||
"\":tensorrt_include\"": "",
|
||||
"\":tensorrt_lib\"": "",
|
||||
})
|
||||
_tpl(repository_ctx, "tensorrt/include/tensorrt_config.h", {
|
||||
"%{tensorrt_version}": "",
|
||||
})
|
||||
|
||||
def enable_tensorrt(repository_ctx):
|
||||
"""Returns whether to build with TensorRT support."""
|
||||
@ -77,8 +80,25 @@ def _tensorrt_configure_impl(repository_ctx):
|
||||
Label(remote_config_repo + ":build_defs.bzl"),
|
||||
{},
|
||||
)
|
||||
repository_ctx.template(
|
||||
"tensorrt/include/tensorrt_config.h",
|
||||
Label(remote_config_repo + ":tensorrt/include/tensorrt_config.h"),
|
||||
{},
|
||||
)
|
||||
repository_ctx.template(
|
||||
"LICENSE",
|
||||
Label(remote_config_repo + ":LICENSE"),
|
||||
{},
|
||||
)
|
||||
return
|
||||
|
||||
# Copy license file in non-remote build.
|
||||
repository_ctx.template(
|
||||
"LICENSE",
|
||||
Label("//third_party/tensorrt:LICENSE"),
|
||||
{},
|
||||
)
|
||||
|
||||
if not enable_tensorrt(repository_ctx):
|
||||
_create_dummy_repository(repository_ctx)
|
||||
return
|
||||
@ -115,6 +135,12 @@ def _tensorrt_configure_impl(repository_ctx):
|
||||
"%{copy_rules}": "\n".join(copy_rules),
|
||||
})
|
||||
|
||||
# Set up tensorrt_config.h, which is used by
|
||||
# tensorflow/stream_executor/dso_loader.cc.
|
||||
_tpl(repository_ctx, "tensorrt/include/tensorrt_config.h", {
|
||||
"%{tensorrt_version}": trt_version,
|
||||
})
|
||||
|
||||
tensorrt_configure = repository_rule(
|
||||
implementation = _tensorrt_configure_impl,
|
||||
environ = [
|
||||
|
@ -11,7 +11,10 @@ exports_files(["LICENSE"])
|
||||
|
||||
cc_library(
|
||||
name = "tensorrt_headers",
|
||||
hdrs = [":tensorrt_include"],
|
||||
hdrs = [
|
||||
"tensorrt/include/tensorrt_config.h",
|
||||
":tensorrt_include",
|
||||
],
|
||||
include_prefix = "third_party/tensorrt",
|
||||
strip_include_prefix = "tensorrt/include",
|
||||
)
|
||||
|
0
third_party/toolchains/preconfig/centos6/tensorrt5/LICENSE
vendored
Normal file
0
third_party/toolchains/preconfig/centos6/tensorrt5/LICENSE
vendored
Normal file
21
third_party/toolchains/preconfig/centos6/tensorrt5/tensorrt/include/tensorrt_config.h
vendored
Normal file
21
third_party/toolchains/preconfig/centos6/tensorrt5/tensorrt/include/tensorrt_config.h
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef TENSORRT_TENSORRT_INCLUDE_CONFIG_H_
|
||||
#define TENSORRT_TENSORRT_INCLUDE_CONFIG_H_
|
||||
|
||||
#define TF_TENSORRT_VERSION "5"
|
||||
|
||||
#endif // TENSORRT_TENSORRT_INCLUDE_CONFIG_H_
|
@ -11,7 +11,10 @@ exports_files(["LICENSE"])
|
||||
|
||||
cc_library(
|
||||
name = "tensorrt_headers",
|
||||
hdrs = [":tensorrt_include"],
|
||||
hdrs = [
|
||||
"tensorrt/include/tensorrt_config.h",
|
||||
":tensorrt_include",
|
||||
],
|
||||
include_prefix = "third_party/tensorrt",
|
||||
strip_include_prefix = "tensorrt/include",
|
||||
)
|
||||
|
0
third_party/toolchains/preconfig/ubuntu14.04/tensorrt5/LICENSE
vendored
Normal file
0
third_party/toolchains/preconfig/ubuntu14.04/tensorrt5/LICENSE
vendored
Normal file
21
third_party/toolchains/preconfig/ubuntu14.04/tensorrt5/tensorrt/include/tensorrt_config.h
vendored
Normal file
21
third_party/toolchains/preconfig/ubuntu14.04/tensorrt5/tensorrt/include/tensorrt_config.h
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef TENSORRT_TENSORRT_INCLUDE_CONFIG_H_
|
||||
#define TENSORRT_TENSORRT_INCLUDE_CONFIG_H_
|
||||
|
||||
#define TF_TENSORRT_VERSION "5"
|
||||
|
||||
#endif // TENSORRT_TENSORRT_INCLUDE_CONFIG_H_
|
@ -11,7 +11,10 @@ exports_files(["LICENSE"])
|
||||
|
||||
cc_library(
|
||||
name = "tensorrt_headers",
|
||||
hdrs = [":tensorrt_include"],
|
||||
hdrs = [
|
||||
"tensorrt/include/tensorrt_config.h",
|
||||
":tensorrt_include",
|
||||
],
|
||||
include_prefix = "third_party/tensorrt",
|
||||
strip_include_prefix = "tensorrt/include",
|
||||
)
|
||||
|
0
third_party/toolchains/preconfig/ubuntu16.04/tensorrt5/LICENSE
vendored
Normal file
0
third_party/toolchains/preconfig/ubuntu16.04/tensorrt5/LICENSE
vendored
Normal file
21
third_party/toolchains/preconfig/ubuntu16.04/tensorrt5/tensorrt/include/tensorrt_config.h
vendored
Normal file
21
third_party/toolchains/preconfig/ubuntu16.04/tensorrt5/tensorrt/include/tensorrt_config.h
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef TENSORRT_TENSORRT_INCLUDE_CONFIG_H_
|
||||
#define TENSORRT_TENSORRT_INCLUDE_CONFIG_H_
|
||||
|
||||
#define TF_TENSORRT_VERSION "5"
|
||||
|
||||
#endif // TENSORRT_TENSORRT_INCLUDE_CONFIG_H_
|
Loading…
Reference in New Issue
Block a user