Skip to content

C++ and CUDA review checklist

Use this checklist for a focused review. The detailed rationale and VMC examples live in the C++ standard and CUDA standard.

  • Changed files conform to the checked-in .clang-format configuration.
  • The target requests the required language standard and strict warning set.
  • New declarations follow the type, function, variable, and private-member naming rules.
  • Objects and scalars are initialized; numeric conversions are explicit.
  • Values that do not change are const.
  • Owning resources use RAII; raw pointers and references are non-owning.
  • Single-argument constructors are explicit unless conversion is intended.
  • Important return values are [[nodiscard]].
  • Expected absence uses std::optional or an equally explicit result type.
  • Input validation happens at the boundary and error messages identify the violated constraint.
  • Tests cover the normal path, boundaries, and failures.
  • Stochastic tests use fixed seeds; numerical tests state their tolerance.
  • Scientific code tests an invariant or independent reference, not only that the function returns.

VMC evidence: format policy, warning policy, ownership and optional results, and rigorous numerical tests.

  • The CUDA feature boundary is controlled by one project build definition.
  • A dual-backend function has one signature with #ifdef VMC_CUDA_BACKEND selecting the body, not duplicate file-scope definitions.
  • __global__ is on its own line; kernels are named cudaX; parameters are grouped (sizes/scalars, inputs, outputs) and the launch mirrors the signature.
  • Launch-config variables follow <kernel>Threads / <kernel>Blocks naming.
  • Member calls inside members use this->; attributes and qualifiers sit on their own line.
  • Kernels take minimal arguments — primitives derived in-kernel, single values instead of array-plus-index.
  • Functions that call device-only APIs are split with __CUDA_ARCH__, not marked CUDA_CALLABLE.
  • noexcept is kept on host-covering wrappers and dropped on GPU-only functions; trivial members use = default.
  • Each global index is bounds-checked before memory access.
  • Grid dimensions cover non-divisible problem sizes.
  • Every launch is followed by cudaGetLastError() through the checked-call policy.
  • Every Runtime, cuBLAS, cuSOLVER, or other library status is checked.
  • Synchronization has a host-consumption, phase-boundary, debugging, or measurement reason.
  • Device or managed allocation has matching RAII cleanup.
  • RESTRICT is used only where non-aliasing is guaranteed.
  • Host/device math uses the shared precision-aware wrapper.
  • Fast or approximate math is explicit, documented, and tested separately.
  • CPU and CUDA paths implement the same public contract.
  • Tests include sizes that are not block-size multiples and cover each supported precision mode.
  • Validation or benchmark records name the CUDA toolkit and GPU architecture.

VMC evidence: bounds-checked kernel, checked launch, managed-memory RAII, and precision-aware math.

  • Formatting, build, and test commands pass for every changed backend.
  • Compiler warnings are not suppressed without a local explanation.
  • User-visible behavior and build options are documented.
  • Performance-sensitive changes include a reproducible comparison when performance is part of the claim.
  • Any deliberate departure from this standard is recorded in the pull request with its scope and reason.