mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 17:17:14 +08:00
[Other] Use symbolic link pointed to TensorRT library (#1461)
* Add force rpath * update to dev-6 * remove force-rpath * remove nvinfer so * Add symbol link creation when import fastdeploy first * Add dst * update symbol link creation * Add logging * logging -> logger * update tips * Set logging level * Add --force-rpath
This commit is contained in:
@@ -16,6 +16,32 @@ import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Create a symbol link to tensorrt library.
|
||||
trt_directory = os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)),
|
||||
"libs/third_libs/tensorrt/lib/")
|
||||
if os.name != "nt" and os.path.exists(trt_directory):
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
for trt_lib in [
|
||||
"libnvcaffe_parser.so", "libnvinfer_plugin.so", "libnvinfer.so",
|
||||
"libnvonnxparser.so", "libnvparsers.so"
|
||||
]:
|
||||
dst = os.path.join(trt_directory, trt_lib)
|
||||
src = os.path.join(trt_directory, trt_lib + ".8")
|
||||
if not os.path.exists(dst):
|
||||
try:
|
||||
os.symlink(src, dst)
|
||||
logging.info(
|
||||
f"Create a symbolic link pointing to {src} named {dst}.")
|
||||
except OSError as e:
|
||||
logging.warning(
|
||||
f"Failed to create a symbolic link pointing to {src} by an unprivileged user. "
|
||||
"It may failed when you use Paddle TensorRT backend. "
|
||||
"Please use administator privilege to import fastdeploy at first time."
|
||||
)
|
||||
break
|
||||
logging.basicConfig(level=logging.NOTSET)
|
||||
|
||||
# Note(zhoushunjie): Fix the import order of paddle and fastdeploy library.
|
||||
# This solution will be removed it when the confilct of paddle and
|
||||
# fastdeploy is fixed.
|
||||
|
Reference in New Issue
Block a user