@@ -40,11 +40,13 @@ def test_gringarten_stehfest_precision(self):
40
40
def _log (msg ) -> None :
41
41
print (f'[DEBUG][test_gringarten_stehfest_precision] { msg } ' )
42
42
43
+ param_name = 'Gringarten-Stehfest Precision'
44
+
43
45
def _get_result (gringarten_stehfest_precision : int ) -> GeophiresXResult :
44
46
return GeophiresXClient (enable_caching = False ).get_geophires_result (
45
47
ImmutableGeophiresInputParameters (
46
48
from_file_path = self ._get_test_file_path ('generic-egs-case.txt' ),
47
- params = {'Gringarten-Stehfest Precision' : gringarten_stehfest_precision },
49
+ params = {param_name : gringarten_stehfest_precision },
48
50
)
49
51
)
50
52
@@ -62,9 +64,28 @@ def calc_time(r: GeophiresXResult) -> float:
62
64
63
65
self .assertLess (calc_time_8_sec , calc_time_15_sec )
64
66
67
+ max_calc_time_8_sec = 1.0
68
+ try :
69
+ self .assertLessEqual (calc_time_8_sec , 1.0 )
70
+ except AssertionError :
71
+ _log (
72
+ f'[WARNING] Calculation time for { param_name } =8 was greater than the expected maximum of '
73
+ f'{ max_calc_time_8_sec } seconds. This may indicate a performance regression, '
74
+ f'depending on the available compute resources.'
75
+ )
76
+
65
77
speedup_pct = ((calc_time_15_sec - calc_time_8_sec ) / calc_time_15_sec ) * 100
66
78
_log (f'Speedup: { speedup_pct :.2f} %' )
67
79
80
+ min_expected_speedup_pct = 25.0
81
+ try :
82
+ self .assertGreaterEqual (min_expected_speedup_pct , min_expected_speedup_pct )
83
+ except AssertionError :
84
+ _log (
85
+ f'[WARNING] Speedup for { param_name } =8 was less than the expected minimum of '
86
+ f'{ min_expected_speedup_pct } %. This may indicate a performance regression.'
87
+ )
88
+
68
89
def no_metadata (r : GeophiresXResult ) -> dict [str , Any ]:
69
90
ret = copy .deepcopy (r .result )
70
91
del ret ['Simulation Metadata' ]
0 commit comments