cuda.core 1.3.0 Release Notes#
New features#
Added
CUDAWarning, the warning categorycuda.coreuses for CUDA errors that cannot be raised, such as a failed driver call while a resource is released by the garbage collector. Filter on it withwarnings.filterwarnings("error", category=cuda.core.CUDAWarning)to make such failures loud. The new error handling page documents what an exception fromcuda.coreguarantees, how failures that cannot be raised are reported, and how context restoration failures and sticky CUDA errors are handled.
Fixes and enhancements#
Cleanup failures are now reported as
CUDAWarninginstead of being written tostderrwithprintorfprintf, so they can be filtered, captured withwarnings.catch_warnings(), and escalated. Failures ofcuStreamDestroy,cuEventDestroy,cuMemFree,cuMemFreeAsync,cuMemFreeHost,cuMemPoolDestroy,cuGreenCtxDestroy,cuGraphDestroy,cuGraphExecDestroy,cuGraphicsUnregisterResource,cuLinkDestroy,cuArrayDestroy,cuMipmappedArrayDestroy,cuTexObjectDestroy,cuSurfObjectDestroy, user-object releases and the NVRTC, NVVM and nvJitLink destroy calls made from destructors were previously discarded; they are now reported.CUDA_ERROR_DEINITIALIZED(the driver is shutting down) is not reported. Test code that matched the oldstderrtext usespytest.warns(CUDAWarning)instead.When a
Devicemethod has to run in the device’s context and the caller’s context cannot be restored afterwards, the created resource is destroyed and the raisedCUDAErrornow states that the caller’s context could not be restored and which context is current. Previously the error named only the driver status of the failedcuCtxSetCurrentcall. A restoration failure during resource cleanup is reported asCUDAWarning.Updating a memcpy or memset graph node whose context differs from the current one no longer risks a dangling node parameter when the caller’s context cannot be restored after the update: the resources referenced by the new parameters are now retained before the restoration failure is raised.
Device.set_current()with an explicitContextnow switches contexts with a single driver call, so a failure leaves the previous context current instead of leaving the thread with no context. It also works when no context is current, returningNone.Failed rollbacks of a partially embedded child graph node and failed
cuStreamEndCapturecalls made when a still-buildingGraphBuilderis garbage collected are now reported asCUDAWarning; both were silent.Stream.deviceand related queries on a stream whose context is not current now restore the caller’s context even when the device query fails.