Skip to content

Commit 730fcbe

Browse files
committed
fix(cuda.core): report CUDA synchronization errors during test teardown
Check the cuCtxSynchronize result in init_cuda so asynchronous errors surface during the triggering test's teardown instead of going unnoticed until a later test. Always attempt context cleanup via finally. Related to #3426.
1 parent aa83d4b commit 730fcbe

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎cuda_core/tests/conftest.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,10 @@ def init_cuda(request):
298298
# With pytest-run-parallel this runs after worker join. This also runs
299299
# when setup raises, so an escalated leftover warning cannot leave the
300300
# context current.
301-
driver.cuCtxSynchronize()
302-
_ = _device_unset_current()
301+
try:
302+
handle_return(driver.cuCtxSynchronize())
303+
finally:
304+
_ = _device_unset_current()
303305
# After the cleanup, so an escalated warning cannot skip it.
304306
if live_after is not None and any(now < snap for now, snap in zip(live_after, live_at_setup)):
305307
released = tuple(s - n for s, n in zip(live_at_setup, live_after))

0 commit comments

Comments
 (0)