Skip to content

Commit 2d2ff4b

Browse files
LuLu
authored andcommitted
set library rpath for both 'pip install .'
1 parent 8ef6453 commit 2d2ff4b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

setup.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ def get_dp_install_path() :
1212
python_version = 'py' + str(sys.version_info.major + sys.version_info.minor * 0.1)
1313
os_info = sys.platform
1414
machine_info = platform.machine()
15-
dp_install_path = site_packages_path + '/deepmd_kit-' + dp_scm_version + '-' + python_version + '-' + os_info + '-' + machine_info + '.egg/deepmd'
15+
dp_pip_install_path = site_packages_path + '/deepmd'
16+
dp_setup_install_path = site_packages_path + '/deepmd_kit-' + dp_scm_version + '-' + python_version + '-' + os_info + '-' + machine_info + '.egg/deepmd'
1617

17-
return dp_install_path
18+
return dp_pip_install_path, dp_setup_install_path
1819

1920
readme_file = path.join(path.dirname(path.abspath(__file__)), 'README.md')
2021
try:
@@ -45,7 +46,7 @@ def get_dp_install_path() :
4546
except OSError:
4647
pass
4748

48-
dp_install_path = get_dp_install_path()
49+
dp_pip_install_path, dp_setup_install_path = get_dp_install_path()
4950

5051
setup(
5152
name="deepmd-kit",
@@ -69,7 +70,8 @@ def get_dp_install_path() :
6970
'-DBUILD_PY_IF:BOOL=TRUE',
7071
'-DBUILD_CPP_IF:BOOL=FALSE',
7172
'-DFLOAT_PREC:STRING=high',
72-
'-DDP_INSTALL_PATH=%s' % dp_install_path,
73+
'-DDP_PIP_INSTALL_PATH=%s' % dp_pip_install_path,
74+
'-DDP_SETUP_INSTALL_PATH=%s' % dp_setup_install_path,
7375
],
7476
cmake_source_dir='source',
7577
cmake_minimum_required_version='3.0',

source/op/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ endif (BUILD_CPP_IF)
2525

2626
if (BUILD_PY_IF)
2727
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
28-
set(CMAKE_INSTALL_RPATH DESTINATION ${DP_INSTALL_PATH})
28+
set(CMAKE_INSTALL_RPATH DESTINATION ${DP_PIP_INSTALL_PATH} ${DP_SETUP_INSTALL_PATH} ${CMAKE_BINARY_DIR}/op/cuda)
2929
if (USE_CUDA_TOOLKIT)
3030
add_library(op_abi SHARED ${OP_PY_CUDA_SRC} ${OP_LIB})
3131
add_library(op_grads SHARED ${OP_GRADS_SRC})

0 commit comments

Comments
 (0)