From 8b55767103d95b12072c6d6c07f3e9ec2e63d01c Mon Sep 17 00:00:00 2001 From: Mason Stallmo Date: Sun, 13 Sep 2020 11:41:23 -0700 Subject: [PATCH 1/4] Add feature for enabling specific TensorRT version in tensorrt-sys --- tensorrt-sys/Cargo.toml | 5 ++++ tensorrt-sys/build.rs | 28 ++++++++++++++----- tensorrt-sys/trt-sys/CMakeLists.txt | 15 ++++------ .../trt-sys/TRTContext/TRTContext.cpp | 5 ++++ tensorrt/Cargo.toml | 4 +-- 5 files changed, 38 insertions(+), 19 deletions(-) diff --git a/tensorrt-sys/Cargo.toml b/tensorrt-sys/Cargo.toml index 0cf9dd5..dc01519 100644 --- a/tensorrt-sys/Cargo.toml +++ b/tensorrt-sys/Cargo.toml @@ -8,6 +8,11 @@ build = "build.rs" repository = "https://github.com/mstallmo/tensorrt-rs" description = "Low level wrapper around Nvidia's TensorRT library" +[features] +default = ["trt-515"] + +trt-515 = [] + [dependencies] libc = "0.2.62" diff --git a/tensorrt-sys/build.rs b/tensorrt-sys/build.rs index eb44676..e74ec49 100644 --- a/tensorrt-sys/build.rs +++ b/tensorrt-sys/build.rs @@ -1,13 +1,27 @@ use cmake::Config; +use std::env; +//TODO: Finish this linker path and implement for 7.1.0 +// Figure out why the ldd for the example executable is still finding the nvinfer at the default +// location instead of our installed location. Potentially look into making the trt-sys library a +// dynamic library instead of static to handle the linking there rather than dealing with it on the +// Rust side. fn main() { - let dst = Config::new("trt-sys").build(); - - println!("cargo:rustc-link-search=native={}", dst.display()); + let mut config = Config::new("trt-sys"); println!("cargo:rustc-link-lib=static=trt-sys"); println!("cargo:rustc-flags=-l dylib=stdc++"); - println!("cargo:rustc-flags=-l dylib=nvinfer"); - println!("cargo:rustc-flags=-l dylib=nvparsers"); - println!("cargo:rustc-flags=-L /usr/local/cuda/lib64"); - println!("cargo:rustc-flags=-l dylib=cudart"); + + #[cfg(feature = "trt-515")] + { + let dst = config.define("TRT_VERSION", "5.1.5").build(); + let curr_dir = env::current_dir().unwrap(); + println!("current directory: {}", curr_dir.display()); + println!("library directory: {}/trt-sys/libs/TensorRT-5.1.5.0/lib", curr_dir.display()); + println!("cargo:rustc-link-search=native={}", dst.display()); + println!("cargo:rustc-flags=-L {}/trt-sys/libs/TensorRT-5.1.5.0/lib", curr_dir.display()); + println!("cargo:rustc-flags=-l dylib=nvinfer"); + println!("cargo:rustc-flags=-l dylib=nvparsers"); + println!("cargo:rustc-flags=-L /usr/local/cuda-10.1/lib64"); + println!("cargo:rustc-flags=-l dylib=cudart"); + } } diff --git a/tensorrt-sys/trt-sys/CMakeLists.txt b/tensorrt-sys/trt-sys/CMakeLists.txt index ad13ba4..057bdcb 100644 --- a/tensorrt-sys/trt-sys/CMakeLists.txt +++ b/tensorrt-sys/trt-sys/CMakeLists.txt @@ -1,30 +1,25 @@ cmake_minimum_required(VERSION 3.10) project(LibTRT LANGUAGES CXX CUDA) +if(${TRT_VERSION} MATCHES "5.1.5") + message(STATUS "TRT version is ${TRT_VERSION}") + add_definitions(-DTRT_VERSION="${TRT_VERSION}") +endif() + set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_FLAGS "-O3 -Wall -Wextra -Werror -Wno-unknown-pragmas") file(GLOB source_files - "TRTLogger/*.h" "TRTLogger/*.cpp" - "TRTRuntime/*.h" "TRTRuntime/*cpp" - "TRTCudaEngine/*.h" "TRTCudaEngine/*.cpp" - "TRTContext/*.h" "TRTContext/*.cpp" - "TRTUffParser/*.h" "TRTUffParser/*.cpp" - "TRTDims/*.h" "TRTDims/*.cpp" - "TRTBuilder/*.h" "TRTBuilder/*.cpp" - "TRTNetworkDefinition/*.h" "TRTNetworkDefinition/*.cpp" - "TRTHostMemory/*.h" "TRTHostMemory/*.cpp" - "*.h" ) find_library(CUDART_LIBRARY cudart ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) diff --git a/tensorrt-sys/trt-sys/TRTContext/TRTContext.cpp b/tensorrt-sys/trt-sys/TRTContext/TRTContext.cpp index f6532ca..81ec501 100644 --- a/tensorrt-sys/trt-sys/TRTContext/TRTContext.cpp +++ b/tensorrt-sys/trt-sys/TRTContext/TRTContext.cpp @@ -2,6 +2,7 @@ // Created by mason on 9/17/19. // #include +#include #include #include #include "NvInfer.h" @@ -48,6 +49,10 @@ const char* context_get_name(Context_t *execution_context) { return; auto& context = execution_context->internal_context; +#ifdef TRT_VERSION + std::cout << "TRT Version: " << TRT_VERSION << "\n"; +#endif + void* buffers[2]; cudaMalloc(&buffers[0], input_data_size); cudaMalloc(&buffers[1], output_size); diff --git a/tensorrt/Cargo.toml b/tensorrt/Cargo.toml index 6ac5e3b..b792880 100644 --- a/tensorrt/Cargo.toml +++ b/tensorrt/Cargo.toml @@ -10,8 +10,8 @@ description = "Rust library for using Nvidia's TensorRT deep learning accelerati [dependencies] # Uncomment when working locally -#tensorrt-sys = {version = "0.2", path="../tensorrt-sys"} -tensorrt-sys = "0.2.1" +tensorrt-sys = {version = "0.2", path="../tensorrt-sys"} +#tensorrt-sys = "0.2.1" ndarray = "0.13.1" ndarray-image = "0.2.1" image = "0.23.9" From 79d73abe8295e033b87c8117104952d9699a6864 Mon Sep 17 00:00:00 2001 From: Mason Stallmo Date: Mon, 14 Sep 2020 00:12:51 -0700 Subject: [PATCH 2/4] Add build configurations for explicit tensorrt versions. Add search functionality via ldconfig and grep to make sure we're finding the correct version of TensorRT installed on the host system. Cargo features will be used to control what specific libraries we need to link against to get that version of TensorRT to work correctly. The features also control the version verification logic to make sure that the libraries that are found for linking are the versions that we expect. The tensorrt version selected via the cargo feature is also passed to the C++ wrapper code to handle any differences that may exist in the underlying TensorRT code. Specifically handling deprecations and removals that happen in the API as the versions change. --- tensorrt-sys/Cargo.toml | 2 + tensorrt-sys/README.md | 12 ++- tensorrt-sys/build.rs | 99 ++++++++++++++++--- tensorrt-sys/src/lib.rs | 98 ++---------------- tensorrt-sys/trt-sys/CMakeLists.txt | 3 - .../trt-sys/TRTContext/TRTContext.cpp | 6 -- 6 files changed, 101 insertions(+), 119 deletions(-) diff --git a/tensorrt-sys/Cargo.toml b/tensorrt-sys/Cargo.toml index dc01519..6ccc931 100644 --- a/tensorrt-sys/Cargo.toml +++ b/tensorrt-sys/Cargo.toml @@ -13,6 +13,8 @@ default = ["trt-515"] trt-515 = [] +trt-713 = [] + [dependencies] libc = "0.2.62" diff --git a/tensorrt-sys/README.md b/tensorrt-sys/README.md index e1e893e..497ad3c 100644 --- a/tensorrt-sys/README.md +++ b/tensorrt-sys/README.md @@ -18,10 +18,16 @@ CMake > 3.10 TensorRT-sys' bindings depends on TensorRT 5.1.5 for the bindings to work correctly. While other versions of TensorRT *may* work with the bindings there are no guarantees as functions that are boudn to may have been depricated, -removed, or changed in future verions of TensorRT. +removed, or changed in future versions of TensorRT. -The prerequisites enumerated above are expected to be installed in their default location on Linux -(/usr/lib/x86_64-linux-gnu/) +The prerequisites enumerated above are expected to be installed in their default location on Linux. See the [nvidia +documentation](https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing) around TensorRT for +further install information. + +__Note:__ The tarball installation method described in the TesnorRT documentation is likely to cause major headaches with +getting everything to link correctly. It is highly recommended to use the package manager method if possible. + +Windows support is not currently supported but should be coming soon! ### Support Matrix for TensorRT Classes Anything not listed below currently does not have any support. diff --git a/tensorrt-sys/build.rs b/tensorrt-sys/build.rs index e74ec49..1e3498c 100644 --- a/tensorrt-sys/build.rs +++ b/tensorrt-sys/build.rs @@ -1,27 +1,94 @@ use cmake::Config; -use std::env; +use std::process::Command; +use std::string::String; +use std::process::Stdio; +use std::path::PathBuf; -//TODO: Finish this linker path and implement for 7.1.0 -// Figure out why the ldd for the example executable is still finding the nvinfer at the default -// location instead of our installed location. Potentially look into making the trt-sys library a -// dynamic library instead of static to handle the linking there rather than dealing with it on the -// Rust side. -fn main() { - let mut config = Config::new("trt-sys"); - println!("cargo:rustc-link-lib=static=trt-sys"); - println!("cargo:rustc-flags=-l dylib=stdc++"); +fn get_shared_lib_link_path(library_name: &str) -> Option { + match get_all_possible_link_paths(library_name) { + Some(all_link_paths) => { + for line in all_link_paths.lines() { + if line.ends_with(&format!("{}.so", library_name)) { + let link_path = line.split("=>").collect::>().last().unwrap().to_owned(); + println!("link path: {}", link_path); + return Some(PathBuf::from(link_path.trim().to_owned())); + } + } + None + } + None => { + None + } + } +} + +fn get_all_possible_link_paths(library_name: &str) -> Option { + let mut ld_config = Command::new("ldconfig").arg("-p").stdout(Stdio::piped()).spawn().expect("Failed to run ldconfig"); - #[cfg(feature = "trt-515")] - { + if let Some(ld_config_output) = ld_config.stdout.take() { + let grep_config = Command::new("grep").arg(library_name).stdin(ld_config_output).stdout(Stdio::piped()).spawn().unwrap(); + let grep_stdout = grep_config.wait_with_output().unwrap(); + ld_config.wait().unwrap(); + Some(String::from_utf8(grep_stdout.stdout).unwrap()) + } else { + None + } +} + +#[cfg(feature = "trt-515")] +fn configuration(full_library_path: &PathBuf) { + if full_library_path.to_str().unwrap().ends_with("5.1.5") { + let mut config = Config::new("trt-sys"); let dst = config.define("TRT_VERSION", "5.1.5").build(); - let curr_dir = env::current_dir().unwrap(); - println!("current directory: {}", curr_dir.display()); - println!("library directory: {}/trt-sys/libs/TensorRT-5.1.5.0/lib", curr_dir.display()); println!("cargo:rustc-link-search=native={}", dst.display()); - println!("cargo:rustc-flags=-L {}/trt-sys/libs/TensorRT-5.1.5.0/lib", curr_dir.display()); println!("cargo:rustc-flags=-l dylib=nvinfer"); println!("cargo:rustc-flags=-l dylib=nvparsers"); println!("cargo:rustc-flags=-L /usr/local/cuda-10.1/lib64"); println!("cargo:rustc-flags=-l dylib=cudart"); + } else { + panic!("Invalid nvinfer version found. Expected: libnvinfer.so.5.1.5, Found: {}", full_library_path.to_str().unwrap()); + } +} + +#[cfg(feature = "trt-713")] +fn configuration(full_library_path: &PathBuf) { + if full_library_path.to_str().unwrap().ends_with("7.1.3") { + let mut config = Config::new("trt-sys"); + let dst = config.define("TRT_VERSION", "7.1.3").build(); + println!("cargo:rustc-link-search=native={}", dst.display()); + println!("cargo:rustc-flags=-l dylib=nvinfer"); + println!("cargo:rustc-flags=-l dylib=nvparsers"); + println!("cargo:rustc-flags=-L /usr/local/cuda-10.2/lib64"); + println!("cargo:rustc-flags=-l dylib=cudart"); + } else { + panic!("Invalid nvinfer version found. Expected: libnvinfer.so.7.1.3, Found: {}", full_library_path.to_str().unwrap()); + } +} + +// Not sure if I love this solution but I think it's relatively robust enough for now on Unix systems. +// Still have to thoroughly test what happens with a TRT library installed that's not done by the +// dpkg. It's possible that we'll just have to fall back to only supporting one system library and assuming that +// the user has the correct library installed and is viewable via ldconfig. +// +// Hopefully something like this will work for Windows installs as well, not having a default library +// install location will make that significantly harder. +fn main() { + println!("cargo:rustc-link-lib=static=trt-sys"); + println!("cargo:rustc-flags=-l dylib=stdc++"); + + match get_shared_lib_link_path("libnvinfer") { + Some(link_path) => { + match std::fs::read_link(link_path) { + Ok(full_library_path) => { + configuration(&full_library_path); + }, + Err(_) => { + panic!("libnvinfer.so not found! See https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-515/tensorrt-install-guide/index.html for install instructions"); + } + } + }, + None => { + panic!("libnvinfer.so not found! See https://docs.nvidia.com/deeplearning/tensorrt/archives/tensorrt-515/tensorrt-install-guide/index.html for install instructions"); + } } } diff --git a/tensorrt-sys/src/lib.rs b/tensorrt-sys/src/lib.rs index 3e7beac..0f01898 100644 --- a/tensorrt-sys/src/lib.rs +++ b/tensorrt-sys/src/lib.rs @@ -20,6 +20,7 @@ mod tests { use std::io::prelude::*; use std::os::raw::{c_char, c_int, c_void}; + #[cfg(feature = "trt-515")] #[test] fn tensorrt_version() { let mut c_buf = Vec::::with_capacity(6); @@ -28,97 +29,12 @@ mod tests { assert_eq!("5.1.5", c_str.to_str().unwrap()); } - // #[test] - // fn cuda_runtime() { - // let logger = unsafe { create_logger() }; - // let runtime = unsafe { create_infer_runtime(logger) }; - // - // let mut f = File::open("resnet34-unet-Aug25-07-25-16-best.engine").unwrap(); - // let mut buffer = Vec::new(); - // f.read_to_end(&mut buffer).unwrap(); - // let engine = unsafe { - // deserialize_cuda_engine( - // runtime, - // buffer.as_ptr() as *const c_void, - // buffer.len() as u64, - // ) - // }; - // - // let bindingNameCStr = unsafe { - // let bindingName = get_binding_name(engine, 0); - // CStr::from_ptr(bindingName) - // }; - // println!( - // "Binding name for index {} is {}", - // 0, - // bindingNameCStr.to_str().unwrap() - // ); - // - // let execution_context = unsafe { engine_create_execution_context(engine) }; - // unsafe { context_set_name(execution_context, CString::new("Mason").unwrap().as_ptr()) }; - // let context_name_cstr = unsafe { - // let context_name = context_get_name(execution_context); - // CStr::from_ptr(context_name) - // }; - // println!("Context name is {}", context_name_cstr.to_str().unwrap()); - // - // let input_binding = - // unsafe { get_binding_index(engine, CString::new("data").unwrap().as_ptr()) }; - // println!("Binding index for data is {}", input_binding); - // - // unsafe { - // destroy_excecution_context(execution_context); - // destroy_cuda_engine(engine); - // destroy_infer_runtime(runtime); - // delete_logger(logger); - // } - // } - // - // #[test] - // fn host_memory() { - // let logger = unsafe { create_logger() }; - // let runtime = unsafe { create_infer_runtime(logger) }; - // - // let mut f = File::open("resnet34-unet-Aug25-07-25-16-best.engine").unwrap(); - // let mut buffer = Vec::new(); - // f.read_to_end(&mut buffer).unwrap(); - // let engine = unsafe { - // deserialize_cuda_engine( - // runtime, - // buffer.as_ptr() as *const c_void, - // buffer.len() as u64, - // ) - // }; - // - // let host_memory = unsafe { engine_serialize(engine) }; - // let memory_sise = unsafe { host_memory_get_size(host_memory) }; - // println!("Host Memory Size of Engine: {}", memory_sise); - // } - + #[cfg(feature = "trt-713")] #[test] - fn uff_parser() { - let parser = unsafe { uffparser_create_uff_parser() }; - let mut d_vec = vec![3, 256, 256]; - let mut type_vec = vec![1, 0, 0]; - let dims = unsafe { - crate::create_dims( - 3, - d_vec.as_mut_ptr() as *mut c_int, - type_vec.as_mut_ptr() as *mut c_int, - ) - }; - let input_ret = unsafe { - uffparser_register_input(parser, CString::new("input").unwrap().as_ptr(), dims) - }; - assert_eq!(input_ret, true); - - let output_ret = unsafe { - uffparser_register_output(parser, CString::new("sigmoid/Sigmoid").unwrap().as_ptr()) - }; - assert_eq!(output_ret, true); - - unsafe { - uffparser_destroy_uff_parser(parser); - } + fn tensorrt_version() { + let mut c_buf = Vec::::with_capacity(6); + unsafe { get_tensorrt_version(c_buf.as_mut_ptr()) }; + let c_str = unsafe { CStr::from_ptr(c_buf.as_ptr()) }; + assert_eq!("7.1.3", c_str.to_str().unwrap()); } } diff --git a/tensorrt-sys/trt-sys/CMakeLists.txt b/tensorrt-sys/trt-sys/CMakeLists.txt index 057bdcb..c41f05e 100644 --- a/tensorrt-sys/trt-sys/CMakeLists.txt +++ b/tensorrt-sys/trt-sys/CMakeLists.txt @@ -22,10 +22,7 @@ file(GLOB source_files "TRTHostMemory/*.cpp" ) -find_library(CUDART_LIBRARY cudart ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES}) - add_library(trt-sys STATIC ${source_files}) -target_link_libraries(trt-sys PRIVATE nvinfer ${CUDART_LIBRARY}) include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) install(TARGETS trt-sys DESTINATION .) \ No newline at end of file diff --git a/tensorrt-sys/trt-sys/TRTContext/TRTContext.cpp b/tensorrt-sys/trt-sys/TRTContext/TRTContext.cpp index 81ec501..81ccce7 100644 --- a/tensorrt-sys/trt-sys/TRTContext/TRTContext.cpp +++ b/tensorrt-sys/trt-sys/TRTContext/TRTContext.cpp @@ -1,8 +1,6 @@ // // Created by mason on 9/17/19. // -#include -#include #include #include #include "NvInfer.h" @@ -49,10 +47,6 @@ const char* context_get_name(Context_t *execution_context) { return; auto& context = execution_context->internal_context; -#ifdef TRT_VERSION - std::cout << "TRT Version: " << TRT_VERSION << "\n"; -#endif - void* buffers[2]; cudaMalloc(&buffers[0], input_data_size); cudaMalloc(&buffers[1], output_size); From 42a38f75c679c4b0c7ea71ced53b0a31cee7d9aa Mon Sep 17 00:00:00 2001 From: Mason Stallmo Date: Mon, 14 Sep 2020 00:22:06 -0700 Subject: [PATCH 3/4] Add CUDA version flags for supporting TensorRT bindings that can work with multiple versions of CUDA --- tensorrt-sys/Cargo.toml | 8 +++++++- tensorrt-sys/build.rs | 24 ++++++++++++++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/tensorrt-sys/Cargo.toml b/tensorrt-sys/Cargo.toml index 6ccc931..dc49fcb 100644 --- a/tensorrt-sys/Cargo.toml +++ b/tensorrt-sys/Cargo.toml @@ -11,10 +11,16 @@ description = "Low level wrapper around Nvidia's TensorRT library" [features] default = ["trt-515"] -trt-515 = [] +trt-515 = ["cuda-101"] trt-713 = [] +cuda-101 = [] + +cuda-102 = [] + +cuda-110 = [] + [dependencies] libc = "0.2.62" diff --git a/tensorrt-sys/build.rs b/tensorrt-sys/build.rs index 1e3498c..265dfcd 100644 --- a/tensorrt-sys/build.rs +++ b/tensorrt-sys/build.rs @@ -43,8 +43,7 @@ fn configuration(full_library_path: &PathBuf) { println!("cargo:rustc-link-search=native={}", dst.display()); println!("cargo:rustc-flags=-l dylib=nvinfer"); println!("cargo:rustc-flags=-l dylib=nvparsers"); - println!("cargo:rustc-flags=-L /usr/local/cuda-10.1/lib64"); - println!("cargo:rustc-flags=-l dylib=cudart"); + cuda_configuration(); } else { panic!("Invalid nvinfer version found. Expected: libnvinfer.so.5.1.5, Found: {}", full_library_path.to_str().unwrap()); } @@ -58,13 +57,30 @@ fn configuration(full_library_path: &PathBuf) { println!("cargo:rustc-link-search=native={}", dst.display()); println!("cargo:rustc-flags=-l dylib=nvinfer"); println!("cargo:rustc-flags=-l dylib=nvparsers"); - println!("cargo:rustc-flags=-L /usr/local/cuda-10.2/lib64"); - println!("cargo:rustc-flags=-l dylib=cudart"); + cuda_configuration(); } else { panic!("Invalid nvinfer version found. Expected: libnvinfer.so.7.1.3, Found: {}", full_library_path.to_str().unwrap()); } } +#[cfg(feature = "cuda-101")] +fn cuda_configuration() { + println!("cargo:rustc-flags=-L /usr/local/cuda-10.1/lib64"); + println!("cargo:rustc-flags=-l dylib=cudart"); +} + +#[cfg(feature = "cuda-102")] +fn cuda_configuration() { + println!("cargo:rustc-flags=-L /usr/local/cuda-10.2/lib64"); + println!("cargo:rustc-flags=-l dylib=cudart"); +} + +#[cfg(feature = "cuda-110")] +fn cuda_configuration() { + println!("cargo:rustc-flags=-L /usr/local/cuda-11.0/lib64"); + println!("cargo:rustc-flags=-l dylib=cudart"); +} + // Not sure if I love this solution but I think it's relatively robust enough for now on Unix systems. // Still have to thoroughly test what happens with a TRT library installed that's not done by the // dpkg. It's possible that we'll just have to fall back to only supporting one system library and assuming that From fc26b687ee3b7885701f989f9c973e502daaa0ce Mon Sep 17 00:00:00 2001 From: Mason Stallmo Date: Thu, 17 Sep 2020 21:57:19 -0700 Subject: [PATCH 4/4] Link nvinfer_pluing as a static library instead of dynamic. This will reduce some of the headache with how TensorRT installs on the system as well as make the install experience with end users of the library a little bit smoother. Ideally we would like to statically link all of the TensorRT libraries but that doesn't seem possible at this stage due to protobuf symobls not being found in the static version of nvinfer and nvparsers. This seems to be a bug in the binary releases of these artifacts. --- .gitattributes | 3 +++ .../3rdParty/TensorRT-5.1.5/libnvinfer_plugin_static.a | 3 +++ tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_static.a | 3 +++ tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvparsers_static.a | 3 +++ tensorrt-sys/build.rs | 5 +++++ 5 files changed, 17 insertions(+) create mode 100644 .gitattributes create mode 100644 tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_plugin_static.a create mode 100644 tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_static.a create mode 100644 tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvparsers_static.a diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ee6259b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_plugin_static.a filter=lfs diff=lfs merge=lfs -text +tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_static.a filter=lfs diff=lfs merge=lfs -text +tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvparsers_static.a filter=lfs diff=lfs merge=lfs -text diff --git a/tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_plugin_static.a b/tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_plugin_static.a new file mode 100644 index 0000000..06fdf8d --- /dev/null +++ b/tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_plugin_static.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c5e0094984b9462c18d91f9affcc56606e3eeb0ea72322ca452422d6fc0c11b +size 2636966 diff --git a/tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_static.a b/tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_static.a new file mode 100644 index 0000000..2931378 --- /dev/null +++ b/tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvinfer_static.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92e4c858e3eac82a3f161da87c7c36eb1620672e19210fd2640ec7cfcfdd027b +size 164301090 diff --git a/tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvparsers_static.a b/tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvparsers_static.a new file mode 100644 index 0000000..c561d37 --- /dev/null +++ b/tensorrt-sys/3rdParty/TensorRT-5.1.5/libnvparsers_static.a @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:896ac86fd8d9281635d70e63ea077798e49914b0db046d0caf27ad10a8901b7e +size 4377674 diff --git a/tensorrt-sys/build.rs b/tensorrt-sys/build.rs index 265dfcd..4dcca3a 100644 --- a/tensorrt-sys/build.rs +++ b/tensorrt-sys/build.rs @@ -43,6 +43,8 @@ fn configuration(full_library_path: &PathBuf) { println!("cargo:rustc-link-search=native={}", dst.display()); println!("cargo:rustc-flags=-l dylib=nvinfer"); println!("cargo:rustc-flags=-l dylib=nvparsers"); + println!("cargo:rustc-flags=-L {}/3rdParty/TensorRT-5.1.5", env!("CARGO_MANIFEST_DIR")); + println!("cargo:rustc-flags=-l static=nvinfer_plugin_static"); cuda_configuration(); } else { panic!("Invalid nvinfer version found. Expected: libnvinfer.so.5.1.5, Found: {}", full_library_path.to_str().unwrap()); @@ -67,6 +69,9 @@ fn configuration(full_library_path: &PathBuf) { fn cuda_configuration() { println!("cargo:rustc-flags=-L /usr/local/cuda-10.1/lib64"); println!("cargo:rustc-flags=-l dylib=cudart"); + println!("cargo:rustc-flags=-l dylib=cublas"); + println!("cargo:rustc-flags=-l dylib=cublasLt"); + println!("cargo:rustc-flags=-l dylib=cudnn"); } #[cfg(feature = "cuda-102")]