Skip to content

ManagedMemoryResource() without options fails when the default pool does not support managed allocations #1617

Closed

Description

@Andy-Jost

ManagedMemoryResource() (no options) attempts to retrieve the current memory pool via cuMemGetMemPool with CU_MEM_ALLOCATION_TYPE_MANAGED. On platforms where the default pool does not support managed allocations, this fails with a cryptic error:

CUDAError: CUDA_ERROR_NOT_SUPPORTED: This error indicates that the attempted operation is not supported
on the current system or device.

Meanwhile, ManagedMemoryResource(options=ManagedMemoryResourceOptions(preferred_location=0)) works on the same platform because it creates a new managed pool via cuMemPoolCreate.

Improve the error message so users understand what went wrong, and investigate whether the API should handle this case more gracefully (e.g., by falling back to pool creation).

Reproducer:

from cuda.core import Device, ManagedMemoryResource, ManagedMemoryResourceOptions

device = Device(0)
device.set_current()

# Fails with CUDA_ERROR_NOT_SUPPORTED
mr = ManagedMemoryResource()

# Workaround: succeeds
mr = ManagedMemoryResource(options=ManagedMemoryResourceOptions(preferred_location=0))

Test results:

On WSL2 x86_64 (concurrent_managed_access=False, memory_pools_supported=True):

ManagedMemoryResource() ...
  failed: CUDA_ERROR_NOT_SUPPORTED: This error indicates that the attempted
  operation is not supported on the current system or device.

ManagedMemoryResource(options=ManagedMemoryResourceOptions(preferred_location=0)) ...
  succeeded (device_id=0)

On Linux x86_64 (concurrent_managed_access=True, memory_pools_supported=True):

ManagedMemoryResource() ...
  succeeded (device_id=-1)

ManagedMemoryResource(options=ManagedMemoryResourceOptions(preferred_location=0)) ...
  succeeded (device_id=0)

Activity

  1. added this to the cuda.core v0.7.0 milestone on Feb 12, 2026
  2. self-assigned this
    on Feb 12, 2026
  3. added
    bugSomething isn't working
    P1Medium priority - Should do
    cuda.coreEverything related to the cuda.core module
    on Feb 12, 2026
  4. changed the issue type fromtoon Feb 12, 2026
  5. Andy-Jost commented on Mar 30, 2026

    @Andy-Jost
    ContributorAuthor

    Investigate whether the API should handle this case more gracefully (e.g., by falling back to pool creation).

    Falling back to pool creation is not the right behavior for two reasons. First, the behavioral difference between platforms with and without concurrent managed access would be surprising and unexpected. Second, if the driver ever added support for this feature on platforms that currently lack it, then there would be no clean migration path away from pool creation back to the default pool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1Medium priority - Should dobugSomething isn't workingcuda.coreEverything related to the cuda.core module

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions