NVIDIA / NVIDIA/cuda-python

Provide a nice wrapper over `DeviceMemoryResource` and `_SynchronousMemoryResource`

Open
#726 0 comments 0 reactions 1 assignee View on GitHub

@shwina is already working on this.

Since Jun 25, 2025.

cuda.core enhancement P1
Dominant language
Cython
Stars
3.4k
Forks
329
Avg merge
1d 23h
Merged PRs (30d)
116

Description

Need to check against Device().properties.memory_pools_supported to decide if we use DeviceMemoryResource or _SynchronousMemoryResource

Any chance we can turn this into a wrapper function, or just have DeviceMemoryResource() return the appropriate type when constructed?

Originally posted by @shwina in https://github.com/NVIDIA/cuda-python/pull/717#discussion_r2167323036

We could consider adding a helper function under the cuda.core.experimental.utils module. Later we might reimplement DeviceMemoryResource using cudax::device_memory_resource or cuda::device_memory_pool, so if we make DeviceMemoryResource to wrap both cudaMallocFromPoolAsync and cudaMalloc now, the re-implementation would become harder later.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.