HPC GPU Stack
Treat GPU execution as one coherent stack: CUDA toolchain, host compiler, launcher, scheduler mapping, and device visibility must agree before kernel tuning matters.
Start
- Read
references/cuda-and-host-compiler-matrix.md before choosing nvcc, host compiler, or a CUDA build baseline.
- Read
references/gpu-aware-mpi-and-rank-mapping.md when the workflow spans MPI ranks, one-rank-per-GPU layouts, or CUDA-aware MPI.
- Read
references/device-visibility-and-scheduler-integration.md when Slurm, CUDA_VISIBLE_DEVICES, MIG, or scheduler-provided GPU allocation is involved.
- Read
references/memory-streams-and-overlap-playbook.md when debugging device memory pressure, pinned-memory transfers, streams, or overlap assumptions.
- Read
references/build-and-launch-workflow.md when turning a CUDA code path into a reproducible compile-and-run workflow.
- Read
references/runtime-debugging-and-profiling.md when kernels fail at runtime, ranks see the wrong device, or performance is unexpectedly poor.
- Read
references/error-recovery.md when configure, compile, launch, or runtime CUDA behavior fails.
- Read
references/error-pattern-dictionary.md when a GPU failure needs a fast pattern match.
Work sequence
- Confirm the execution model first:
- single GPU
- one MPI rank per GPU
- hybrid MPI plus threads with explicit rank-to-GPU placement
- Keep CUDA toolkit, host compiler, and MPI stack mutually compatible.
- Let the scheduler expose the intended GPU allocation before forcing manual device selection.
- Get a minimal kernel and launch baseline working before tuning streams, overlap, or transport variables.
- Reproduce failures on one node and the smallest GPU count that still shows the issue before scaling out.
Guardrails
- Do not assume
nvcc accepts any host compiler visible in PATH.
- Do not mix rank-to-GPU mapping logic from Open MPI, MPICH-family, and Slurm without checking which environment variables are actually set.
- Do not tune streams or overlap to compensate for a broken device-mapping or memory-capacity issue.
- Do not debug multi-node GPU failures before a single-node baseline is trustworthy.
Additional References
Load these on demand:
references/cuda-and-host-compiler-matrix.md for compiler-compatibility and build-baseline decisions
references/gpu-aware-mpi-and-rank-mapping.md for CUDA-aware MPI and rank placement rules
references/device-visibility-and-scheduler-integration.md for scheduler-exposed GPU visibility and Slurm integration
references/memory-streams-and-overlap-playbook.md for memory hierarchy, streams, and transfer overlap
references/build-and-launch-workflow.md for reproducible build and launch sequencing
references/runtime-debugging-and-profiling.md for runtime inspection and performance triage
references/error-pattern-dictionary.md for common GPU failure signatures
Reusable Templates
Use assets/templates/ when a concrete starting point is faster than rebuilding the GPU workflow from scratch, especially:
cuda_vector_add_minimal.cu
nvcc_build_example.sh
cuda_single_gpu_slurm.sh
cuda_mpi_gpu_slurm.sh
Outputs
Summarize:
- CUDA toolkit and host-compiler path chosen
- rank-to-GPU mapping or single-GPU launch path
- scheduler or visibility assumptions
- memory and stream model if relevant
- the exact build or runtime failure class if the workflow is being repaired
1---2name: hpc-gpu-stack3description: Build, review, debug, and launch CUDA- and GPU-accelerated HPC workflows. Use when working with `nvcc`, host-compiler compatibility, CUDA-aware MPI, rank-to-GPU mapping, `CUDA_VISIBLE_DEVICES`, Slurm GPU scheduling, GPU memory or stream behavior, or CUDA build and runtime failures.4---56# HPC GPU Stack78Treat GPU execution as one coherent stack: CUDA toolchain, host compiler, launcher, scheduler mapping, and device visibility must agree before kernel tuning matters.910## Start11121. Read `references/cuda-and-host-compiler-matrix.md` before choosing `nvcc`, host compiler, or a CUDA build baseline.132. Read `references/gpu-aware-mpi-and-rank-mapping.md` when the workflow spans MPI ranks, one-rank-per-GPU layouts, or CUDA-aware MPI.143. Read `references/device-visibility-and-scheduler-integration.md` when Slurm, `CUDA_VISIBLE_DEVICES`, MIG, or scheduler-provided GPU allocation is involved.154. Read `references/memory-streams-and-overlap-playbook.md` when debugging device memory pressure, pinned-memory transfers, streams, or overlap assumptions.165. Read `references/build-and-launch-workflow.md` when turning a CUDA code path into a reproducible compile-and-run workflow.176. Read `references/runtime-debugging-and-profiling.md` when kernels fail at runtime, ranks see the wrong device, or performance is unexpectedly poor.187. Read `references/error-recovery.md` when configure, compile, launch, or runtime CUDA behavior fails.198. Read `references/error-pattern-dictionary.md` when a GPU failure needs a fast pattern match.2021## Work sequence22231. Confirm the execution model first:24 - single GPU25 - one MPI rank per GPU26 - hybrid MPI plus threads with explicit rank-to-GPU placement272. Keep CUDA toolkit, host compiler, and MPI stack mutually compatible.283. Let the scheduler expose the intended GPU allocation before forcing manual device selection.294. Get a minimal kernel and launch baseline working before tuning streams, overlap, or transport variables.305. Reproduce failures on one node and the smallest GPU count that still shows the issue before scaling out.3132## Guardrails3334- Do not assume `nvcc` accepts any host compiler visible in `PATH`.35- Do not mix rank-to-GPU mapping logic from Open MPI, MPICH-family, and Slurm without checking which environment variables are actually set.36- Do not tune streams or overlap to compensate for a broken device-mapping or memory-capacity issue.37- Do not debug multi-node GPU failures before a single-node baseline is trustworthy.3839## Additional References4041Load these on demand:4243- `references/cuda-and-host-compiler-matrix.md` for compiler-compatibility and build-baseline decisions44- `references/gpu-aware-mpi-and-rank-mapping.md` for CUDA-aware MPI and rank placement rules45- `references/device-visibility-and-scheduler-integration.md` for scheduler-exposed GPU visibility and Slurm integration46- `references/memory-streams-and-overlap-playbook.md` for memory hierarchy, streams, and transfer overlap47- `references/build-and-launch-workflow.md` for reproducible build and launch sequencing48- `references/runtime-debugging-and-profiling.md` for runtime inspection and performance triage49- `references/error-pattern-dictionary.md` for common GPU failure signatures5051## Reusable Templates5253Use `assets/templates/` when a concrete starting point is faster than rebuilding the GPU workflow from scratch, especially:5455- `cuda_vector_add_minimal.cu`56- `nvcc_build_example.sh`57- `cuda_single_gpu_slurm.sh`58- `cuda_mpi_gpu_slurm.sh`5960## Outputs6162Summarize:6364- CUDA toolkit and host-compiler path chosen65- rank-to-GPU mapping or single-GPU launch path66- scheduler or visibility assumptions67- memory and stream model if relevant68- the exact build or runtime failure class if the workflow is being repaired