# CUDA A/B harness Run one deterministic CUDA workload on the **host** (bare-metal GPU, the oracle) and in the **guest** (Open-IOV emulated vGPU), then compare the machine-readable results. This mirrors the earlier host/guest `nvidia-smi` comparison, but exercises actual execution: allocation, HtoD/DtoH copies, kernel launch, synchronisation and verification. ``` tools/cuda-ab/ab.sh all # build + host run + guest run + compare tools/cuda-ab/ab.sh host # host only -> run/host.txt tools/cuda-ab/ab.sh guest # push binary, run in the running VM -> run/guest.txt tools/cuda-ab/ab.sh push # push $WORKLOAD (default vector_add) only tools/cuda-ab/ab.sh compare # diff the stable result lines WORKLOAD=smiley tools/cuda-ab/ab.sh guest # (or `ab.sh smiley` to push only) ``` ## Files | File | Purpose | |---|---| | `vector_add.cu` | the workload (`DEVICE`/`RESULT`/`STATUS` output lines) | | `smiley.cu` | vectorAdd-drawn ASCII smiley deliverable (`VADD`/`RESULT`/`STATUS`) | | `victory_mail.cu` | the campaign mail workload | | `p2/` | self-checking P2 acceptance suite (11 programs, see `p2/README.md`) | | `ab.sh` | host build/run, guest push/run, comparison | | `run/` | generated outputs (`host.txt`, `guest.txt`) | ## Notes * The binary links the CUDA runtime **statically** (`--cudart=static`), so the guest needs no CUDA toolkit - only the guest driver's `libcuda.so`. * The guest transfer uses the guest agent (base64 chunks); the VM must be running (`scripts/vgpu_vm.py`). * `DEVICE` lines are normalised before diffing (the guest reports the emulated GPU name); `RESULT` and `STATUS` must match exactly. * Host requirement: `nvidia-cuda-toolkit` (`nvcc`).