cuda.core: import fails with undefined symbol cudaGetErrorString when _tensor_map is built with -z now (after #2940)
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
- #3104 von @seberg — ohne Merge geschlossen
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 45/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- python
- Bereich
- build-system
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Cython
- Sterne
- 3.4k
- Forks
- 353
- Ø Merge
- 2 T. 3 Std.
- Gemergte PRs (30 T.)
- 163
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus NVIDIA/cuda-python
-
[BUG]: the `__cuda_stream__` deprecation warning points to `Stream(obj)`, which always raisesEvtl. vergeben @Iamsohungrynow hat das vor 5 Tagen übernommen. Offenbug cuda.core P1
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 86/100
NVIDIA/cuda-python#3505 · 3 Kommentare · 1 Reaktion · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
[BUG]: ProcessInfo.used_gpu_memory returns the NVML_VALUE_NOT_AVAILABLE sentinel as a byte countOffentriage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
NVIDIA/cuda-python#3468 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
NVIDIA/cuda-python#3409 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[BUG]: cleanup-pr-previews never removes previews of deleted PRsEvtl. wieder frei @rwgk hat das vor 48 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
NVIDIA/cuda-python#2952 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
[BUG]: LocatedHeaderDir is mutable, so callers can poison the cached header-directory lookupEvtl. vergeben @rwgk hat das vor 62 Tagen übernommen. Offentriage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
NVIDIA/cuda-python#2646 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in NVIDIA/cuda-python
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
layer5io/blowhorn-site#781 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100