fix: split cuda_core example runtime deps and clarify GL import errors#1
Open
cpcloud wants to merge 7 commits intoexamples-naming-conventionsfrom
Open
fix: split cuda_core example runtime deps and clarify GL import errors#1cpcloud wants to merge 7 commits intoexamples-naming-conventionsfrom
cpcloud wants to merge 7 commits intoexamples-naming-conventionsfrom
Conversation
- Remove success/completion fluff messages ("done!", "passed", etc.)
- Use sys.exit(1) instead of sys.exit(0) for unsupported configurations
- Send skip/warning/error messages to stderr
- Replace user-facing assert with proper checks
- Standardize sys.exit(-1) to sys.exit(1)
Made-with: Cursor
The _test.py files in cuda_bindings/examples/ are run under pytest, so sys.exit(1) for unsupported configurations causes SystemExit(1) which pytest treats as a test failure. Use pytest.skip() instead for platform/device/capability checks that indicate unsupported configs. Actual test failures (incorrect results) still use sys.exit(1). Made-with: Cursor
Apply consistent variable names for common objects across all cuda.core example files, addressing issue NVIDIA#1675. Conventions applied: - Stream: `stream` (not `s`), numbered `stream0`/`stream1` - Kernel: `kernel` (not `ker`/`gpu_ker`), descriptive `add_kernel`/`sub_kernel` - Program: `prog` (not `gpu_prog`) - Kernel args: `kernel_args` (not `ker_args`) - Program options: `program_options` (not `opts`), using ProgramOptions (not dicts) - Grid/block: `grid`/`block` (not `grid_size`/`block_size`) Made-with: Cursor
- Remove success/completion fluff messages ("done!", "passed", etc.)
- Use sys.exit(1) instead of sys.exit(0) for unsupported configurations
- Send skip/warning/error messages to stderr
- Replace user-facing assert with proper checks
- Standardize sys.exit(-1) to sys.exit(1)
Made-with: Cursor
The _test.py files in cuda_bindings/examples/ are run under pytest, so sys.exit(1) for unsupported configurations causes SystemExit(1) which pytest treats as a test failure. Use pytest.skip() instead for platform/device/capability checks that indicate unsupported configs. Actual test failures (incorrect results) still use sys.exit(1). Made-with: Cursor
Add the blank-line separation required by Ruff so pre-commit.ci can complete successfully on this branch. Made-with: Cursor
…rror Move GPU/example-only runtime dependencies into a dedicated `examples` pixi environment so the test environment stays lean, and clarify gl_interop_plasma import failures by reporting the underlying OpenGL import error instead of a generic pyglet version message. Made-with: Cursor
087fe8c to
fbd1ede
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cupy,pytorch,cffi,pyglet,libgl-devel) out of thecu13test environment into a dedicatedexamplespixi environment incuda_corecu13test env focused on test dependencies while preserving an example-runner environment (pixi run -e examples ...)gl_interop_plasma.pyimport UX: whenpygletis installed but OpenGL loading fails (for example, missinglibGL.so), surface the real underlyingImportErrorinstead of the misleading "requires pyglet >= 2.0" messageBug / UX Context
gl_interop_plasma.pywrapped bothimport pygletandfrom pyglet.gl import glin oneImportErrorhandler that always printed a pyglet-version installation hint. In practice, this masked distinct failures:pygletLibrary \"GL\" not found.)The new message preserves the actual exception so users can diagnose system GL/runtime issues correctly.
Validation
timeout 15s pixi run --frozen -e examples python examples/gl_interop_plasma.pystarts and runs (times out by design for GUI loop)pixi run --frozen -e examples python -c "import cupy, torch, cffi, pyglet"succeedspixi run --frozen -e cu13 python -c "import cupy"fails as expected, confirming example deps are no longer in test envMade with Cursor