Files
nixpkgs/pkgs/development/python-modules/cuda-core/cuda-include-paths.patch
Connor Baker 809eea01c7 python3Packages.cuda-core: fix gpuCheck
The gpuCheck variant (doCheck = true) never got as far as running the
tests:

- It added CCCL to the CUDA_HOME used for the build, which makes
  <cuda/tma> visible to cuda/core/_cpp/tensor_map.cpp. That compiles in
  a CCCL code path that needs crt/host_defines.h, then fails to import
  with "undefined symbol: cudaGetErrorString". Upstream never compiles
  that path (the CUDA Toolkit keeps CCCL in include/cccl/, which the
  build doesn't add), and has since disabled it explicitly; backport
  that change. The build's CUDA_HOME is now the cuda_cudart headers
  alone, without a symlinkJoin.
- The tests and two examples derive the include paths they pass to
  NVRTC from $CUDA_HOME/include and $CUDA_HOME/include/cccl, assuming a
  single toolkit root. Patch them to use the separate CCCL and cudart
  include directories instead.
- The tests import cuda.bindings._test_helpers, which the packaged
  cuda-bindings release doesn't ship; import the copy in the source tree.
- A trailing comma in a parametrize argument list makes pytest 9 unpack a
  NumPy array sample, failing collection of tests/test_utils.py.
- The checkpoint scenarios run in a child interpreter started with -I,
  which ignores PYTHONPATH and can't import pytest.

Also disable tests that fail because cuda-bindings 13.4 has enum members
this cuda.core release doesn't map yet, and one that assumes green
context SM partitions of at least 8 on GB10.

Assisted-by: Claude Code (Claude Opus 5.5, claude-opus-5-5)
2026-10-13 11:48:48 +00:00

72 lines
2.6 KiB
Diff

--- a/examples/thread_block_cluster.py
+++ b/examples/thread_block_cluster.py
@@ -70,18 +70,8 @@
print("This example requires NumPy 2.2.5 or later", file=sys.stderr)
sys.exit(1)
- cuda_path = get_cuda_path_or_home()
- if cuda_path is None:
- print("This example requires CUDA_PATH or CUDA_HOME to point to a CUDA toolkit.", file=sys.stderr)
- sys.exit(1)
- cuda_include = os.path.join(cuda_path, "include")
- if not os.path.isdir(cuda_include):
- print(f"CUDA include directory not found: {cuda_include}", file=sys.stderr)
- sys.exit(1)
- include_path = [cuda_include]
- cccl_include = os.path.join(cuda_include, "cccl")
- if os.path.isdir(cccl_include):
- include_path.insert(0, cccl_include)
+ # Nixpkgs installs CCCL and the CUDA runtime headers in separate prefixes, not under one toolkit root.
+ include_path = ["@cccl@", "@cudartInclude@"]
dev = Device()
arch = dev.compute_capability
--- a/examples/tma_tensor_map.py
+++ b/examples/tma_tensor_map.py
@@ -108,21 +108,8 @@
def _get_cccl_include_paths():
- cuda_path = get_cuda_path_or_home()
- if cuda_path is None:
- print("This example requires CUDA_PATH or CUDA_HOME to point to a CUDA toolkit.", file=sys.stderr)
- sys.exit(1)
-
- cuda_include = os.path.join(cuda_path, "include")
- if not os.path.isdir(cuda_include):
- print(f"CUDA include directory not found: {cuda_include}", file=sys.stderr)
- sys.exit(1)
-
- include_path = [cuda_include]
- cccl_include = os.path.join(cuda_include, "cccl")
- if os.path.isdir(cccl_include):
- include_path.insert(0, cccl_include)
- return include_path
+ # Nixpkgs installs CCCL and the CUDA runtime headers in separate prefixes, not under one toolkit root.
+ return ["@cccl@", "@cudartInclude@"]
def main():
--- a/tests/helpers/__init__.py
+++ b/tests/helpers/__init__.py
@@ -10,16 +10,9 @@
from cuda_python_test_helpers import *
CUDA_PATH = get_cuda_path_or_home()
-CUDA_INCLUDE_PATH = None
-CCCL_INCLUDE_PATHS = None
-if CUDA_PATH is not None:
- path = os.path.join(CUDA_PATH, "include")
- if os.path.isdir(path):
- CUDA_INCLUDE_PATH = path
- CCCL_INCLUDE_PATHS = (path,)
- path = os.path.join(path, "cccl")
- if os.path.isdir(path):
- CCCL_INCLUDE_PATHS = (path,) + CCCL_INCLUDE_PATHS
+# Nixpkgs installs CCCL and the CUDA runtime headers in separate prefixes, not under one toolkit root.
+CUDA_INCLUDE_PATH = "@cudartInclude@"
+CCCL_INCLUDE_PATHS = ("@cccl@", "@cudartInclude@")
@functools.cache