Table of Contents

Class CudaMemoryPressureSnapshot

Namespace
JYPPX.CudaSharp
Assembly
JYPPX.CudaSharp.dll

Captures CUDA memory pressure and device capability signals for deployment diagnostics. 捕获 CUDA 内存压力和设备能力信号,用于模型部署诊断。

public sealed class CudaMemoryPressureSnapshot
Inheritance
CudaMemoryPressureSnapshot
Inherited Members

Constructors

CudaMemoryPressureSnapshot(int, CudaMemoryInfo, CudaDeviceProperties)

Creates a CUDA memory pressure snapshot. 创建 CUDA 内存压力快照。

public CudaMemoryPressureSnapshot(int deviceOrdinal, CudaMemoryInfo memoryInfo, CudaDeviceProperties deviceProperties)

Parameters

deviceOrdinal int
memoryInfo CudaMemoryInfo
deviceProperties CudaDeviceProperties

Properties

DeviceOrdinal

Gets the CUDA device ordinal that produced this snapshot. 获取生成该快照的 CUDA 设备序号。

public int DeviceOrdinal { get; }

Property Value

int

DeviceProperties

Gets the deployment-oriented CUDA device property snapshot. 获取面向部署的 CUDA 设备属性快照。

public CudaDeviceProperties DeviceProperties { get; }

Property Value

CudaDeviceProperties

FreeRatio

Gets the current free memory ratio in the range 0 to 1. 获取当前空闲显存比例,范围为 0 到 1。

public double FreeRatio { get; }

Property Value

double

MemoryInfo

Gets the current CUDA memory information. 获取当前 CUDA 内存信息。

public CudaMemoryInfo MemoryInfo { get; }

Property Value

CudaMemoryInfo

UsedRatio

Gets the current used memory ratio in the range 0 to 1. 获取当前已使用显存比例,范围为 0 到 1。

public double UsedRatio { get; }

Property Value

double

Methods

IsBelowFreeRatio(double)

Returns whether free device memory is below the specified ratio threshold. 返回空闲显存是否低于指定比例阈值。

public bool IsBelowFreeRatio(double minimumFreeRatio)

Parameters

minimumFreeRatio double

Minimum expected free memory ratio. 期望的最小空闲显存比例。

Returns

bool

true when memory pressure is high. 内存压力较高时返回 true

ToString()

Returns a compact deployment diagnostic string. 返回简短的部署诊断字符串。

public override string ToString()

Returns

string