diff --git a/general/gpu.py b/general/gpu.py index f14d2c6..9e21d27 100644 --- a/general/gpu.py +++ b/general/gpu.py @@ -103,7 +103,8 @@ class CGPUInfo: vramUsed = -1 vramTotal = -1 vramPercent = -1 - + vramMb = -1 + gpuType = '' gpus = [] @@ -115,6 +116,7 @@ class CGPUInfo: 'vram_total': 0, 'vram_used': 0, 'vram_used_percent': 0, + 'vram_mb': 0, }) else: gpuType = self.cudaDevice @@ -131,6 +133,7 @@ class CGPUInfo: vramUsed = 0 vramTotal = 0 gpuTemperature = 0 + vramMb = 0 # GPU Utilization if self.switchGPU and self.gpusUtilization[deviceIndex]: @@ -159,7 +162,7 @@ class CGPUInfo: # check if vramTotal is not zero or None if vramTotal and vramTotal != 0: vramPercent = vramUsed / vramTotal * 100 - + vramMb = vramUsed / 1024 / 1024 # Temperature if self.switchTemperature and self.gpusTemperature[deviceIndex]: try: @@ -174,6 +177,7 @@ class CGPUInfo: 'vram_total': vramTotal, 'vram_used': vramUsed, 'vram_used_percent': vramPercent, + 'vram_mb': vramMb, }) return { diff --git a/web/monitor.js b/web/monitor.js index 2d09b49..5c1417b 100644 --- a/web/monitor.js +++ b/web/monitor.js @@ -264,7 +264,7 @@ class CrystoolsMonitor { name: this.menuPrefix + `[menu] Display GPU VRAM\r\n[${index}] ${name}`, type: 'boolean', label: labelVRAM, - symbol: '%', + symbol: ' Mb', title: `${index}: ${name}`, defaultValue: true, htmlMonitorRef: undefined, @@ -430,7 +430,7 @@ class CrystoolsMonitor { if (gpu === undefined) { return; } - this.updateMonitor(monitorSettings, gpu.vram_used_percent); + this.updateMonitorRam(monitorSettings, gpu.vram_mb, gpu.vram_used_percent); } else { } @@ -464,6 +464,18 @@ class CrystoolsMonitor { monitorSettings.htmlMonitorSliderRef.style.width = `${Math.floor(percent)}%`; } }); + Object.defineProperty(this, "updateMonitorRam", { + enumerable: true, + configurable: true, + writable: true, + value: (monitorSettings, used, percent) => { + if (!(monitorSettings.htmlMonitorSliderRef && monitorSettings.htmlMonitorLabelRef)) { + return; + } + monitorSettings.htmlMonitorLabelRef.innerHTML = `${Math.floor(used)}${monitorSettings.symbol}`; + monitorSettings.htmlMonitorSliderRef.style.width = `${Math.floor(percent)}%`; + } + }); Object.defineProperty(this, "updateAllAnimationDuration", { enumerable: true, configurable: true,