test(cuda_core): capture machine state on the first CUDA OOM
Issue #2381 reports intermittent runs where ~190 tests fail with CUDA_ERROR_OUT_OF_MEMORY.
The error name is misleading: the failures route through Device.memory_resource -> DeviceMemoryResource.__init__ -> _DMR_init, where cuDeviceGetMemPool returns a null handle. Pool setup is failing, not allocation, which is why even a zero-byte allocation fails while thousands of other tests in the same run still pass.
Diagnosing that from a pytest log alone is not possible, because the log cannot show whether the device really was out of memory, which processes held GPU memory, or what the driver returned independently of cuda.core's error reporting. Reproducing it also appears to require a specific driver model, so the evidence has to come from the reporter's machine.
Add helpers/oom_diagnostics.py, which records that evidence at the moment of failure:
- the driver queried directly (
cuMemGetInfo,cuDeviceGetMemPool,cuDeviceGetDefaultMemPool), distinguishing genuine exhaustion from an unavailable mempool nvidia-smi -qfor driver model and compute modenvidia-smi --query-compute-appsto identify every process holding device memory, which settles whether another tenant is responsible
Capture is latched to the first OOM. A failing run produces ~190 of them, and invoking nvidia-smi on each would add minutes and bury the log. The report is written via terminalreporter rather than print() so it survives the stdout redirection these runs use, and pytest_terminal_summary points at the artifact from the end of the run, where it is actually noticed.
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.
Contributors can view more details about this message here.
/ok to test
| Doc Preview CI |
|---|
| :rocket: View preview at https://nvidia.github.io/cuda-python/pr-preview/pr-2458/ |
https://nvidia.github.io/cuda-python/pr-preview/pr-2458/cuda-core/ |
https://nvidia.github.io/cuda-python/pr-preview/pr-2458/cuda-bindings/ |
https://nvidia.github.io/cuda-python/pr-preview/pr-2458/cuda-pathfinder/ |
|