test(cuda_core): capture machine state on the first CUDA OOM - #2458
Open
juenglin wants to merge 1 commit into
Open
test(cuda_core): capture machine state on the first CUDA OOM#2458juenglin wants to merge 1 commit into
juenglin wants to merge 1 commit into
Conversation
Contributor
|
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. |
juenglin
commented
Jul 30, 2026
Contributor
Author
There was a problem hiding this comment.
Example cuda_core_oom_diagnostics.txt:
==============================================================================
cuda_core diagnostics: first CUDA_ERROR_OUT_OF_MEMORY of this session
==============================================================================
test: tests/test_zz_demo_delete_me.py::test_first_oom
phase: call
pid: 18384
platform: win32
exception: CUDA_ERROR_OUT_OF_MEMORY: The API call failed because it was unable to allocate enough memory or other resources to perform the requested operation.
--- direct driver probe (bypasses cuda.core error reporting) ---
cuCtxGetCurrent() -> (<CUresult.CUDA_SUCCESS: 0>, <CUcontext 0x2cc0c554080>)
cuMemGetInfo() -> (<CUresult.CUDA_SUCCESS: 0>, 24275582976, 25650855936)
cuDeviceGetCount() -> (<CUresult.CUDA_SUCCESS: 0>, 1)
cuDeviceGetMemPool(dev 0) -> (<CUresult.CUDA_SUCCESS: 0>, <CUmemoryPool 0x2cc0cb07cf0>)
cuDeviceGetDefaultMemPool(dev 0) -> (<CUresult.CUDA_SUCCESS: 0>, <CUmemoryPool 0x2cc0cb07cf0>)
$ nvidia-smi -q
(exit 0)
==============NVSMI LOG==============
Timestamp : Thu Jul 30 13:41:04 2026
Driver Version : 595.71
CUDA Version : 13.2
Attached GPUs : 1
GPU 00000000:01:00.0
Product Name : NVIDIA RTX PRO 5000 Blackwell Generation Laptop GPU
Product Architecture : Blackwell
Driver Model
Current : WDDM
Pending : WDDM
... ~80 lines of clocks, ECC, temperature, power ...
FB Memory Usage
Total : 24463 MiB
Reserved : 326 MiB
Used : 222 MiB
Free : 23916 MiB
BAR1 Memory Usage
Total : 32768 MiB
... ~140 more lines ...
Capabilities
EGM : disabled
$ nvidia-smi --query-compute-apps=timestamp,pid,process_name,used_memory --format=csv
(exit 0)
timestamp, pid, process_name, used_gpu_memory [MiB]
2026/07/30 13:41:04.256, 18384, C:\Program Files\Python313\python.exe, [N/A]
==============================================================================
Contributor
Author
|
/ok to test |
|
juenglin
marked this pull request as ready for review
July 30, 2026 22:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, wherecuDeviceGetMemPoolreturns 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:
cuMemGetInfo,cuDeviceGetMemPool,cuDeviceGetDefaultMemPool), distinguishing genuine exhaustion from anunavailable mempool
nvidia-smi -qfor driver model and compute modenvidia-smi --query-compute-appsto identify every process holdingdevice 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.