cuda.core 1.4.0 Release Notes#

Fixes and enhancements#

  • Kernels, Buffer.fill() and asynchronous copies now work on PinnedMemoryResource buffers on every device that supports the pool’s kind of host memory pool, as on cudaMallocHost memory. In cuda.core 1.3.0, only the device that was current when the resource was created could access its buffers. A process that imported the pool, through PinnedMemoryResource.from_allocation_handle() or by unpickling, granted no device access at all, because pool access is per process. There, kernels failed with CUDA_ERROR_ILLEGAL_ADDRESS, fill failed with CUDA_ERROR_INVALID_VALUE, and copies silently blocked the host until earlier work on the stream completed. The creating and the importing process now both grant read and write access to every supporting device. (#3415, #3501)

  • Repeat imports of a memory pool in one process, for example passing a raw file descriptor to PinnedMemoryResource.from_allocation_handle() twice, now share one owner, which releases the pool with the last of them. Closing one import no longer removes device access to a pinned pool from the others, or emits a CUDAWarning from cuMemPoolDestroy for a device pool while a buffer imported through another is alive. An import that overlaps the release of the last one waits for it, and concurrent imports of one allocation handle return the same resource instead of raising an internal error. (#3510)

  • DeviceMemoryResource.from_allocation_handle() returns a resource already registered in the process with its original device_id, instead of changing it to the requested device. (#3510)

  • DeviceMemoryResource.from_allocation_handle() now raises TypeError for the allocation handle of a host memory pool, and PinnedMemoryResource.from_allocation_handle() for the handle of a device memory pool. Unless the memory resource was already registered in the importing process, for example by unpickling it, the import used to succeed and return a resource that misreported device_id, is_host_accessible and is_device_accessible. Code that imported a pool with the class of the other pool kind must now use the exporting resource’s class. An imported PinnedMemoryResource now also reports the pool’s NUMA node as numa_id instead of 0. The check and the numa_id lookup need a CUDA 13 build of cuda.core and a 13.2 or later driver; with a CUDA 12 build or an older driver, imports behave as before. (#3502)

  • A Context, Stream or Event no longer fails with CUDA_ERROR_CONTEXT_IS_DESTROYED after other threads that used the same device exit. Each thread that called Device.set_current() retained the primary context separately, and a thread’s exit could leave later lookups, such as Stream.from_handle() or recording an event on Device.default_stream, with a Context that held no retain. Once the last retaining thread exited, the driver destroyed the primary context while the application still used it. All threads now share one retain per primary context, which cuda.core releases when the last object holding it is released. A Context obtained for a context that cuda.core had not retained at that time, for example one made current by another library, still holds no retain and stays valid only as long as the context’s owner keeps it alive. (#3533)

  • Device.create_context() no longer returns a context with is_green == False that is already destroyed when the driver reuses the address of an earlier context for which the application still holds a Context that cuda.core did not create, for example the previous context returned by Device.set_current(). (#3533)

  • cuDevicePrimaryCtxRelease failures are now reported as a CUDAWarning instead of being ignored. (#3533)