cuda-python icon indicating copy to clipboard operation
cuda-python copied to clipboard

test(cuda_core): capture machine state on the first CUDA OOM

Open juenglin opened this issue 4 months ago • 3 comments

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 -q for driver model and compute mode
  • nvidia-smi --query-compute-apps to 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.

juenglin avatar Jul 30 '26 20:07 juenglin

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.

copy-pr-bot[bot] avatar Jul 30 '26 20:07 copy-pr-bot[bot]

/ok to test

juenglin avatar Jul 30 '26 20:07 juenglin

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/


Preview will be ready when the GitHub Pages deployment is complete.

github-actions[bot] avatar Jul 30 '26 21:07 github-actions[bot]