appendix-d
appendix D CUDA reference: commands, hardware, templates, and bindings
D.1 Quick command reference
Check GPU information:
nvidia-smi nvidia-smi --query-gpu=name,memory.total,compute_cap --format=csv
CUDA compilation:
nvcc file.cu -o output # Basic nvcc file.cu -o output -lcublas # With cuBLAS nvcc file.cu -o output -lcublas -lcudnn # With cuDNN nvcc file.cu -o output -O3 # Optimized nvcc file.cu -o output -arch=sm_86 # Specific architecture
Python CUDA extension:
uv run python setup.py build_ext --inplace
MPI execution:
mpirun -np 8 ./program
➥GPUs#1
mpirun -np 8 --mca btl tcp,self ./program #2
Profiling:
# Kernel-level profiling (detailed metrics) ncu --set full -o kernel_profile ./program # Application-level profiling (timeline view) nsys profile --trace=cuda,nvtx -o app_profile ./program # Memory debugging compute-sanitizer ./program
D.2 Hardware architecture quick reference
The tables below give the memory sizes, latencies, and compute capabilities you will look up most often.