cuda.core: import fails with undefined symbol cudaGetErrorString when _tensor_map is built with -z now (after #2940)
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
- #3104 來自 @seberg —— 已關閉,未合併
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 45/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- python
- 領域
- build-system
研究方向
The failing symbol comes in through cuda/__driver/entry_point.h, and the extension is built from cuda_core/cuda/core/_tensor_map.pyx with settings in cuda_core/build_hooks.py. Reproduce by building with -Wl,-z,now, then check the result with readelf -d for BIND_NOW and nm -D --undefined-only for cudaGetErrorString. Choose between loading cudart at the top of _tensor_map.pyx or linking it in build_hooks.py. Done when import cuda.core succeeds under -z now without LD_PRELOAD, and the default lazy build still works.
由索引模型根據 Issue 內容生成。
描述
Since #2940 reactivated _tensor_map on CCCL's <cuda/tma>, the extension references the CUDA runtime: cuda/__driver/entry_point.h calls cudaGetErrorString. _tensor_map is not linked against libcudart, and nothing in cuda.core loads cudart before cuda/core/__init__.py imports the module.
With the default flags of a pip build the reference is lazily bound and the import succeeds. With a toolchain that links with -Wl,-z,now, which the conda-forge compilers set in LDFLAGS, the extension carries BIND_NOW and every import cuda.core fails:
ImportError: .../cuda/core/_tensor_map.cpython-314-x86_64-linux-gnu.so: undefined symbol: cudaGetErrorString
Reproduction
Linux, conda-forge environment with Python 3.14, the CUDA 13.4 toolkit, and cuda-bindings 13.4.1; editable build of main.
readelf -don the extension showsBIND_NOWand nolibcudartentry underNEEDED.nm -D --undefined-onlylistscudaGetErrorString.LD_PRELOAD=<env>/lib/libcudart.so.13 python -c "import cuda.core"succeeds; the plain import fails.
CI does not see this because its wheels are built with lazy binding. The conda-forge feedstock builds with the same compilers as the reproduction, so a conda package built from main would likely fail at import unless cudart is already loaded in the process.
Possible fixes
- Load cudart before
_tensor_mapis imported, for examplecuda.pathfinder.load_nvidia_dynamic_lib("cudart")at the top of_tensor_map.pyx. This also covers the lazy-binding case, where the symbol is first needed at run time. - Link
_tensor_mapagainstcudartinbuild_hooks.py.
Affects cuda_core/cuda/core/_tensor_map.pyx and cuda_core/build_hooks.py.
- 主要語言
- Cython
- 星號
- 3.4k
- 分支
- 353
- 平均合併
- 2 天 3 小時
- 30 天內合併 PR
- 163
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
NVIDIA/cuda-python 的其他 Issue
-
[BUG]: the `__cuda_stream__` deprecation warning points to `Stream(obj)`, which always raises可能已有人在做 @Iamsohungrynow 於 5 天前認領。 未關閉bug cuda.core P1
難度 1/5 1 小時以內 新手友好度 86/100
NVIDIA/cuda-python#3505 · 3 則留言 · 1 個 reaction · 已指派 1 人 ·
維護者通常 1 天內回覆
-
[BUG]: ProcessInfo.used_gpu_memory returns the NVML_VALUE_NOT_AVAILABLE sentinel as a byte count未關閉triage
難度 2/5 1-3 小時 新手友好度 80/100
NVIDIA/cuda-python#3468 · 3 則留言 ·
維護者通常 1 天內回覆
-
triage
難度 2/5 1-3 小時 新手友好度 68/100
NVIDIA/cuda-python#3409 ·
維護者通常 1 天內回覆
-
[BUG]: cleanup-pr-previews never removes previews of deleted PRs可能重新可做 @rwgk 於 48 天前認領,目前沒有進行中的 PR。 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
NVIDIA/cuda-python#2952 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
[BUG]: LocatedHeaderDir is mutable, so callers can poison the cached header-directory lookup可能已有人在做 @rwgk 於 62 天前認領。 未關閉triage
難度 2/5 1-3 小時 新手友好度 82/100
NVIDIA/cuda-python#2646 · 1 個 reaction ·
維護者通常 1 天內回覆
查看 NVIDIA/cuda-python 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
-
難度 2/5 1-3 小時 新手友好度 72/100
layer5io/blowhorn-site#781 ·
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
good first issue
難度 2/5 1-3 小時 新手友好度 78/100
-
難度 2/5 1-3 小時 新手友好度 72/100