Class CudaOwnedMemoryPool
Owns a CUDA memory pool created through the bridge and releases it during disposal. 拥有通过桥接层创建的 CUDA 内存池,并在释放时销毁它。
public sealed class CudaOwnedMemoryPool : IDisposable
- Inheritance
-
CudaOwnedMemoryPool
- Implements
- Inherited Members
Properties
DeviceOrdinal
Gets the CUDA device ordinal that owns this pool. 获取拥有当前内存池的 CUDA 设备序号。
public int DeviceOrdinal { get; }
Property Value
Pool
Gets a non-owning memory-pool view for querying attributes or making the pool current. 获取一个非拥有视图,用于查询属性或将该池设为当前池。
public CudaMemoryPool Pool { get; }
Property Value
Methods
AllocateAsync(int, CudaStream)
Asynchronously allocates device memory from this owned CUDA memory pool. 从当前 owned CUDA memory pool 中异步分配设备内存。
public CudaMemory AllocateAsync(int sizeInBytes, CudaStream stream)
Parameters
sizeInBytesintThe allocation size in bytes. 分配大小,单位为字节。
streamCudaStreamThe CUDA stream that orders the allocation. 用于排序分配操作的 CUDA stream。
Returns
- CudaMemory
A managed CUDA memory allocation. CUDA 设备内存托管封装。
Dispose()
Releases the owned CUDA memory pool if it has not already been released. 如果尚未释放,则销毁当前 owned CUDA 内存池。
public void Dispose()
MakeCurrent()
Makes this owned pool the current pool for its CUDA device. 将当前 owned 内存池设置为其 CUDA 设备的当前池。
public void MakeCurrent()
TrimTo(ulong)
Trims unused allocations in this owned CUDA memory pool. 裁剪当前 owned CUDA 内存池中未使用的缓存分配。
public void TrimTo(ulong minBytesToKeep)
Parameters
minBytesToKeepulongThe minimum number of cached bytes to keep. 至少保留的缓存字节数。