pub unsafe extern "C" fn cudaMemSetMemPool(
location: *mut cudaMemLocation,
type_: cudaMemAllocationType,
memPool: cudaMemPool_t,
) -> cudaError_tExpand description
Sets the current memory pool for a memory location and allocation type.
The memory location can be of one of cudaMemLocationTypeDevice, cudaMemLocationTypeHost cudaMemLocationTypeHostNuma, or cudaMemLocationTypeDeviceLocalityDomain. The allocation type can be one of cudaMemAllocationType::cudaMemAllocationTypePinned or cudaMemAllocationType::cudaMemAllocationTypeManaged. When the allocation type is cudaMemAllocationType::cudaMemAllocationTypeManaged, the location type can also be cudaMemLocationTypeNone to indicate no preferred location for the managed memory pool. cudaMemAllocationType::cudaMemAllocationTypeManaged can not be used with cudaMemLocationTypeDeviceLocalityDomain. In all other cases, the call return cudaError_t::CUDA_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. If the location type or index don’t match, the call returns cudaError_t::CUDA_ERROR_INVALID_VALUE. The type of memory pool should also match the parameter allocType. Else the call returns cudaError_t::CUDA_ERROR_INVALID_VALUE
.
By default, a memory location’s current memory pool is its default memory pool. If the location type is
cudaMemLocationTypeDevice and the allocation type is cudaMemAllocationType::cudaMemAllocationTypePinned , then this API is the equivalent of calling cudaDeviceSetMemPool with the location id as the device. For further details on the implications, please refer to the documentation for cudaDeviceSetMemPool .
Note: Use cudaMallocFromPoolAsync to specify asynchronous allocations from a device different than the one the stream runs on.
§Return value
cudaError_t::CUDA_SUCCESScudaError_t::CUDA_ERROR_INVALID_VALUEcudaError_t::CUDA_ERROR_NOT_SUPPORTED
See also: cuDeviceGetDefaultMemPool, cuDeviceGetMemPool, cuMemGetMemPool, cuMemPoolCreate, cuMemPoolDestroy, cuMemAllocFromPoolAsync.