cuda.core: import fails with undefined symbol cudaGetErrorString when _tensor_map is built with -z now (after #2940)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
- #3104 di @seberg — chiusa senza merge
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- build-system
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Cython
- Stelle
- 3.4k
- Fork
- 353
- Merge medio
- 2g 3h
- PR unite (30g)
- 163
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NVIDIA/cuda-python
-
[BUG]: the `__cuda_stream__` deprecation warning points to `Stream(obj)`, which always raisesForse già presa @Iamsohungrynow l’ha presa 5 giorni fa. Apertabug cuda.core P1
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
NVIDIA/cuda-python#3505 · 3 commenti · 1 reazione · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: ProcessInfo.used_gpu_memory returns the NVML_VALUE_NOT_AVAILABLE sentinel as a byte countApertatriage
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
NVIDIA/cuda-python#3468 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
NVIDIA/cuda-python#3409 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: cleanup-pr-previews never removes previews of deleted PRsForse di nuovo libera @rwgk l’ha presa 48 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
NVIDIA/cuda-python#2952 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG]: LocatedHeaderDir is mutable, so callers can poison the cached header-directory lookupForse già presa @rwgk l’ha presa 62 giorni fa. Apertatriage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
NVIDIA/cuda-python#2646 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di NVIDIA/cuda-python
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
layer5io/blowhorn-site#781 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Build support: NativeScriptApertagood first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
[Fix Package]: gladForse già presa @luadebug l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
xmake-io/xmake-repo#11342 ·
I maintainer di solito rispondono entro 1 giorno