Skip to content

CUDA examples: no -arch flag and no launch-error checks — real kernels silently no-op on newer GPUs #3954

Description

@lvkale

Found during stage-9.1 GPU validation (PR #3951 evidence trail, Anvil A100).

The CUDA example Makefiles pass no -arch to nvcc, so objects carry only nvcc's default fatbin (currently sm_75 cubin+ptx — verified with cuobjdump on helloCUDA.o). On an sm_80 A100, a kernel from such an object can end up never executing, with no launch error reported: observed directly — a fill kernel left its buffers untouched (32768/32768 elements wrong), and adding -arch=sm_80 alone took it to 0 wrong. examples/charm++/cuda/hello cannot detect this because its kernel is empty and it verifies nothing.

Two-part fix, pattern already in-tree in tests/charm++/cuda/hapitest (from #3951):

  1. CUDA_ARCH ?= sm_80 (overridable) and -arch=$(CUDA_ARCH) in each CUDA example Makefile;
  2. a cudaGetLastError() check after kernel launches in examples that claim to demonstrate real GPU work — and ideally make the examples verify their outputs, since a silent no-op kernel otherwise looks like success.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions