@@ -179,11 +179,12 @@ def temperature():
179
179
# TODO: Built in function for *nix in psutil, for Windows can use WMI or a third party library
180
180
181
181
182
- def display_gpu_stats (load , memory_percentage , memory_used , temperature ):
182
+ def display_gpu_stats (load , memory_percentage , memory_used_mb , temperature ):
183
183
if THEME_DATA ['STATS' ]['GPU' ]['PERCENTAGE' ]['GRAPH' ].get ("SHOW" , False ):
184
184
if math .isnan (load ):
185
185
logger .warning ("Your GPU load is not supported yet" )
186
186
THEME_DATA ['STATS' ]['GPU' ]['PERCENTAGE' ]['GRAPH' ]['SHOW' ] = False
187
+ THEME_DATA ['STATS' ]['GPU' ]['PERCENTAGE' ]['TEXT' ]['SHOW' ] = False
187
188
else :
188
189
# logger.debug(f"GPU Load: {load}")
189
190
display .lcd .DisplayProgressBar (
@@ -206,6 +207,7 @@ def display_gpu_stats(load, memory_percentage, memory_used, temperature):
206
207
if THEME_DATA ['STATS' ]['GPU' ]['PERCENTAGE' ]['TEXT' ].get ("SHOW" , False ):
207
208
if math .isnan (load ):
208
209
logger .warning ("Your GPU load is not supported yet" )
210
+ THEME_DATA ['STATS' ]['GPU' ]['PERCENTAGE' ]['GRAPH' ]['SHOW' ] = False
209
211
THEME_DATA ['STATS' ]['GPU' ]['PERCENTAGE' ]['TEXT' ]['SHOW' ] = False
210
212
else :
211
213
display .lcd .DisplayText (
@@ -245,12 +247,12 @@ def display_gpu_stats(load, memory_percentage, memory_used, temperature):
245
247
)
246
248
247
249
if THEME_DATA ['STATS' ]['GPU' ]['MEMORY' ]['TEXT' ].get ("SHOW" , False ):
248
- if math .isnan (memory_percentage ):
250
+ if math .isnan (memory_used_mb ):
249
251
logger .warning ("Your GPU memory absolute usage (M) is not supported yet" )
250
252
THEME_DATA ['STATS' ]['GPU' ]['MEMORY' ]['TEXT' ]['SHOW' ] = False
251
253
else :
252
254
display .lcd .DisplayText (
253
- text = f"{ int (memory_used / 1000000 ):>5} M" ,
255
+ text = f"{ int (memory_used_mb ):>5} M" ,
254
256
x = THEME_DATA ['STATS' ]['GPU' ]['MEMORY' ]['TEXT' ].get ("X" , 0 ),
255
257
y = THEME_DATA ['STATS' ]['GPU' ]['MEMORY' ]['TEXT' ].get ("Y" , 0 ),
256
258
font = THEME_DATA ['STATS' ]['GPU' ]['MEMORY' ]['TEXT' ].get ("FONT" , "roboto-mono/RobotoMono-Regular.ttf" ),
@@ -285,20 +287,20 @@ def stats():
285
287
nvidia_gpus = GPUtil .getGPUs ()
286
288
287
289
memory_used_all = [item .memoryUsed for item in nvidia_gpus ]
288
- memory_used = sum (memory_used_all ) / len (memory_used_all )
290
+ memory_used_mb = sum (memory_used_all ) / len (memory_used_all )
289
291
290
292
memory_total_all = [item .memoryTotal for item in nvidia_gpus ]
291
- memory_total = sum (memory_total_all ) / len (memory_total_all )
293
+ memory_total_mb = sum (memory_total_all ) / len (memory_total_all )
292
294
293
- memory_percentage = (memory_used / memory_total ) * 100
295
+ memory_percentage = (memory_used_mb / memory_total_mb ) * 100
294
296
295
297
load_all = [item .load for item in nvidia_gpus ]
296
298
load = (sum (load_all ) / len (load_all )) * 100
297
299
298
300
temperature_all = [item .temperature for item in nvidia_gpus ]
299
301
temperature = sum (temperature_all ) / len (temperature_all )
300
302
301
- display_gpu_stats (load , memory_percentage , memory_used , temperature )
303
+ display_gpu_stats (load , memory_percentage , memory_used_mb , temperature )
302
304
303
305
@staticmethod
304
306
def is_available ():
@@ -317,20 +319,20 @@ def stats():
317
319
i = i + 1
318
320
319
321
memory_used_all = [item .query_vram_usage () for item in amd_gpus ]
320
- memory_used = sum (memory_used_all ) / len (memory_used_all )
322
+ memory_used_bytes = sum (memory_used_all ) / len (memory_used_all )
321
323
322
324
memory_total_all = [item .memory_info ["vram_size" ] for item in amd_gpus ]
323
- memory_total = sum (memory_total_all ) / len (memory_total_all )
325
+ memory_total_bytes = sum (memory_total_all ) / len (memory_total_all )
324
326
325
- memory_percentage = (memory_used / memory_total ) * 100
327
+ memory_percentage = (memory_used_bytes / memory_total_bytes ) * 100
326
328
327
329
load_all = [item .query_load () for item in amd_gpus ]
328
330
load = (sum (load_all ) / len (load_all )) * 100
329
331
330
332
temperature_all = [item .query_temperature () for item in amd_gpus ]
331
333
temperature = sum (temperature_all ) / len (temperature_all )
332
334
333
- display_gpu_stats (load , memory_percentage , memory_used , temperature )
335
+ display_gpu_stats (load , memory_percentage , memory_used_bytes / 1000000 , temperature )
334
336
elif pyadl :
335
337
amd_gpus = pyadl .ADLManager .getInstance ().getDevices ()
336
338
0 commit comments