You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
887 B
32 lines
887 B
12 months ago
|
namespace StabilityMatrix.Core.Helper.HardwareInfo;
|
||
|
|
||
|
public record GpuInfo
|
||
|
{
|
||
|
public int Index { get; init; }
|
||
|
public string? Name { get; init; } = string.Empty;
|
||
|
public ulong MemoryBytes { get; init; }
|
||
|
public MemoryLevel? MemoryLevel =>
|
||
|
MemoryBytes switch
|
||
|
{
|
||
|
<= 0 => HardwareInfo.MemoryLevel.Unknown,
|
||
|
< 4 * Size.GiB => HardwareInfo.MemoryLevel.Low,
|
||
|
< 8 * Size.GiB => HardwareInfo.MemoryLevel.Medium,
|
||
|
_ => HardwareInfo.MemoryLevel.High
|
||
|
};
|
||
|
|
||
|
public bool IsNvidia
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
var name = Name?.ToLowerInvariant();
|
||
|
|
||
|
if (string.IsNullOrEmpty(name))
|
||
|
return false;
|
||
|
|
||
|
return name.Contains("nvidia") || name.Contains("tesla");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public bool IsAmd => Name?.Contains("amd", StringComparison.OrdinalIgnoreCase) ?? false;
|
||
|
}
|