diff --git a/CMakeLists.txt b/CMakeLists.txt index ea44dcb86..3aa2ead67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,6 +215,14 @@ if(ENABLE_TRT_BACKEND) find_package(Python COMPONENTS Interpreter Development REQUIRED) message(STATUS "Copying ${TRT_DIRECTORY}/lib to ${CMAKE_CURRENT_BINARY_DIR}/third_libs/install/tensorrt/lib ...") execute_process(COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/copy_directory.py ${TRT_DIRECTORY}/lib ${CMAKE_CURRENT_BINARY_DIR}/third_libs/install/tensorrt/lib) + if(UNIX) + execute_process(COMMAND sh -c "ls *.so*" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/third_libs/install/tensorrt/lib + COMMAND sh -c "xargs patchelf --set-rpath '$ORIGIN'" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/third_libs/install/tensorrt/lib + RESULT_VARIABLE result + OUTPUT_VARIABLE curr_out + ERROR_VARIABLE curr_out) + message(STATUS "result:${result} out:${curr_out}") + endif() endif() diff --git a/examples/vision/segmentation/paddleseg/python/infer.py b/examples/vision/segmentation/paddleseg/python/infer.py index 28903e929..387781591 100644 --- a/examples/vision/segmentation/paddleseg/python/infer.py +++ b/examples/vision/segmentation/paddleseg/python/infer.py @@ -32,8 +32,8 @@ def build_option(args): if args.use_trt: option.use_trt_backend() - option.set_trt_input_shape("inputs", [1, 3, 224, 224], - [1, 3, 224, 224], [1, 3, 224, 224]) + option.set_trt_input_shape("x", [1, 3, 256, 256], [1, 3, 1024, 1024], + [1, 3, 2048, 2048]) return option diff --git a/setup.py b/setup.py index abcfcb4a1..749e82c49 100644 --- a/setup.py +++ b/setup.py @@ -421,8 +421,9 @@ if sys.argv[1] == "install" or sys.argv[1] == "bdist_wheel": print(command) # The sw_64 not suppot patchelf, so we just disable that. if platform.machine() != 'sw_64' and platform.machine() != 'mips64': - assert os.system( - command) == 0, "patchelf {} failed, the command: {}".format( + assert subprocess.Popen( + command, + shell=True) != 0, "patchelf {} failed, the command: {}".format( command, pybind_so_file) elif platform.system().lower() == "darwin": pre_commands = [ @@ -451,12 +452,13 @@ if sys.argv[1] == "install" or sys.argv[1] == "bdist_wheel": path)) + pybind_so_file) for command in pre_commands: try: - os.system(command) + subprocess.Popen(command, shell=True) except: print("Skip execute command: " + command) for command in commands: - assert os.system( - command) == 0, "command execute failed! command: {}".format( + assert subprocess.Popen( + command, + shell=True) != 0, "command execute failed! command: {}".format( command) all_files = get_all_files(os.path.join(PACKAGE_NAME, "libs"))