Skip to content

Examples: Standardize file structure conventions #1674

Closed

Description

@rparolin

Parent issue: #1673

Goal

Decide on and apply a consistent file structure pattern across all examples in both cuda_core/examples/ and cuda_bindings/examples/.

Current state

  • Only 4 of 11 cuda.core examples use an if __name__ == "__main__" guard (show_device_properties.py, jit_lto_fractal.py, strided_memory_view_gpu.py, strided_memory_view_cpu.py).
  • The other 7 run all code at module level with no function wrapping.
  • Description blocks vary between single-line ("This demo illustrates how to...") and multi-line numbered bullet lists.
  • Some files include ## Usage: sections with pip/python commands, others don't.

Decisions needed

  1. Should all examples use if __name__ == "__main__"?
  2. Should code be wrapped in a main() function or similar?
  3. What format should the file-level description block follow?
  4. Should usage instructions be included in every file?

Files affected

All 25 example files listed in #1673.

Activity

  1. added
    triage
    on Feb 20, 2026
  2. added
    cuda.core
    on Feb 21, 2026
  3. removed
    triage
    on Feb 27, 2026
  4. added this to the cuda.core v1.0.0 milestone on Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

cuda.core

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions