Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/test-wheel-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,15 @@ jobs:
uses: nv-gha-runners/setup-proxy-cache@main
continue-on-error: true

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Install dependencies
uses: ./.github/actions/install_unix_deps
continue-on-error: false
with:
# for artifact fetching, graphics libs
dependencies: "jq wget libgl1 libegl1"
dependencies: "jq wget libgl1 libegl1 g++"
dependent_exes: "jq wget"

- name: Set environment variables
Expand Down Expand Up @@ -277,6 +280,13 @@ jobs:
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
run: run-tests core

- name: Run cuda.core examples with PEP 723 metadata in isolation
env:
CUDA_VER: ${{ matrix.CUDA_VER }}
LOCAL_CTK: ${{ matrix.LOCAL_CTK }}
run: |
ci/tools/run-examples-pep723 cuda_core/examples/
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running the full cuda_core/examples/ directory via uv run in CI inherits the same risk as the tool: examples that are interactive, long-running, or require a display/context can hang/fail the workflow. It would be more reliable to call the tool with a curated subset of examples known to terminate quickly (or to add filtering/timeout support in the tool and use it here).

Suggested change
ci/tools/run-examples-pep723 cuda_core/examples/
timeout 600 ci/tools/run-examples-pep723 cuda_core/examples/

Copilot uses AI. Check for mistakes.

- name: Ensure cuda-python installable
run: |
if [[ "${{ matrix.LOCAL_CTK }}" == 1 ]]; then
Expand Down
43 changes: 43 additions & 0 deletions ci/tools/run-examples-pep723
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# Runs a directory of examples using `uv run` to test that the PEP 723
# dependency metadata in them is valid.

# We allow a resolution to fail for cuda_core or cuda_bindings only, since there
# we assume it is pinned to some future release. This allows examples to be
# written for unreleased features. Testing examples against prereleases is
# already covered by CI elsewhere.

TARGET_DIR=$1

if [ -z "$TARGET_DIR" ]; then
echo "Usage: $0 <directory>"
exit 1
fi

FAILED=0

while IFS= read -r -d '' file; do
echo "Running $file..."
OUTPUT=$(uv run "$file" 2>&1)
EXIT_CODE=$?

if [ $EXIT_CODE -ne 0 ]; then
if echo "$OUTPUT" | grep -Eq "Because only cuda-(core|bindings)"; then
echo "SKIPPED: $file (No solution found)"
else
echo "FAILED: $file"
echo "$OUTPUT"
FAILED=1
fi
else
echo "PASSED: $file"
fi
Comment on lines +28 to +38
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The skip logic depends on matching a specific uv error message substring. This is brittle across uv versions and may incorrectly fail CI if the phrasing changes. A more robust approach is to detect resolution failure via a stable signal (e.g., uv structured output if available, or matching more generic markers like No solution found plus the specific package name), and keep the skip condition tightly scoped to dependency resolution errors rather than all runtime/exception outputs.

Copilot uses AI. Check for mistakes.
done < <(find "$TARGET_DIR" -name "*.py" -print0)
Comment on lines +23 to +39
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script executes every *.py example it finds, not just dependency resolution. That can hang or fail in CI for interactive/GUI/long-running examples (e.g., ones that open windows or run until user exits), which makes the metadata check flaky. Consider adding an allowlist of non-interactive examples, or enforcing a timeout per script (and treating timeouts as a separate/controlled outcome), or switching the validation approach to only validate dependency resolution without running the full example body.

Copilot uses AI. Check for mistakes.

if [ $FAILED -ne 0 ]; then
exit 1
fi
6 changes: 5 additions & 1 deletion cuda_core/examples/cuda_graphs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -10,6 +10,10 @@
#
# ################################################################################

# /// script
# dependencies = ["cuda_bindings", "cuda_core", "cupy-cuda13x"]
# ///

import sys
import time

Expand Down
7 changes: 4 additions & 3 deletions cuda_core/examples/gl_interop_plasma.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@
# effect popular in the demoscene). The window title shows the current FPS.
# Close the window or press Escape to exit.
#
# Requirements
# ============
# pip install pyglet

# /// script
# dependencies = ["cuda_bindings", "cuda_core>0.6.0", "pyglet"]
# ///

import ctypes
import sys
Expand Down
6 changes: 5 additions & 1 deletion cuda_core/examples/jit_lto_fractal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -12,6 +12,10 @@
#
# ################################################################################

# /// script
# dependencies = ["cuda_bindings", "cuda_core", "cupy-cuda13x"]
# ///

import argparse
import sys

Expand Down
6 changes: 5 additions & 1 deletion cuda_core/examples/memory_ops.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -10,6 +10,10 @@
#
# ################################################################################

# /// script
# dependencies = ["cuda_bindings", "cuda_core", "cupy-cuda13x", "numpy"]
# ///

import sys

import cupy as cp
Expand Down
6 changes: 5 additions & 1 deletion cuda_core/examples/pytorch_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -9,6 +9,10 @@
#
# ################################################################################

# /// script
# dependencies = ["cuda_bindings", "cuda_core", "torch"]
# ///

import sys

import torch
Expand Down
6 changes: 5 additions & 1 deletion cuda_core/examples/saxpy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -10,6 +10,10 @@
#
# ################################################################################

# /// script
# dependencies = ["cuda_bindings", "cuda_core", "cupy-cuda13x"]
# ///

import sys

import cupy as cp
Expand Down
6 changes: 5 additions & 1 deletion cuda_core/examples/show_device_properties.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -9,6 +9,10 @@
#
# ################################################################################

# /// script
# dependencies = ["cuda_bindings", "cuda_core"]
# ///

import sys

from cuda.core import Device, system
Expand Down
6 changes: 5 additions & 1 deletion cuda_core/examples/simple_multi_gpu_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -9,6 +9,10 @@
#
# ################################################################################

# /// script
# dependencies = ["cuda_bindings", "cuda_core", "cupy-cuda13x"]
# ///

import sys

import cupy as cp
Expand Down
6 changes: 5 additions & 1 deletion cuda_core/examples/strided_memory_view_cpu.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -9,6 +9,10 @@
#
# ################################################################################

# /// script
# dependencies = ["cuda_bindings", "cuda_core", "cffi", "setuptools", "numpy"]
# ///

import importlib
import string
import sys
Expand Down
6 changes: 5 additions & 1 deletion cuda_core/examples/strided_memory_view_gpu.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -9,6 +9,10 @@
#
# ################################################################################

# /// script
# dependencies = ["cuda_bindings", "cuda_core", "cupy-cuda13x", "numpy"]
# ///

import string
import sys

Expand Down
6 changes: 5 additions & 1 deletion cuda_core/examples/thread_block_cluster.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -10,6 +10,10 @@
#
# ################################################################################

# /// script
# dependencies = ["cuda_bindings", "cuda_core", "numpy"]
# ///

import os
import sys

Expand Down
4 changes: 4 additions & 0 deletions cuda_core/examples/tma_tensor_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#
# ################################################################################

# /// script
# dependencies = ["cuda_bindings", "cuda_core>0.6.0", "cupy-cuda13x", "numpy"]
# ///

import os
import sys

Expand Down
6 changes: 5 additions & 1 deletion cuda_core/examples/vector_add.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -9,6 +9,10 @@
#
# ################################################################################

# /// script
# dependencies = ["cuda_bindings", "cuda_core", "cupy-cuda13x"]
# ///

import cupy as cp

from cuda.core import Device, LaunchConfig, Program, ProgramOptions, launch
Expand Down
Loading