From 3329fe45e423a2c92f48d7be279f826607521b70 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 6 Mar 2026 16:04:58 -0500 Subject: [PATCH 1/4] fix(core,pathfinder): harden optional NVVM and nvJitLink imports Add a shared `optional_cuda_import` API in cuda.pathfinder so optional module checks only suppress genuinely unavailable modules or dynamic libs while still surfacing nested import bugs. Wire cuda.core NVVM/nvJitLink detection to this helper and declare cuda-pathfinder as a direct cuda-core dependency. Made-with: Cursor --- cuda_pathfinder/cuda/pathfinder/__init__.py | 1 + cuda_pathfinder/docs/source/release/1.4.1-notes.rst | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/cuda_pathfinder/cuda/pathfinder/__init__.py b/cuda_pathfinder/cuda/pathfinder/__init__.py index 16711385b7..10785d8d20 100644 --- a/cuda_pathfinder/cuda/pathfinder/__init__.py +++ b/cuda_pathfinder/cuda/pathfinder/__init__.py @@ -24,6 +24,7 @@ from cuda.pathfinder._headers.find_nvidia_headers import ( locate_nvidia_header_directory as locate_nvidia_header_directory, ) +from cuda.pathfinder._optional_cuda_import import optional_cuda_import as optional_cuda_import from cuda.pathfinder._headers.supported_nvidia_headers import SUPPORTED_HEADERS_CTK as _SUPPORTED_HEADERS_CTK from cuda.pathfinder._optional_cuda_import import optional_cuda_import as optional_cuda_import from cuda.pathfinder._static_libs.find_bitcode_lib import ( diff --git a/cuda_pathfinder/docs/source/release/1.4.1-notes.rst b/cuda_pathfinder/docs/source/release/1.4.1-notes.rst index 836a62f03d..3e3846a6df 100644 --- a/cuda_pathfinder/docs/source/release/1.4.1-notes.rst +++ b/cuda_pathfinder/docs/source/release/1.4.1-notes.rst @@ -33,6 +33,11 @@ Highlights libraries: site-packages, Conda, then CUDA_HOME/CUDA_PATH. (`PR #1690 `_) +* Add ``optional_cuda_import()`` to support robust optional imports of CUDA + Python modules. It returns ``None`` when the requested module is absent or a + probe hits ``DynamicLibNotFoundError``, while still re-raising unrelated + ``ModuleNotFoundError`` exceptions (for missing transitive dependencies). + * Fix site-packages search order for virtual environments created with ``--system-site-packages``. The search now correctly prioritizes the venv's site-packages before user-site-packages, conforming to PEP 405. From 6a1d31cbea15615b8c64e0903af941def1b33ea5 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 6 Mar 2026 16:10:20 -0500 Subject: [PATCH 2/4] chore(pathfinder): address pre-commit follow-ups Apply ruff-preferred import ordering in pathfinder exports and rename an unused test lambda argument so repository-wide pre-commit checks pass cleanly. Made-with: Cursor --- cuda_pathfinder/cuda/pathfinder/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cuda_pathfinder/cuda/pathfinder/__init__.py b/cuda_pathfinder/cuda/pathfinder/__init__.py index 10785d8d20..16711385b7 100644 --- a/cuda_pathfinder/cuda/pathfinder/__init__.py +++ b/cuda_pathfinder/cuda/pathfinder/__init__.py @@ -24,7 +24,6 @@ from cuda.pathfinder._headers.find_nvidia_headers import ( locate_nvidia_header_directory as locate_nvidia_header_directory, ) -from cuda.pathfinder._optional_cuda_import import optional_cuda_import as optional_cuda_import from cuda.pathfinder._headers.supported_nvidia_headers import SUPPORTED_HEADERS_CTK as _SUPPORTED_HEADERS_CTK from cuda.pathfinder._optional_cuda_import import optional_cuda_import as optional_cuda_import from cuda.pathfinder._static_libs.find_bitcode_lib import ( From 339e3d9844921374c79f678d03dfcdb92b61d9b7 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 6 Mar 2026 17:41:01 -0500 Subject: [PATCH 3/4] address review feedback for issue 980 PR Raise the cuda-core dependency floor to cuda-pathfinder>=1.4.2, move the new optional import note to 1.4.2 release notes, and simplify nvJitLink warning text by inlining the fixed version detail. Made-with: Cursor --- cuda_pathfinder/docs/source/release/1.4.1-notes.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cuda_pathfinder/docs/source/release/1.4.1-notes.rst b/cuda_pathfinder/docs/source/release/1.4.1-notes.rst index 3e3846a6df..836a62f03d 100644 --- a/cuda_pathfinder/docs/source/release/1.4.1-notes.rst +++ b/cuda_pathfinder/docs/source/release/1.4.1-notes.rst @@ -33,11 +33,6 @@ Highlights libraries: site-packages, Conda, then CUDA_HOME/CUDA_PATH. (`PR #1690 `_) -* Add ``optional_cuda_import()`` to support robust optional imports of CUDA - Python modules. It returns ``None`` when the requested module is absent or a - probe hits ``DynamicLibNotFoundError``, while still re-raising unrelated - ``ModuleNotFoundError`` exceptions (for missing transitive dependencies). - * Fix site-packages search order for virtual environments created with ``--system-site-packages``. The search now correctly prioritizes the venv's site-packages before user-site-packages, conforming to PEP 405. From 0242b7245fff5ffb7d61dfa618d7c0e78f6d553f Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Fri, 6 Mar 2026 18:18:13 -0500 Subject: [PATCH 4/4] fix(core): use released cuda-pathfinder dependency floor Set the cuda-core runtime dependency to cuda-pathfinder>=1.4.1 and add a TODO to bump to >=1.4.2 after that release is available so environment solves continue to work. Made-with: Cursor --- cuda_core/pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cuda_core/pyproject.toml b/cuda_core/pyproject.toml index 9b3e5a37c5..2710818816 100644 --- a/cuda_core/pyproject.toml +++ b/cuda_core/pyproject.toml @@ -47,7 +47,8 @@ classifiers = [ "Environment :: GPU :: NVIDIA CUDA :: 13", ] dependencies = [ - "cuda-pathfinder >=1.4.2", + # TODO: bump to >=1.4.2 once cuda-pathfinder 1.4.2 is released. + "cuda-pathfinder >=1.4.1", "numpy", ]