mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 19:54:44 -07:00
better monitor: fix excessive VRAM rounding
This commit is contained in:
parent
6de8417b5d
commit
dc922b333d
4 changed files with 11 additions and 15 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "gerbil",
|
"name": "gerbil",
|
||||||
"productName": "Gerbil",
|
"productName": "Gerbil",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"description": "Run Large Language Models locally",
|
"description": "Run Large Language Models locally",
|
||||||
"main": "out/main/index.js",
|
"main": "out/main/index.js",
|
||||||
"homepage": "./",
|
"homepage": "./",
|
||||||
|
|
|
||||||
|
|
@ -117,8 +117,7 @@ const checkVramWarnings = async (backend: string): Promise<Warning[]> => {
|
||||||
|
|
||||||
if (gpuMemoryInfo) {
|
if (gpuMemoryInfo) {
|
||||||
const lowVramGpus = gpuMemoryInfo.filter(
|
const lowVramGpus = gpuMemoryInfo.filter(
|
||||||
(gpu) =>
|
(gpu) => typeof gpu.totalMemoryGB === 'number' && gpu.totalMemoryGB < 8
|
||||||
typeof gpu.totalMemoryGB === 'number' && gpu.totalMemoryGB < 8
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (lowVramGpus.length > 0) {
|
if (lowVramGpus.length > 0) {
|
||||||
|
|
@ -126,8 +125,7 @@ const checkVramWarnings = async (backend: string): Promise<Warning[]> => {
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
message: `Low VRAM detected (${lowVramGpus
|
message: `Low VRAM detected (${lowVramGpus
|
||||||
.map(
|
.map(
|
||||||
(gpu) =>
|
(gpu) => `${gpu.deviceName}: ${gpu.totalMemoryGB!.toFixed(1)}GB`
|
||||||
`${gpu.deviceName}: ${gpu.totalMemoryGB!.toFixed(1)}GB`
|
|
||||||
)
|
)
|
||||||
.join(
|
.join(
|
||||||
', '
|
', '
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { platform } from 'process';
|
||||||
import si from 'systeminformation';
|
import si from 'systeminformation';
|
||||||
import { BrowserWindow } from 'electron';
|
import { BrowserWindow } from 'electron';
|
||||||
import { logError } from '@/main/modules/logging';
|
import { logError } from '@/main/modules/logging';
|
||||||
|
|
@ -45,7 +46,7 @@ let cpuInterval: ReturnType<typeof setInterval> | null = null;
|
||||||
let memoryInterval: ReturnType<typeof setInterval> | null = null;
|
let memoryInterval: ReturnType<typeof setInterval> | null = null;
|
||||||
let gpuInterval: ReturnType<typeof setInterval> | null = null;
|
let gpuInterval: ReturnType<typeof setInterval> | null = null;
|
||||||
let isRunning = false;
|
let isRunning = false;
|
||||||
const updateFrequency = 2000;
|
const updateFrequency = platform === 'win32' ? 2000 : 1000;
|
||||||
let mainWindow: BrowserWindow | null = null;
|
let mainWindow: BrowserWindow | null = null;
|
||||||
|
|
||||||
export function startMonitoring(window: BrowserWindow) {
|
export function startMonitoring(window: BrowserWindow) {
|
||||||
|
|
|
||||||
|
|
@ -167,9 +167,8 @@ foreach ($gpu in $gpus) {
|
||||||
gpus.push({
|
gpus.push({
|
||||||
deviceName: name,
|
deviceName: name,
|
||||||
usage: Math.round(utilization * 100) / 100,
|
usage: Math.round(utilization * 100) / 100,
|
||||||
memoryUsed: usedRAM > 0 ? Math.round(usedRAM / (1024 * 1024 * 1024)) : 0,
|
memoryUsed: usedRAM > 0 ? usedRAM / (1024 * 1024 * 1024) : 0,
|
||||||
memoryTotal:
|
memoryTotal: totalRAM > 0 ? totalRAM / (1024 * 1024 * 1024) : 0,
|
||||||
totalRAM > 0 ? Math.round(totalRAM / (1024 * 1024 * 1024)) : 0,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -214,12 +213,10 @@ async function getLinuxGPUData() {
|
||||||
);
|
);
|
||||||
|
|
||||||
const usage = parseInt(usageData.trim(), 10) || 0;
|
const usage = parseInt(usageData.trim(), 10) || 0;
|
||||||
const memoryUsed = Math.round(
|
const memoryUsed =
|
||||||
(parseInt(memUsedData.trim(), 10) || 0) / (1024 * 1024 * 1024)
|
(parseInt(memUsedData.trim(), 10) || 0) / (1024 * 1024 * 1024);
|
||||||
);
|
const memoryTotal =
|
||||||
const memoryTotal = Math.round(
|
(parseInt(memTotalData.trim(), 10) || 0) / (1024 * 1024 * 1024);
|
||||||
(parseInt(memTotalData.trim(), 10) || 0) / (1024 * 1024 * 1024)
|
|
||||||
);
|
|
||||||
|
|
||||||
gpus.push({
|
gpus.push({
|
||||||
deviceName: 'GPU',
|
deviceName: 'GPU',
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue