Skip to content

Commit 6965c0f

Browse files
author
Pei Yang
committed
reduce trt warning message (PaddlePaddle#28011)
1 parent a6c1807 commit 6965c0f

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

paddle/fluid/platform/dynload/tensorrt.cc

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,9 @@ void* GetTensorRtHandle() {
4545

4646
if (nullptr == dso_handle) {
4747
auto error_msg =
48-
"TensorRT dynamic library (%s) that Paddle depends on is not "
49-
"configured correctly. (error code is %s)\n"
50-
" Suggestions:\n"
51-
" 1. Check if TensorRT "
52-
"is installed correctly and its version is matched with paddlepaddle "
53-
"you installed.\n"
54-
" 2. Configure TensorRT dynamic library environment variables as "
55-
"follows:\n"
56-
" - Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`\n"
57-
" - Windows: set PATH by `set PATH=XXX;%PATH%`\n"
58-
" - Mac: set DYLD_LIBRARY_PATH by `export DYLD_LIBRARY_PATH=...` "
59-
"[Note: After Mac OS 10.11, using the DYLD_LIBRARY_PATH is "
60-
"impossible unless System Integrity Protection (SIP) is disabled.]";
61-
#if !defined(_WIN32)
62-
auto errorno = dlerror();
63-
#else
64-
auto errorno = GetLastError();
65-
#endif // !_WIN32
66-
std::cerr << string::Sprintf(error_msg, dso_name, errorno);
48+
"You are using Paddle compiled with TensorRT, but TensorRT dynamic "
49+
"library is not found. Ignore this if TensorRT is not needed.";
50+
std::cerr << error_msg;
6751
}
6852

6953
return dso_handle;

paddle/fluid/platform/dynload/tensorrt.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ extern void* tensorrt_dso_handle;
5050
}; \
5151
extern DynLoad__##__name __name
5252

53+
#ifdef NV_TENSORRT_MAJOR
5354
#if (NV_TENSORRT_MAJOR >= 6)
5455
#define TENSORRT_RAND_ROUTINE_EACH(__macro) \
5556
__macro(createInferBuilder_INTERNAL); \
@@ -62,6 +63,7 @@ extern void* tensorrt_dso_handle;
6263
#endif
6364

6465
TENSORRT_RAND_ROUTINE_EACH(DECLARE_DYNAMIC_LOAD_TENSORRT_WRAP)
66+
#endif
6567

6668
} // namespace dynload
6769
} // namespace platform

0 commit comments

Comments
 (0)