Failed to static link with TensorRT 8.5 using CUDA 11.3

Description

Here is the content of a.cu:

$ cat a.cu
#include <NvInfer.h>
#include <NvInferPlugin.h>
int main() {
        initLibNvInferPlugins(getLogger(), "");
        nvinfer1::createInferBuilder(*getLogger());
}

I failed to static link with TensorRT 8.5.1.7 using CUDA 11.3.

$ /usr/local/cuda-11.3/bin/nvcc a.cu -I /usr/local/TensorRT-8.5.1.7/include -L /usr/local/TensorRT-8.5.1.7/lib -L /usr/local/cudnn-linux-x86_64-8.6.0.163_cuda11-archive/lib -L /usr/local/cuda-11.3/lib64 -lnvinfer_static -lnvinfer_plugin_static -lnvrtc -lcublas -lcublasLt -lcudnn -lnvptxcompiler_static -Xcompiler=-Wno-deprecated-declarations
/usr/bin/ld: /usr/local/TensorRT-8.5.1.7/lib/libnvinfer_static.a(hardware_information.cpp.1.o): in function `cask_trt::GpcSkyline::queryFromDevice(cask_trt::GpcSkyline&, cask_trt::SmModel const&, int)':
hardware_information.cpp:(.text+0xede): undefined reference to `cudaOccupancyMaxActiveClusters'
/usr/bin/ld: /usr/local/TensorRT-8.5.1.7/lib/libnvinfer_static.a(gemm_cublas.1.o): in function `myelin::exec::(anonymous namespace)::check_cublasLt_error(cublasStatus_t, std::string const&, myelin::util::errors_t&) [clone .part.224]':
gemm_cublas.cpp:(.text+0xec60): undefined reference to `cublasLtGetStatusName'
collect2: error: ld returned 1 exit status

I’m sure that TensorRT 8.0/8.2/8.4 + CUDA 10.2/11.3 is OK, and TensorRT 8.5 + CUDA 10.2/11.8 is also OK.

But I shouldn’t compile the software using CUDA 11.8. The reason is that my customers’ environment is CUDA 11.0 ~ 11.4 and they will get ./a.out: symbol lookup error: ./a.out: undefined symbol: cublasLtGetStatusName, version libcublasLt.so.11 if I link with the cuBLAS in CUDA 11.8.

Environment

TensorRT Version: 8.5.1.7
GPU Type: NVIDIA GeForce RTX 3080
Nvidia Driver Version: 528.02
CUDA Version: 11.3
CUDNN Version: 8.6.0.163
Operating System + Version: WSL, Ubuntu 22.04.1 LTS
Python Version (if applicable):
TensorFlow Version (if applicable):
PyTorch Version (if applicable):
Baremetal or Container (if container which image + tag):

Relevant Files

Here is the content of a.cu:

$ cat a.cu
#include <NvInfer.h>
#include <NvInferPlugin.h>
int main() {
        initLibNvInferPlugins(getLogger(), "");
        nvinfer1::createInferBuilder(*getLogger());
}

Steps To Reproduce

  1. Install CUDA, cuDNN, TensorRT
  2. /usr/local/cuda-11.3/bin/nvcc a.cu -I /usr/local/TensorRT-8.5.1.7/include -L /usr/local/TensorRT-8.5.1.7/lib -L /usr/local/cudnn-linux-x86_64-8.6.0.163_cuda11-archive/lib -L /usr/local/cuda-11.3/lib64 -lnvinfer_static -lnvinfer_plugin_static -lnvrtc -lcublas -lcublasLt -lcudnn -lnvptxcompiler_static -Xcompiler=-Wno-deprecated-declarations

For using static libraries, it is required that the same major.minor version of the CUDA toolkit that was used to build TensorRT is used to build your application.
TRT 8.5.x has two CUDA builds: CUDA-10.2 and CUDA-11.8.

Thank you. The documentation is very helpful, especially for the workaround to linking a binary exceeds 2 GB. With this workaround, I can statically link cuBLAS 11.8 regardless of customers’ environment.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.