Skip to content

Standardize naming conventions across cuda.core examples#1695

Open
cpcloud wants to merge 4 commits intoNVIDIA:mainfrom
cpcloud:examples-naming-conventions
Open

Standardize naming conventions across cuda.core examples#1695
cpcloud wants to merge 4 commits intoNVIDIA:mainfrom
cpcloud:examples-naming-conventions

Conversation

@cpcloud
Copy link
Contributor

@cpcloud cpcloud commented Feb 26, 2026

Summary

Addresses #1675 — standardize variable names for common objects across all cuda.core example files.

Note: This PR is based on #1694 (examples-stderr-out) and should be merged after it.

Conventions applied

Object Standard name Numbered variant
Stream stream stream0, stream1
Kernel kernel descriptive: add_kernel, sub_kernel
Program prog
Program options program_options (using ProgramOptions)
Module mod
Launch config config config0, config1
Grid/block grid/block
Kernel args kernel_args

Changes by file

  • vector_add.py: sstream, kerkernel
  • saxpy.py: sstream, kerkernel, ker_argskernel_args
  • pytorch_example.py: sstream, kerkernel, ker_argskernel_args
  • thread_block_cluster.py: kerkernel
  • strided_memory_view_gpu.py: sstream, gpu_kerkernel, gpu_progprog
  • simple_multi_gpu_example.py: ker_addadd_kernel, ker_subsub_kernel, dict options → ProgramOptions
  • cuda_graphs.py: block_size/grid_sizeblock/grid
  • gl_interop_plasma.py: optsprogram_options

Test plan

  • Verify examples still run correctly (rename-only changes, no logic changes)

Made with Cursor

@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Feb 26, 2026

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

- 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
@cpcloud cpcloud force-pushed the examples-naming-conventions branch from d6a8f91 to 76978c1 Compare February 26, 2026 21:23
@cpcloud
Copy link
Contributor Author

cpcloud commented Feb 26, 2026

/ok to test

@github-actions
Copy link

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