Skip to content

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.

LabelMeaning
MustRequired for new code unless a documented project constraint prevents it.
ShouldThe default; a review may accept a documented reason to diverge.
MayAn allowed project choice, not a requirement.
VMC exampleVerbatim 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.

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.

AreaStandardVMC evidence
Host languageUse C++23 for new host code.CMAKE_CXX_STANDARD 23
Device languageUse CUDA C++20 when CUDA is enabled.CMAKE_CUDA_STANDARD 20
FormattingCheck in .clang-format; two spaces, 100 columns, sorted includes, left-aligned pointers.VMC .clang-format
DiagnosticsEnable 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.

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.