From 3a9c654cee30381d75819e46f7eb4a52237554ba Mon Sep 17 00:00:00 2001 From: yangbofun Date: Tue, 9 Jan 2024 10:04:15 +0800 Subject: [PATCH 1/2] add -Wl,-rpath and modidy the dipu_path and diopi_path --- setup.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index d93b78d8..4ddb1389 100644 --- a/setup.py +++ b/setup.py @@ -22,22 +22,28 @@ def get_ext(): extra_objects = [] library_dirs = library_paths() libraries = ["c10", "torch", "torch_cpu", "torch_python"] - extra_link_args = [] + print(library_dirs) + for i in library_dirs: + extra_link_args = ['-Wl,-rpath,' + i] - dipu_root = _getenv_or_die("DIPU_ROOT") + dipu_path = _getenv_or_die("DIPU_PATH") diopi_path = _getenv_or_die("DIOPI_PATH") + torch_dipu_path = os.path.join(dipu_path, 'torch_dipu') + dipu_lib_path = torch_dipu_path + + extra_link_args += ['-Wl,-rpath,' + dipu_lib_path] vendor_include_dirs = os.getenv("VENDOR_INCLUDE_DIRS") nccl_include_dirs = os.getenv("NCCL_INCLUDE_DIRS") # nv所需 system_include_dirs += [ - dipu_root, - os.path.join(dipu_root, "dist/include"), - os.path.join(diopi_path, "include"), + torch_dipu_path, + os.path.join(torch_dipu_path, "dist/include"), + os.path.join(diopi_path, "proto/include"), ] if vendor_include_dirs: system_include_dirs.append(vendor_include_dirs) if nccl_include_dirs: system_include_dirs.append(nccl_include_dirs) - library_dirs += [dipu_root] + library_dirs += [dipu_lib_path] libraries += ["torch_dipu"] extra_compile_args = {"cxx": []} From 9cfceddd6f8662c612bbe0aa4f0b4505b7931f9b Mon Sep 17 00:00:00 2001 From: yangbofun Date: Tue, 9 Jan 2024 14:10:18 +0800 Subject: [PATCH 2/2] delete print --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 4ddb1389..4d305e85 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,6 @@ def get_ext(): extra_objects = [] library_dirs = library_paths() libraries = ["c10", "torch", "torch_cpu", "torch_python"] - print(library_dirs) for i in library_dirs: extra_link_args = ['-Wl,-rpath,' + i]