C++ and CUDA coding standards
This section defines an initial coding standard for C++ and CUDA projects at UWHPC. It is separate from the VMC user documentation, but its rules and examples are grounded in the current VMC source.
How to read the rules
Section titled “How to read the rules”| Label | Meaning |
|---|---|
| Must | Required for new code unless a documented project constraint prevents it. |
| Should | The default; a review may accept a documented reason to diverge. |
| May | An allowed project choice, not a requirement. |
| VMC example | Verbatim code or configuration from VMC, linked to its exact source lines. |
The standard separates rules from evidence so that a copied VMC implementation detail does not silently become a universal rule.
Language and toolchain at a glance
Section titled “Language and toolchain at a glance”The quick facts to configure a new project. The full formatting, naming, ownership, error-handling, CUDA, and testing rules — with VMC evidence — live in the pages below.
| Area | Standard | VMC evidence |
|---|---|---|
| Host language | Use C++23 for new host code. | CMAKE_CXX_STANDARD 23 |
| Device language | Use CUDA C++20 when CUDA is enabled. | CMAKE_CUDA_STANDARD 20 |
| Formatting | Check in .clang-format; two spaces, 100 columns, sorted includes, left-aligned pointers. | VMC .clang-format |
| Diagnostics | Enable a broad warning set and keep conversions visible. | VMC warning options |
- C++ coding standard covers formatting, naming, types, APIs, ownership, errors, and tests.
- CUDA coding standard covers backend separation, kernel shape, launch checks, memory, portability, and numerical modes.
- Review checklist condenses both standards into a pull request checklist.
Scope boundaries
Section titled “Scope boundaries”This edition does not define repository naming, branch protection, review approval counts, release management, continuous-integration runners, supported GPU models, or cluster compiler/module versions. Those require UWHPC-wide operational decisions rather than evidence from VMC.