summaryrefslogtreecommitdiffstats
path: root/tools/cuda-ab/README.md
blob: db8714985af4f5df111c0a907163f32b2e78707e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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 compare   # diff the stable result lines
```

## Files

| File | Purpose |
|---|---|
| `vector_add.cu` | the workload (`DEVICE`/`RESULT`/`STATUS` output lines) |
| `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`).