cuda.bindings._v2.driver.mem_set_mem_pool#
- cuda.bindings._v2.driver.mem_set_mem_pool(location, int type, intptr_t pool)#
Sets the current memory pool for a memory location and allocation type.
The memory location can be of one of
CU_MEM_LOCATION_TYPE_DEVICE,CU_MEM_LOCATION_TYPE_HOSTorCU_MEM_LOCATION_TYPE_HOST_NUMA,CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN. The allocation type can be one ofCU_MEM_ALLOCATION_TYPE_PINNEDorCU_MEM_ALLOCATION_TYPE_MANAGED. When the allocation type isCU_MEM_ALLOCATION_TYPE_MANAGED, the location type can also beCU_MEM_LOCATION_TYPE_NONEto indicate no preferred location for the managed memory pool. In all other cases, the call returnsCUDA_ERROR_INVALID_VALUE. When a memory pool is set as the current memory pool, the location parameter should be the same as the location of the pool. The location and allocation type specified must match those of the pool otherwiseCUDA_ERROR_INVALID_VALUEis returned. By default, a memory location’s current memory pool is its default memory pool that can be obtained viacuMemGetDefaultMemPool. If the location type isCU_MEM_LOCATION_TYPE_DEVICEand the allocation type isCU_MEM_ALLOCATION_TYPE_PINNED, then this API is the equivalent of callingcuDeviceSetMemPoolwith the location id as the device. For further details on the implications, please refer to the documentation forcuDeviceSetMemPool.- Parameters:
location (intptr_t) – Memory location for which to set the current memory pool.
type (MemAllocationType) – Allocation type for which to set the current memory pool.
pool (intptr_t) – Memory pool to use as the current memory pool for the given location and allocation type.
Note
Use
cuMemAllocFromPoolAsyncto specify asynchronous allocations from a device different than the one the stream runs on.See also
cuMemSetMemPool