Skip to content

Workflow for executing examples - #445

Merged
oleksandr-pavlyk merged 28 commits into
NVIDIA:mainfrom
oleksandr-pavlyk:workflow-for-executing-examples
Aug 4, 2026
Merged

Workflow for executing examples#445
oleksandr-pavlyk merged 28 commits into
NVIDIA:mainfrom
oleksandr-pavlyk:workflow-for-executing-examples

Conversation

@oleksandr-pavlyk

Copy link
Copy Markdown
Collaborator

This PR

  1. Fixes code in examples to change stream argument of MemoryResource.allocate method from position to keyword. Recent changes in cuda.core made the argument keyword-only one.

  2. Adds python/examples/stream.py example, parallel to C++ examples/stream.cu

  3. Adds a workflow to run examples periodically, manually and as part of PR to ensure that examples remain runnable.

    • Manual and periodic runs use latest versions of packages used by python/examples/*.py from main branch
    • PR jobs are constrained to versions known to have worked for source in main branch, and execute sources from the branch
    • Manual and periodic runs output versions used in the format suitable for updating the constraint file python/examples/requirements/constraints-cu13-py313.txt

Closes #444

```
usage: run_python_examples.py [-h] [--group {all,autotune,core-cccl,cpu,cuda-compute,cupy,cute,example-cpu,gpu,light-gpu,numba,pr,smoke,syntax,torch}] [--case CASE] [--python PYTHON] [--repo-root REPO_ROOT] [--device DEVICE] [--timeout TIMEOUT]
                              [--skip-missing-deps] [--continue-on-failure] [--verbose] [--list]

Run syntax and smoke checks for committed Python examples.

options:
  -h, --help            show this help message and exit
  --group {all,autotune,core-cccl,cpu,cuda-compute,cupy,cute,example-cpu,gpu,light-gpu,numba,pr,smoke,syntax,torch}
                        Group to run. May be specified multiple times. Defaults to 'syntax'. Use 'pr' for syntax plus CPU-only smoke.
  --case CASE           Run a selected case from the selected groups. May be repeated.
  --python PYTHON       Python executable used for checks and example subprocesses.
  --repo-root REPO_ROOT
                        Repository root. Defaults to the parent directory of this script.
  --device DEVICE       NVBench device selector passed to GPU examples. Defaults to 0.
  --timeout TIMEOUT     Timeout in seconds for the syntax check.
  --skip-missing-deps   Skip runtime cases whose required Python modules are not installed.
  --continue-on-failure
                        Continue running later cases after a failure.
  --verbose             Print stdout/stderr from passing commands.
  --list                List known groups and runtime cases, then exit.
```

This is intended for running examples in CI to ensure that examples remain current against changes upstream
test_python_examples_inner checks that workspace directory
exists before executing find command that access it
Use a checked-in constraints file for required Python example CI so
unrelated upstream dependency releases do not break PRs. Add a floating
dependency mode for scheduled/manual runs that prints full pip freezes and
a filtered constraints candidate for tracked packages.

Rename the aggregate example requirements file to all-cu13.txt to make the
CUDA 13 scope explicit.
Address other review feedback points
@oleksandr-pavlyk

This comment was marked as outdated.

@coderabbitai

This comment was marked as outdated.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added a stream-processing benchmark example for measuring GPU memory and element performance.
    • Added support for running Python examples across CPU and GPU configurations, with selectable groups and clear results.
    • Added optional heavy-example and flexible-dependency test modes, including scheduled GPU validation.
  • Bug Fixes

    • Improved CUDA stream handling in several Python examples for more reliable device-memory operations.
  • Chores

    • Consolidated dependencies for CUDA 13 and Python 3.13 testing.
    • Added automated dependency consistency checks and expanded example test coverage.

Walkthrough

Summary

The pull request adds GPU CI coverage for Python examples, containerized test scripts, dependency constraints, an example runner, stream keyword fixes, and a CuPy benchmark.

Changes

Python example CI

Layer / File(s) Summary
Example runner
ci/run_python_examples.py
Adds configured example cases, group selection, dependency checks, subprocess execution, timeout handling, syntax checks, result reporting, and exit codes.
Containerized example environments
ci/test_python_examples.sh, ci/test_python_examples_inner.sh
Runs grouped Python examples in a CUDA container with isolated environments and optional floating-dependency testing.
Example dependency definitions and constraint reporting
ci/format_python_example_constraints.py, ci/test_format_python_example_constraints.py, python/examples/requirements/*
Adds recursive requirements, Python 3.13 CUDA 13 constraints, freeze collection, constraint candidate reporting, and parser tests.
Scheduled and gated workflow execution
.github/workflows/build-and-test-python-wheels.yml
Adds configurable inputs, scheduled heavy and floating-dependency runs, GPU example testing, and workflow failure handling.
Example allocation and benchmark updates
python/examples/axes.py, python/examples/cute_dsl_sgemm.py, python/examples/exec_tag_sync.py, python/examples/exec_tag_timer.py, python/examples/stream.py
Changes device allocations to pass stream by keyword, centralizes the default CuTe stream, and adds a CuPy stream benchmark.

Assessment against linked issues

Objective Addressed Explanation
Update Python examples to pass stream as a keyword argument [444]
Add CI coverage that detects Python example breakages [444]

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
New CuPy stream benchmark (python/examples/stream.py) This adds a new benchmark rather than updating failing allocation calls or adding CI coverage for existing examples.

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]

This comment was marked as resolved.

@oleksandr-pavlyk

This comment was marked as outdated.

@coderabbitai

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

@oleksandr-pavlyk

This comment was marked as outdated.

@coderabbitai

This comment was marked as outdated.

coderabbitai[bot]

This comment was marked as resolved.

@oleksandr-pavlyk
oleksandr-pavlyk marked this pull request as ready for review August 3, 2026 21:40
@oleksandr-pavlyk
oleksandr-pavlyk requested a review from shwina August 3, 2026 21:40
@oleksandr-pavlyk oleksandr-pavlyk self-assigned this Aug 3, 2026
@oleksandr-pavlyk oleksandr-pavlyk added area: examples Related to example code. area: ci Related to CI infrastructure python labels Aug 3, 2026
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Aug 3, 2026
@oleksandr-pavlyk oleksandr-pavlyk moved this from Todo to In Review in CCCL Aug 3, 2026
Comment thread ci/test_python_examples_inner.sh Outdated

@shwina shwina left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Python changes look good to me. I didn't review the CI scripts in much detail but they should be fine.

@oleksandr-pavlyk
oleksandr-pavlyk merged commit 25f5328 into NVIDIA:main Aug 4, 2026
62 checks passed
@oleksandr-pavlyk
oleksandr-pavlyk deleted the workflow-for-executing-examples branch August 4, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci Related to CI infrastructure area: examples Related to example code. python

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Execution of Python examples run into errors

2 participants