Skip to content

Commit dd0b96a

Browse files
author
Han Wang
committed
fix(ci): install custom op .so to deepmd/lib before gen scripts
The gen scripts import deepmd.pt which loads custom ops from deepmd/lib/. Without the .so installed there, the custom op (tabulate_fusion_se_t_tebd) is unavailable and .pth export fails for DPA2/DPA3 models, causing C++ tests to fail on missing files. Fix: copy libdeepmd_op_pt.so from the build directory to the deepmd package's lib/ directory after cmake --build, before running gen scripts.
1 parent 460ccf7 commit dd0b96a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

source/install/test_cc_local.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ cmake --build . -j${NPROC}
3535
cmake --install .
3636
# Generate PT/PT2 model files for C++ tests.
3737
# Must run after cmake --build so that libdeepmd_op_pt.so (custom ops) is available.
38+
# Install the custom op .so to deepmd/lib/ so that `import deepmd.pt` can find it.
39+
# This prevents double-registration crashes when gen scripts also search build dirs.
40+
_OP_SO=$(find ${BUILD_TMP_DIR} -name 'libdeepmd_op_pt.so' 2>/dev/null | head -1)
41+
if [ -n "${_OP_SO}" ]; then
42+
_DEEPMD_LIB=$(python -c 'import deepmd,os;print(os.path.join(os.path.dirname(deepmd.__file__),"lib"))' 2>/dev/null)
43+
if [ -n "${_DEEPMD_LIB}" ]; then
44+
mkdir -p "${_DEEPMD_LIB}"
45+
cp "${_OP_SO}" "${_DEEPMD_LIB}/"
46+
fi
47+
fi
3848
# When the build uses -fsanitize=leak, the custom op .so requires the LSAN
3949
# runtime to be preloaded (otherwise dlopen fails). We disable leak detection
4050
# in the gen scripts to avoid false reports from torch/paddle internals.

0 commit comments

Comments
 (0)