Skip to content

refactor(examples): standardize example file structure#1770

Open
cpcloud wants to merge 1 commit intoNVIDIA:mainfrom
cpcloud:issue-1674
Open

refactor(examples): standardize example file structure#1770
cpcloud wants to merge 1 commit intoNVIDIA:mainfrom
cpcloud:issue-1674

Conversation

@cpcloud
Copy link
Contributor

@cpcloud cpcloud commented Mar 16, 2026

Summary

  • normalize the file-level description banners across the 25 runnable examples in cuda_core/examples and cuda_bindings/examples
  • standardize direct execution structure by using main() and if __name__ == "__main__" consistently, including moving the remaining cuda_core module-level execution into main()
  • preserve the pytest-driven cuda_bindings example layout while adding the missing direct-execution guard for conjugateGradientMultiBlockCG_test.py

Follow Ups

  • decide whether the normalized top-of-file description blocks should become module docstrings instead of comment banners
  • handle the remaining example-polish follow-up items separately, including naming conventions, cleanup patterns, import/dependency policy, error/output consistency, and documentation coverage

Closes #1674

Made with Cursor

Normalize example description headers and entry points so the core and bindings examples follow the same executable layout ahead of the broader examples polish work.

Made-with: Cursor
@github-actions
Copy link

@rwgk
Copy link
Collaborator

rwgk commented Mar 16, 2026

Drive-by action: I just triggered a rerun of a failed Windows build (infrastructure flake). Hope that's helpful.

@cpcloud
Copy link
Contributor Author

cpcloud commented Mar 16, 2026

Yup, thanks!

@cpcloud cpcloud requested review from rparolin and rwgk March 16, 2026 20:17
Copy link
Collaborator

@rwgk rwgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the changes pretty carefully: apart from the loss of the very useful comment block in cuda_core/examples/gl_interop_plasma.py it looks great to me.

#
# ################################################################################
#
# What this example teaches
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to the banner looks good, but it's a significant loss that all the other useful and carefully structured information is simply removed. Could we keep it, maybe below the banner?

Copy link
Collaborator

@rwgk rwgk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving so you can merge this in your morning; please see #1770 (comment)

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.

Examples: Standardize file structure conventions

2 participants