Skip to content

Standardize error handling and output across all examples#1694

Merged
cpcloud merged 1 commit intoNVIDIA:mainfrom
cpcloud:examples-stderr-out
Mar 3, 2026
Merged

Standardize error handling and output across all examples#1694
cpcloud merged 1 commit intoNVIDIA:mainfrom
cpcloud:examples-stderr-out

Conversation

@cpcloud
Copy link
Contributor

@cpcloud cpcloud commented Feb 26, 2026

Summary

Closes #1678.

  • Remove success/completion fluff messages ("done!", "passed", "completed successfully", etc.) — no news is good news
  • Use sys.exit(1) instead of sys.exit(0) for unsupported configurations (non-zero = did not run)
  • Send all skip/warning/error messages to stderr
  • Replace user-facing assert with proper if/print/sys.exit(1) checks
  • Standardize sys.exit(-1) to sys.exit(1)
  • Use pytest.skip() for unsupported-config checks in _test.py files (run under pytest)

Applies to all 23 example files across cuda_core/examples/ and cuda_bindings/examples/, plus common/common.py.

@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.

@cpcloud
Copy link
Contributor Author

cpcloud commented Feb 26, 2026

/ok to test

@github-actions

This comment has been minimized.

@cpcloud
Copy link
Contributor Author

cpcloud commented Feb 26, 2026

/ok to test

@cpcloud
Copy link
Contributor Author

cpcloud commented Feb 26, 2026

/ok to test

@cpcloud cpcloud force-pushed the examples-stderr-out branch from 2385e5e to 0f85872 Compare February 27, 2026 16:44
@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Feb 27, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@cpcloud
Copy link
Contributor Author

cpcloud commented Feb 27, 2026

/ok to test

@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Feb 27, 2026

/ok to test

@cpcloud, there was an error processing your request: E1

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/

- 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
@cpcloud cpcloud force-pushed the examples-stderr-out branch from 0f85872 to f66b441 Compare February 27, 2026 16:46
@cpcloud
Copy link
Contributor Author

cpcloud commented Feb 27, 2026

/ok to test


if error_count != 0:
print("Test failed!")
sys.exit(-1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We aren't breaking behaviour for higher systems that would be explicitly checking for a -1 return code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a test for an example. No one should be depending on this to not break at any time. Depending on the specific return code of invoking this program would be analogous to depending on a specific object being available in a project's test suite.

@cpcloud cpcloud merged commit bcba37c into NVIDIA:main Mar 3, 2026
167 of 169 checks passed
@cpcloud cpcloud deleted the examples-stderr-out branch March 3, 2026 22:46
@github-actions

This comment has been minimized.

1 similar comment
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

Doc Preview CI
Preview removed because the pull request was closed or merged.

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 error handling and output

2 participants