Skip to content

fix: split cuda_core example runtime deps and clarify GL import errors#1

Open
cpcloud wants to merge 7 commits intoexamples-naming-conventionsfrom
gl-example-and-pixi-pr
Open

fix: split cuda_core example runtime deps and clarify GL import errors#1
cpcloud wants to merge 7 commits intoexamples-naming-conventionsfrom
gl-example-and-pixi-pr

Conversation

@cpcloud
Copy link
Copy Markdown
Owner

@cpcloud cpcloud commented Mar 4, 2026

Summary

  • move CUDA example runtime dependencies (cupy, pytorch, cffi, pyglet, libgl-devel) out of the cu13 test environment into a dedicated examples pixi environment in cuda_core
  • keep cu13 test env focused on test dependencies while preserving an example-runner environment (pixi run -e examples ...)
  • fix gl_interop_plasma.py import UX: when pyglet is installed but OpenGL loading fails (for example, missing libGL.so), surface the real underlying ImportError instead of the misleading "requires pyglet >= 2.0" message

Bug / UX Context

gl_interop_plasma.py wrapped both import pyglet and from pyglet.gl import gl in one ImportError handler that always printed a pyglet-version installation hint. In practice, this masked distinct failures:

  • missing pyglet
  • OpenGL runtime import failures (e.g., Library \"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.py starts and runs (times out by design for GUI loop)
  • pixi run --frozen -e examples python -c "import cupy, torch, cffi, pyglet" succeeds
  • pixi run --frozen -e cu13 python -c "import cupy" fails as expected, confirming example deps are no longer in test env

Made with Cursor

cpcloud added 7 commits March 4, 2026 05:45
- 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
@cpcloud cpcloud force-pushed the examples-naming-conventions branch from 087fe8c to fbd1ede Compare March 4, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant