Skip to content

Examples: Standardize file structure conventions #1674

@rparolin

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.

Metadata

Metadata

Assignees

Labels

cuda.coreEverything related to the cuda.core module

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions