Class CudaManagedMemory
Managed wrapper around a CUDA unified-memory allocation. CUDA unified memory 分配的托管封装。
public sealed class CudaManagedMemory : CudaMemory, IDisposable
- Inheritance
-
CudaManagedMemory
- Implements
- Inherited Members
Constructors
CudaManagedMemory(int, CudaManagedMemoryAttachmentFlags)
Allocates CUDA managed memory with the requested attachment flags. 使用指定的附着标志分配 CUDA managed memory。
public CudaManagedMemory(int sizeInBytes, CudaManagedMemoryAttachmentFlags flags = CudaManagedMemoryAttachmentFlags.Global)
Parameters
sizeInBytesintThe allocation size in bytes. 分配大小,单位为字节。
flagsCudaManagedMemoryAttachmentFlagsThe managed-memory attachment flags. managed memory 附着标志。
Properties
AttachmentFlags
Gets the managed-memory attachment flags used for the allocation. 获取该分配使用的 managed memory 附着标志。
public CudaManagedMemoryAttachmentFlags AttachmentFlags { get; }
Property Value
Methods
Advise(CudaMemoryAdvice, CudaMemoryLocation)
Applies CUDA memory advice to this entire managed allocation at a strongly typed location. 对强类型位置上的整个 managed memory 分配应用 CUDA memory advice。
public void Advise(CudaMemoryAdvice advice, CudaMemoryLocation location)
Parameters
adviceCudaMemoryAdvicelocationCudaMemoryLocation
Advise(int, int, CudaMemoryAdvice, CudaMemoryLocation)
Applies CUDA memory advice to a managed-memory range at a strongly typed location. 对强类型位置上的 managed memory 范围应用 CUDA memory advice。
public void Advise(int offset, int count, CudaMemoryAdvice advice, CudaMemoryLocation location)
Parameters
offsetintThe byte offset within this allocation. 当前分配内的字节偏移。
countintThe number of bytes covered by the advice. advice 覆盖的字节数。
adviceCudaMemoryAdviceThe CUDA memory advice. CUDA 内存建议。
locationCudaMemoryLocationThe CUDA memory location associated with the advice. 与 advice 关联的 CUDA memory 位置。
PrefetchAsync(CudaMemoryLocation, CudaStream)
Asynchronously prefetches this entire managed allocation to a strongly typed CUDA location. 异步将整个 managed memory 分配预取到强类型 CUDA 位置。
public void PrefetchAsync(CudaMemoryLocation location, CudaStream stream)
Parameters
locationCudaMemoryLocationstreamCudaStream
PrefetchAsync(int, int, CudaMemoryLocation, CudaStream)
Asynchronously prefetches a managed-memory range to a strongly typed CUDA location. 异步将 managed memory 范围预取到强类型 CUDA 位置。
public void PrefetchAsync(int offset, int count, CudaMemoryLocation location, CudaStream stream)
Parameters
offsetintThe byte offset within this allocation. 当前分配内的字节偏移。
countintThe number of bytes to prefetch. 要预取的字节数。
locationCudaMemoryLocationThe destination CUDA memory location. 目标 CUDA memory 位置。
streamCudaStreamThe CUDA stream that orders the prefetch. 用于排序预取操作的 CUDA stream。
Remarks
Keep this allocation and stream alive until the stream has synchronized.
在 stream 完成同步前,调用方必须保持此分配和 stream 存活。