Unified Memory Framework (UMF)
raw JSON → 1.1.0 verified Mon Apr 27 auth: no python
UMF is a C library for constructing allocators and memory pools, with Python bindings provided by the umf package. It manages multiple memory pools for different hardware resources (CPU, GPU). Current version 1.1.0, release cadence: minor releases every few months with patch releases as needed.
pip install umf Common errors
error ImportError: cannot import name 'UMF' from 'umf' ↓
cause The main class is UMF, but the module name is umf. Common mistake is `import umf` instead of `from umf import UMF`.
fix
Use
from umf import UMF for the main class. error TypeError: 'module' object is not callable ↓
cause Calling `umf()` after `import umf` which imports the module, not the class.
fix
Either
from umf import UMF and use UMF(), or call the class directly. error FileNotFoundError: Could not find libumf.so ↓
cause The C library is not installed or not in LD_LIBRARY_PATH.
fix
Install the C library (e.g., via conda or building from source) or set LD_LIBRARY_PATH appropriately.
error ValueError: Provider 'JUMA' is not available ↓
cause The requested memory pool type is not supported in the current UMF build.
fix
Check available providers with
umf.supported_providers() and use one of them. Warnings
breaking In UMF 0.10.0, the parameters API changed from direct struct access to a new set/get API. Code using UMF_PARAMS or similar struct fields will break. ↓
fix Migrate to umfParamsCreate/umfParamsDestroy and parameter setter/getter functions.
deprecated UMF_DISABLE_HWLOC option was removed in UMF 1.1.0. ↓
fix Remove any usage of UMF_DISABLE_HWLOC. hwloc topology is now initialized automatically.
gotcha The Python package 'umf' wraps only a subset of the C library. Some providers (e.g., Level Zero, CUDA) are only available if the C library was built with those backends. ↓
fix Check UMF documentation for which providers are available in your build. Use umf.supported_providers() to list them.
Imports
- UMF wrong
import umfcorrectfrom umf import UMF - MemoryPool
from umf.pool import MemoryPool
Quickstart
from umf import UMF
# Initialize UMF
umf = UMF()
# Create a memory pool (example: JUMA pool)
pool = umf.create_pool('JUMA')
# Allocate memory
ptr = pool.alloc(1024)
print(f"Allocated 1024 bytes at {ptr}")
# Free memory
pool.free(ptr)