@@ -373,6 +373,7 @@ def calc(row):
373
373
374
374
375
375
gpu_re2 = re .compile (r'gpu=(\d+)' )
376
+ gpu_re2_type = re .compile (rf'\bgres/gpu:([^=]+)=\b' )
376
377
class slurmGPUCount (linefunc ):
377
378
type = 'int'
378
379
@staticmethod
@@ -382,6 +383,14 @@ def calc(row):
382
383
m = gpu_re2 .search (tres )
383
384
if m :
384
385
return int (m .group (1 ))
386
+ class slurmGPUType (linefunc ):
387
+ type = 'text'
388
+ @staticmethod
389
+ def calc (row ):
390
+ if not row ['AllocTRES' ]: return None
391
+ m = gpu_re2_type .search (row ['AllocTRES' ])
392
+ if m :
393
+ return m .group (1 )
385
394
386
395
RE_TRES_GPU = re .compile (rf'\bgres/gpu=([^,]*)\b' )
387
396
RE_TRES_GPU_UTIL = re .compile (rf'\bgres/gpuutil=([^,]*)\b' )
@@ -649,6 +658,7 @@ def calc(row):
649
658
'_GpuEff' : slurmGPUEff2 , # GPU utilization (0.0 to 1.0) from AllocTRES()
650
659
#'_NGPU': slurmGPUCount, # Number of GPUs, extracted from comment field
651
660
'_NGpus' : ExtractField ('NGpus' , 'AllocTRES' , 'gres/gpu' , float_metric ),
661
+ '_GpuType' : slurmGPUType , # gres/gpu:TYPE= from AllocTres
652
662
'_GpuUtil' : ExtractField ('GpuUtil' , 'TRESUsageInAve' , 'gres/gpuutil' , float_metric , wrap = lambda x : x / 100. ), # can be >100 for multi-GPU.
653
663
'_GpuMem' : ExtractField ('GpuMem2' , 'TRESUsageInAve' , 'gres/gpumem' , float_metric ),
654
664
'_GpuUtilTot' : ExtractField ('GpuUtilTot' , 'TRESUsageInTot' , 'gres/gpuutil' , float_metric ),
@@ -921,6 +931,7 @@ def infer_type(cd):
921
931
'max(MemEff) AS MemEff, '
922
932
'max(AllocMem*Elapsed) AS mem_s_reserved, ' # highest of any job
923
933
'max(NGpus) AS NGpus, '
934
+ 'max(GPUType) AS GPUType, '
924
935
'max(NGpus)*max(Elapsed) AS gpu_s_reserved, '
925
936
'max(NGpus)*max(Elapsed)*max(GPUutil) AS gpu_s_used, '
926
937
#'max(GPUutil)/max(NGpus) AS GPUeff, ' # Individual job with highest use (check this)
0 commit comments