Python wrapper for Nvidia CUDA parallel computation API with object cleanup, automatic error checking, and convenient abstractions.
A Python utility for managing GPU memory allocations efficiently using memory pools and unified memory features.
@generates
class MemoryManager:
"""Manages GPU memory allocations using pools and unified memory."""
def __init__(self):
"""Initialize the memory manager with device and host memory pools."""
pass
def allocate_device_pooled(self, size_bytes: int) -> int:
"""
Allocate device memory from the pool.
Args:
size_bytes: Number of bytes to allocate
Returns:
Memory address as integer
"""
pass
def allocate_managed(self, size_bytes: int, attach: str = "global") -> int:
"""
Allocate managed/unified memory accessible from both CPU and GPU.
Args:
size_bytes: Number of bytes to allocate
attach: Memory attachment mode ("global", "host", or "single")
Returns:
Memory address as integer
"""
pass
def allocate_pagelocked(self, size_bytes: int) -> int:
"""
Allocate page-locked host memory from the pool.
Args:
size_bytes: Number of bytes to allocate
Returns:
Memory address as integer
"""
pass
def free_pooled(self, address: int) -> None:
"""
Return memory to the pool for reuse.
Args:
address: Memory address to free
"""
pass
def get_pool_allocation_count(self) -> int:
"""
Get the number of active allocations in the device memory pool.
Returns:
Number of active allocations
"""
pass
def get_managed_memory_total(self) -> int:
"""
Get total bytes of managed memory currently allocated.
Returns:
Total managed memory in bytes
"""
passProvides GPU computing capabilities with memory management features.
@satisfied-by
tessl i tessl/pypi-pycuda@2025.1.0docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10