Table of Contents

Class PinnedBuffer<T>

Namespace
NVMathNet
Assembly
NVMath.Net.dll

Page-locked (pinned) host memory for maximum-throughput, zero-copy transfers between host and device.

public sealed class PinnedBuffer<T> : IDisposable where T : unmanaged, INumberBase<T>

Type Parameters

T

Unmanaged numeric element type.

Inheritance

Implements

Inherited Members

Constructors

PinnedBuffer(long)

Allocates length pinned host elements.

public PinnedBuffer(long length)

Parameters

length long

Properties

Length

Number of elements.

public long Length { get; }

Property Value

long

Pointer

Raw host pointer as void*.

public void* Pointer { get; }

Property Value

void*

PointerAsInt

Raw host pointer as System.IntPtr (page-locked).

public nint PointerAsInt { get; }

Property Value

nint

SizeInBytes

Total size in bytes.

public nuint SizeInBytes { get; }

Property Value

nuint

Span

A System.Span`1 over the pinned region. Valid as long as the buffer is alive.

public Span<T> Span { get; }

Property Value

Span<T>

Methods

CopyFromDevice(DeviceBuffer<T>, CudaStream)

Copies a NVMathNet.DeviceBuffer`1 back into this pinned buffer.

public void CopyFromDevice(DeviceBuffer<T> device, CudaStream stream)

Parameters

device DeviceBuffer<T>
stream CudaStream

CopyToDevice(DeviceBuffer<T>, CudaStream)

Copies the pinned buffer to a NVMathNet.DeviceBuffer`1 using DMA.

public void CopyToDevice(DeviceBuffer<T> device, CudaStream stream)

Parameters

device DeviceBuffer<T>
stream CudaStream

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()