Skip to content

Commit 8a9b62a

Browse files
authored
[Benchmarks] Validate stddev in Compute Benchmarks (#19829)
Don't write invalid value of stddev into Results json.
1 parent ea192fd commit 8a9b62a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

devops/scripts/benchmarks/benches/compute.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
import csv
88
import io
99
import copy
10+
import math
11+
from enum import Enum
12+
1013
from utils.utils import run, git_clone, create_build_path
11-
from .base import Benchmark, Suite
1214
from utils.result import BenchmarkMetadata, Result
15+
from .base import Benchmark, Suite
1316
from options import options
14-
from enum import Enum
1517

1618

1719
class RUNTIMES(Enum):
@@ -402,6 +404,9 @@ def parse_output(self, output):
402404
median = float(data_row[2])
403405
# compute benchmarks report stddev as %
404406
stddev = mean * (float(data_row[3].strip("%")) / 100.0)
407+
if not math.isfinite(stddev):
408+
stddev = 0.0 # Default to 0.0 if stddev is invalid
409+
405410
unit = data_row[7]
406411
results.append((label, median, stddev, unit))
407412
except (ValueError, IndexError) as e:

0 commit comments

Comments
 (0)