Skip to content

Commit 805810b

Browse files
committed
TensorRT 7.1 Open Source Release
Signed-off-by: Rajeev Rao <[email protected]>
1 parent 2b8863d commit 805810b

File tree

496 files changed

+43449
-6642
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

496 files changed

+43449
-6642
lines changed

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.git*
2+
build*
3+
/third_party

.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
build/
2-
docker/jetpack_files/*
2+
/demo/BERT/models
3+
/demo/BERT/engines
4+
/demo/BERT/squad/*.json
5+
/docker/jetpack_files/*
6+
*.nvmk
7+
*.sln
8+
*.vcxproj

.gitmodules

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
[submodule "parsers/onnx"]
2-
path = parsers/onnx
3-
url = https://github.com/onnx/onnx-tensorrt.git
4-
branch = 7.0
51
[submodule "third_party/protobuf"]
62
path = third_party/protobuf
73
url = https://github.com/protocolbuffers/protobuf.git
@@ -10,3 +6,7 @@
106
path = third_party/cub
117
url = https://github.com/NVlabs/cub.git
128
branch = 1.8.0
9+
[submodule "parsers/onnx"]
10+
path = parsers/onnx
11+
url = https://github.com/onnx/onnx-tensorrt.git
12+
branch = 7.1

CMakeLists.txt

+75-131
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
2+
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ include(cmake/modules/set_ifndef.cmake)
1919
include(cmake/modules/find_library_create_target.cmake)
2020

2121
set_ifndef(TRT_LIB_DIR ${CMAKE_BINARY_DIR})
22-
set_ifndef(TRT_BIN_DIR ${CMAKE_BINARY_DIR})
22+
set_ifndef(TRT_OUT_DIR ${CMAKE_BINARY_DIR})
2323

2424
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/NvInferVersion.h" VERSION_STRINGS REGEX "#define NV_TENSORRT_.*")
2525

@@ -33,8 +33,8 @@ foreach(TYPE MAJOR MINOR PATCH)
3333
string(REGEX MATCH "[0-9]" TRT_SO_${TYPE} ${TRT_TYPE_STRING})
3434
endforeach(TYPE)
3535

36-
set(TRT_VERSION "${TRT_MAJOR}.${TRT_MINOR}.${TRT_PATCH}.${TRT_BUILD}" CACHE STRING "TRT project version")
37-
set(TRT_SOVERSION "${TRT_SO_MAJOR}.${TRT_SO_MINOR}.${TRT_SO_PATCH}" CACHE STRING "TRT library so version")
36+
set(TRT_VERSION "${TRT_MAJOR}.${TRT_MINOR}.${TRT_PATCH}" CACHE STRING "TensorRT project version")
37+
set(TRT_SOVERSION "${TRT_SO_MAJOR}" CACHE STRING "TensorRT library so version")
3838
message("Building for TensorRT version: ${TRT_VERSION}, library version: ${TRT_SOVERSION}")
3939

4040
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
@@ -56,26 +56,81 @@ endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
5656
option(BUILD_PLUGINS "Build TensorRT plugin" ON)
5757
option(BUILD_PARSERS "Build TensorRT parsers" ON)
5858
option(BUILD_SAMPLES "Build TensorRT samples" ON)
59-
option(NVPARTNER "Build partner repos from source" OFF)
60-
option(NVINTERNAL "Build in NVIDIA internal source tree" OFF)
6159

6260
set(CMAKE_CXX_STANDARD 11)
6361
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6462
set(CMAKE_CXX_EXTENSIONS OFF)
63+
set(CMAKE_CXX_FLAGS "-Wno-deprecated-declarations ${CMAKE_CXX_FLAGS} -DBUILD_SYSTEM=cmake_oss")
6564

66-
############################# CROSS COMPILATION SETTINGS ##################################
65+
############################################################################################
66+
# Cross-compilation settings
6767

6868
set_ifndef(TRT_PLATFORM_ID "x86_64")
6969
message(STATUS "Targeting TRT Platform: ${TRT_PLATFORM_ID}")
7070

7171
############################################################################################
72+
# Debug settings
73+
7274
set(TRT_DEBUG_POSTFIX _debug CACHE STRING "suffix for debug builds")
7375

7476
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
7577
message("Building in debug mode ${DEBUG_POSTFIX}")
7678
endif()
7779

78-
set(CMAKE_CXX_FLAGS "-Wno-deprecated-declarations ${CMAKE_CXX_FLAGS} -DBUILD_SYSTEM=cmake_oss")
80+
############################################################################################
81+
# Dependencies
82+
83+
set(DEFAULT_CUDA_VERSION 11.0)
84+
set(DEFAULT_CUDNN_VERSION 8.0)
85+
set(DEFAULT_PROTOBUF_VERSION 3.0.0)
86+
set(DEFAULT_CUB_VERSION 1.8.0)
87+
88+
# Dependency Version Resolution
89+
set_ifndef(CUDA_VERSION ${DEFAULT_CUDA_VERSION})
90+
message(STATUS "CUDA version set to ${CUDA_VERSION}")
91+
set_ifndef(CUDNN_VERSION ${DEFAULT_CUDNN_VERSION})
92+
message(STATUS "cuDNN version set to ${CUDNN_VERSION}")
93+
set_ifndef(PROTOBUF_VERSION ${DEFAULT_PROTOBUF_VERSION})
94+
message(STATUS "Protobuf version set to ${PROTOBUF_VERSION}")
95+
96+
find_package(Threads REQUIRED)
97+
if (BUILD_PLUGINS OR BUILD_PARSERS)
98+
include(third_party/zlib.cmake)
99+
include(third_party/protobuf.cmake)
100+
endif()
101+
if(NOT CUB_ROOT_DIR)
102+
set(CUB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/cub CACHE STRING "directory of CUB installation")
103+
endif()
104+
105+
## find_package(CUDA) is broken for cross-compilation. Enable CUDA language instead.
106+
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
107+
find_package(CUDA ${CUDA_VERSION} REQUIRED)
108+
endif()
109+
110+
include_directories(
111+
${CUDA_INCLUDE_DIRS}
112+
${CUDNN_ROOT_DIR}/include
113+
)
114+
find_library(CUDNN_LIB cudnn HINTS
115+
${CUDA_TOOLKIT_ROOT_DIR} ${CUDNN_ROOT_DIR} PATH_SUFFIXES lib64 lib)
116+
find_library(CUBLAS_LIB cublas HINTS
117+
${CUDA_TOOLKIT_ROOT_DIR} PATH_SUFFIXES lib64 lib lib/stubs)
118+
find_library(CUBLASLT_LIB cublasLt HINTS
119+
${CUDA_TOOLKIT_ROOT_DIR} PATH_SUFFIXES lib64 lib lib/stubs)
120+
if(BUILD_PARSERS)
121+
configure_protobuf(${PROTOBUF_VERSION})
122+
endif()
123+
124+
find_library_create_target(nvinfer nvinfer SHARED ${TRT_LIB_DIR})
125+
find_library_create_target(nvuffparser nvparsers SHARED ${TRT_LIB_DIR})
126+
127+
find_library(CUDART_LIB cudart HINTS ${CUDA_TOOLKIT_ROOT_DIR} PATH_SUFFIXES lib lib64)
128+
find_library(RT_LIB rt)
129+
130+
set(CUDA_LIBRARIES ${CUDART_LIB})
131+
132+
############################################################################################
133+
# CUDA targets
79134

80135
if (DEFINED GPU_ARCHS)
81136
message(STATUS "GPU_ARCHS defined as ${GPU_ARCHS}. Generating CUDA code for SM ${GPU_ARCHS}")
@@ -88,6 +143,12 @@ else()
88143
70
89144
75
90145
)
146+
if (CUDA_VERSION VERSION_GREATER_EQUAL 11.0)
147+
# Ampere GPU (SM80) support is only available in CUDA versions > 11.0
148+
list(APPEND GPU_ARCHS 80)
149+
else()
150+
message(WARNING "Detected CUDA version is < 11.0. SM80 not supported.")
151+
endif()
91152
message(STATUS "GPU_ARCHS is not defined. Generating CUDA code for default SMs: ${GPU_ARCHS}")
92153
endif()
93154
set(BERT_GENCODES)
@@ -106,140 +167,23 @@ if (${LATEST_SM} GREATER_EQUAL 70)
106167
endif()
107168
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler -Wno-deprecated-declarations")
108169

109-
################################### DEPENDENCIES ##########################################
110-
set(DEFAULT_CUDA_VERSION 10.2)
111-
set(DEFAULT_CUDNN_VERSION 7.6)
112-
set(DEFAULT_PROTOBUF_VERSION 3.0.0)
113-
set(DEFAULT_PROTOBUF_INTERNAL_VERSION 10.0)
114-
set(DEFAULT_CUB_VERSION 1.8.0)
115-
116-
# Dependency Version Resolution
117-
set_ifndef(CUDA_VERSION ${DEFAULT_CUDA_VERSION})
118-
message(STATUS "CUDA version set to ${CUDA_VERSION}")
119-
set_ifndef(CUDNN_VERSION ${DEFAULT_CUDNN_VERSION})
120-
message(STATUS "cuDNN version set to ${CUDNN_VERSION}")
121-
122-
if (NVINTERNAL)
123-
#TODO: Change this to set_ifndef(PROTOBUF_INTERNAL_VERSION ${DEFAULT_PROTOBUF_INTERNAL_VERSION}) once onnx-tensorrts build system is fixed
124-
set_ifndef(PROTOBUF_VERSION ${DEFAULT_PROTOBUF_VERSION})
125-
message(STATUS "Protobuf version set to ${PROTOBUF_INTERNAL_VERSION}")
126-
set_ifndef(CUB_VERSION ${DEFAULT_CUB_VERSION})
127-
message(STATUS "CUB version set to ${CUB_VERSION}")
128-
#TODO: Remove this once CMake is fully intergrated in the P4 build system
129-
set_ifndef(NVINTERNAL_SUFFIX "V2")
130-
else()
131-
set_ifndef(PROTOBUF_VERSION ${DEFAULT_PROTOBUF_VERSION})
132-
message(STATUS "Protobuf version set to ${PROTOBUF_VERSION}")
133-
endif()
134-
135-
136-
find_package(Threads REQUIRED)
137-
if (BUILD_PLUGINS OR BUILD_PARSERS)
138-
include(third_party/zlib.cmake)
139-
include(third_party/protobuf.cmake)
140-
endif()
141-
if (NVINTERNAL)
142-
########################################### DEPENDENCIES FOR BUILDING IN NVIDIA's TREE ############################################
143-
set(EXTERNALS ${PROJECT_SOURCE_DIR}/../externals)
144-
set(CUB_ROOT_DIR ${EXTERNALS}/cub/${CUB_VERSION} CACHE STRING "directory of CUB installation")
145-
set(Protobuf_DIR ${EXTERNALS}/protobuf/${TRT_PLATFORM_ID} CACHE STRING "directory of PROTOBUF installation")
146-
147-
## This needs to be fixed to work with externals
148-
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
149-
find_package(CUDA REQUIRED)
150-
endif()
151-
152-
# Set this for ONNX Parser
153-
set(CUDNN_ROOT_DIR ${EXTERNALS}/cudnn/${TRT_PLATFORM_ID}/${CUDNN_VERSION}/cuda-${CUDA_VERSION})
154-
155-
include_directories(
156-
${CUDNN_ROOT_DIR}/include
157-
${CUDA_TOOLKIT_ROOT_DIR}/include
158-
/usr/local/cuda-${CUDA_VERSION}/include
159-
)
160-
161-
162-
#Check externals before using system
163-
find_library(CUDNN_LIB cudnn HINTS
164-
${CUDNN_ROOT_DIR}/lib64 NO_DEFAULT_PATH)
165-
find_library(CUDNN_LIB cudnn HINTS
166-
${CUDNN_ROOT_DIR}/lib64)
167-
168-
find_library(CUBLAS_LIB cublas HINTS
169-
${CUDA_TOOLKIT_ROOT_DIR}/lib NO_DEFAULT_PATH)
170-
find_library(CUBLAS_LIB cublas HINTS
171-
${CUDA_TOOLKIT_ROOT_DIR}/lib)
172-
173-
if(BUILD_PARSERS)
174-
#TODO: Change this to configure_protobuf_internal(${PROTOBUF_INTERNAL_VERSION}) once onnx-tensorrts build system is fixed
175-
configure_protobuf(${PROTOBUF_VERSION})
176-
endif()
177-
########################################### DEPENDENCIES FOR BUILDING IN NVIDIA's TREE ############################################
178-
else()
179-
########################################### DEPENDENCIES FOR BUILDING OUTSIDE OF NVIDIA ############################################
180-
if(NOT CUB_ROOT_DIR)
181-
set(CUB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/cub CACHE STRING "directory of CUB installation")
182-
endif()
183-
184-
## find_package(CUDA) is broken for cross-compilation. Enable CUDA language instead.
185-
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
186-
find_package(CUDA ${CUDA_VERSION} REQUIRED)
187-
endif()
188-
189-
include_directories(
190-
${CUDA_INCLUDE_DIRS}
191-
${CUDNN_ROOT_DIR}/include
192-
)
193-
find_library(CUDNN_LIB cudnn HINTS
194-
${CUDA_TOOLKIT_ROOT_DIR} ${CUDNN_ROOT_DIR} PATH_SUFFIXES lib64 lib)
195-
find_library(CUBLAS_LIB cublas HINTS
196-
${CUDA_TOOLKIT_ROOT_DIR} PATH_SUFFIXES lib64 lib lib/stubs)
197-
# CUBLASLT libraries are only available in CUDA versions > 10. Check for CUDA version here and
198-
# remove dependency on the libarary and unset BERT_GENCODES.
199-
if (CUDA_VERSION VERSION_LESS_EQUAL 10.0)
200-
message(WARNING "Detected CUDA version is <= 10.0! Removing BERT plugins from compilation list.")
201-
unset(BERT_GENCODES)
202-
else()
203-
find_library(CUBLASLT_LIB cublasLt HINTS
204-
${CUDA_TOOLKIT_ROOT_DIR} PATH_SUFFIXES lib64 lib lib/stubs)
205-
endif()
206-
if(BUILD_PARSERS)
207-
configure_protobuf(${PROTOBUF_VERSION})
208-
endif()
209-
########################################### DEPENDENCIES FOR BUILDING OUTSIDE OF NVIDIA ############################################
210-
endif()
211-
212-
find_library_create_target(nvinfer nvinfer SHARED ${TRT_LIB_DIR})
213-
214-
if (NOT (NVINTERNAL OR NVPARTNER))
215-
find_library_create_target(nvuffparser nvparsers SHARED ${TRT_LIB_DIR})
216-
endif()
217-
218-
find_library(CUDART_LIB cudart HINTS ${CUDA_TOOLKIT_ROOT_DIR} PATH_SUFFIXES lib lib64)
219-
find_library(RT_LIB rt)
220-
221-
set(CUDA_LIBRARIES ${CUDART_LIB})
222170
############################################################################################
223171
# TensorRT
224172

225173
if(BUILD_PLUGINS)
226-
add_subdirectory(plugin${NVINTERNAL_SUFFIX})
174+
add_subdirectory(plugin)
227175
else()
228-
find_library_create_target(nvinfer_plugin nvinfer_plugin SHARED ${TRT_BIN_DIR} ${TRT_LIB_DIR})
176+
find_library_create_target(nvinfer_plugin nvinfer_plugin SHARED ${TRT_OUT_DIR} ${TRT_LIB_DIR})
229177
endif()
230178

231179
if(BUILD_PARSERS)
232-
add_subdirectory(parsers${NVINTERNAL_SUFFIX})
180+
add_subdirectory(parsers)
233181
else()
234-
if(NVPARTNER OR NVINTERNAL)
235-
find_library_create_target(nvuffparser nvparsers SHARED ${TRT_BIN_DIR} ${TRT_LIB_DIR})
236-
endif()
237-
238-
find_library_create_target(nvcaffeparser nvparsers SHARED ${TRT_BIN_DIR} ${TRT_LIB_DIR})
239-
find_library_create_target(nvonnxparser nvonnxparser SHARED ${TRT_BIN_DIR} ${TRT_LIB_DIR})
182+
find_library_create_target(nvcaffeparser nvparsers SHARED ${TRT_OUT_DIR} ${TRT_LIB_DIR})
183+
find_library_create_target(nvonnxparser nvonnxparser SHARED ${TRT_OUT_DIR} ${TRT_LIB_DIR})
240184
endif()
241185

242186
if(BUILD_SAMPLES)
243-
add_subdirectory(samples${NVINTERNAL_SUFFIX})
187+
add_subdirectory(samples)
244188
endif()
245189

CODING-GUIDELINES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ char const * const errStr = getErrorStr(status);
419419
1. All TensorRT Open Source Software code should contain an NVIDIA copyright header that includes the current year. The following block of text should be prepended to the top of all OSS files. This includes .cpp, .h, .cu, .py, and any other source files which are compiled or interpreted.
420420
```cpp
421421
/*
422-
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
422+
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
423423
*
424424
* Licensed under the Apache License, Version 2.0 (the "License");
425425
* you may not use this file except in compliance with the License.

LICENSE

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176

177177
END OF TERMS AND CONDITIONS
178178

179-
Copyright 2019 NVIDIA Corporation
179+
Copyright 2020 NVIDIA Corporation
180180

181181
Licensed under the Apache License, Version 2.0 (the "License");
182182
you may not use this file except in compliance with the License.
@@ -264,4 +264,4 @@
264264
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
265265
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
266266
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
267-
DEALINGS IN THE SOFTWARE.
267+
DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)