From 23cbe48379bc7cb30edf77bb1117bb84adf43285 Mon Sep 17 00:00:00 2001 From: Junjie Li Date: Sat, 20 Jan 2024 23:08:45 -0600 Subject: [PATCH] drop 1st and last gpu data to exclude artifact in counting --- .../templates/machine/job_data_detail.html | 4 ++++ tacc_stats/site/machine/views.py | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/tacc_stats/site/machine/templates/machine/job_data_detail.html b/tacc_stats/site/machine/templates/machine/job_data_detail.html index 925598b..ac24809 100644 --- a/tacc_stats/site/machine/templates/machine/job_data_detail.html +++ b/tacc_stats/site/machine/templates/machine/job_data_detail.html @@ -80,6 +80,10 @@

Job Detail

Max GPU Utilization:     {{ gpu_utilization_max }}% + + Mean GPU Utilization: +     {{ gpu_utilization_mean|floatformat:1 }}% +

{% endif %} diff --git a/tacc_stats/site/machine/views.py b/tacc_stats/site/machine/views.py index ab61311..6737b8d 100644 --- a/tacc_stats/site/machine/views.py +++ b/tacc_stats/site/machine/views.py @@ -242,10 +242,17 @@ def get_context_data(self, **kwargs): # gpu - gpu_data = read_sql("""select type,event,value from host_data where jid = '{0}' and type='nvidia_gpu' and event='utilization'""".format(job.jid), conj) - gpu_utilization_max = gpu_data['value'].max() - context["gpu_active"]=round(gpu_utilization_max/100.0) - context["gpu_utilization_max"]=gpu_utilization_max + try: + gpu_data = read_sql("""select type,event,value from host_data where jid = '{0}' and type='nvidia_gpu' and event='utilization'""".format(job.jid), conj) + gpu_data = gpu_data.iloc[1:-1] + gpu_utilization_max = gpu_data['value'].max() + gpu_utilization_mean = gpu_data['value'].mean() + if not isnan(gpu_utilization_max): + context["gpu_active"]=round(gpu_utilization_max/100.0) + context["gpu_utilization_max"]=gpu_utilization_max + context["gpu_utilization_mean"]=gpu_utilization_mean + except: + print("error getting gpu data") # xalt xalt_data=xalt_data_c()