[BUG] lmp entry point does not preload nvJitLink, so the wheels' cuSPARSE and cuSOLVER can bind an older toolkit libnvJitLink
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 73/100
Hướng nghiên cứu
Bắt đầu với deepmd/lmp.py và kiểm tra cách danh sách LD_PRELOAD được tạo thông qua get_library_path; báo cáo xác định thư viện còn thiếu nvidia.nvjitlink.lib và thứ tự tải cần thiết. Tái hiện lỗi bằng các lệnh LD_BIND_NOW=1 được cung cấp và toolkit CUDA 12.8 trên LD_LIBRARY_PATH. Hoàn tất khi việc nạp trước nvJitLink của wheel trước cuSOLVER và cuSPARSE tránh được lỗi tra cứu symbol được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug summary
deepmd/lmp.py, which sets up the environment of the lmp entry point of deepmd-kit[lmp], puts the CUDA libraries of the NVIDIA wheels into LD_PRELOAD: cudart, cublasLt, cublas, cufft, curand, cusolver, cusparse and cudnn. libnvJitLink is missing from that list, although three of the preloaded wheel libraries have it as a DT_NEEDED dependency: libcusparse.so.12, libcusolver.so.11 and libcusolverMg.so.11.
The dynamic loader resolves that dependency through LD_LIBRARY_PATH before it tries the wheel library's own RUNPATH ($ORIGIN/../../nvjitlink/lib). Clusters often put a CUDA toolkit on LD_LIBRARY_PATH, for example through a cuda/12.x module. If that toolkit is older than the CUDA of the torch wheel, the preloaded cuSPARSE binds the toolkit's older libnvJitLink.so.12. That library lacks the versioned symbols of the newer release, so the process fails with a symbol lookup error.
DeePMD-kit Version
master (668b60cc2); deepmd/lmp.py is unchanged since #5707
Backend and its version
PyTorch 2.13.0+cu129 (pip, with the NVIDIA CUDA wheels); CUDA toolkit 12.8 on LD_LIBRARY_PATH; driver 535.161.08
How did you download the software?
Built from source
Input Files, Running Commands, Error Log, etc.
We hit it while porting to an H20 node, in a LAMMPS built from source against the same pip torch (not the deepmd-kit[lmp] wheel), when DeePMD-kit loaded the PyTorch exportable backend for a .pt2 model:
Unable to load PyTorch Exportable backend plugin (libdeepmd_backend_ptexpt.so) ... nvidia/cusparse/lib/libcusparse.so.12: undefined symbol: __nvJitLinkGetErrorLogSize_12_9, version libnvJitLink.so.12
We did not run the deepmd-kit[lmp] wheel itself; how it is affected follows from the preload list and the reproduction below. A Python process is not affected, because torch loads the libraries of its own wheels first.
Steps to Reproduce
SITE is the site-packages of an environment with torch==2.13.0+cu129 and its NVIDIA wheels; /usr/local/cuda is a CUDA 12.8 toolkit. Test 1 preloads cuSPARSE the way deepmd/lmp.py does, with the older toolkit on LD_LIBRARY_PATH:
LD_BIND_NOW=1 LD_LIBRARY_PATH=/usr/local/cuda/lib64 \
LD_PRELOAD=$SITE/nvidia/cusparse/lib/libcusparse.so.12 /bin/true
# /bin/true: symbol lookup error: .../nvidia/cusparse/lib/libcusparse.so.12: undefined symbol: __nvJitLinkGetErrorLogSize_12_9, version libnvJitLink.so.12
# exit status 127
Test 2 preloads the wheel's nvJitLink first:
LD_BIND_NOW=1 LD_LIBRARY_PATH=/usr/local/cuda/lib64 \
LD_PRELOAD=$SITE/nvidia/nvjitlink/lib/libnvJitLink.so.12:$SITE/nvidia/cusparse/lib/libcusparse.so.12 /bin/true
# exit status 0
LD_BIND_NOW=1 makes the error appear at startup. Without it, the error appears when the symbols are first resolved; in our run, that was when the backend plugin was loaded.
The wheel libraries that need nvJitLink can be listed with readelf -d:
for f in $SITE/nvidia/*/lib/lib*.so.*; do readelf -d "$f" | grep -q 'NEEDED.*libnvJitLink' && echo "$f"; done
# .../nvidia/cusolver/lib/libcusolver.so.11
# .../nvidia/cusolver/lib/libcusolverMg.so.11
# .../nvidia/cusparse/lib/libcusparse.so.12
Further Information, Files, and Links
Suggested fix: preload the wheel's nvJitLink ahead of cuSOLVER and cuSPARSE. LD_PRELOAD loads its entries in order, and a library that is already loaded satisfies a later DT_NEEDED with the same soname:
*get_library_path("nvidia.cuda_runtime.lib", "libcudart.so*"),
*get_library_path("nvidia.nvjitlink.lib", "libnvJitLink.so*"),
*get_library_path("nvidia.cublas.lib", "libcublasLt.so*"),
...
A related observation, which we have not traced further: the CUDA 13 builds of PyTorch (seen with torch==2.13.0+cu130) install their CUDA libraries into a single nvidia/cu13/lib directory, with no nvidia.cuda_runtime, nvidia.cusparse, ... packages. With such a torch, get_library_path matches none of the entries above, and nothing is preloaded.
- Ngôn ngữ chính
- Python
- Star
- 2.1k
- Fork
- 661
- Merge trung bình
- 4 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của deepmodeling/deepmd-kit
-
Fine-tune descriptor mismatch warning should ignore seedCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
deepmodeling/deepmd-kit#6038 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Docs enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
deepmodeling/deepmd-kit#5766 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Code scan] Freeze Paddle DPA3 parameters with stop_gradientCó thể đã có người làm @njzjz đã nhận 98 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
deepmodeling/deepmd-kit#5686 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
branch: master lang: py todo comment type: todo
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
deepmodeling/deepmd-kit#5480 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
branch: master lang: toml todo comment type: todo
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
deepmodeling/deepmd-kit#5462 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của deepmodeling/deepmd-kit
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ansys/pyansys-common-mcp#213 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
freedomofpress/dangerzone#1594 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
priority:P1 status:in-review type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
randomparity/kdive#3317 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:ci
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
mesonbuild/meson#16281 ·
Maintainer thường phản hồi trong vòng 1 ngày