Skip to content

Commit 2c55acd

Browse files
committed
.
1 parent acd30c9 commit 2c55acd

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/benchmark_utils.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ def simple_timeit(f, *args, matrix_dim=None, tries=10, task=None, trace_dir=None
3131
assert task is not None
3232

3333
if trace_dir:
34-
outcomes_ms = timeit_from_trace(f, *args, matrix_dim=matrix_dim, tries=tries, task=task, trace_dir=trace_dir)
35-
if outcomes_ms is not None:
36-
return outcomes_ms
34+
try:
35+
outcomes_ms = timeit_from_trace(
36+
f, *args, matrix_dim=matrix_dim, tries=tries, task=task, trace_dir=trace_dir
37+
)
38+
if outcomes_ms is not None:
39+
return outcomes_ms
40+
print("Warning: timeit_from_trace returned empty results. Falling back to manual timing.")
41+
except Exception as e:
42+
print(f"Warning: Failed to get metrics from trace due to: {e}. Falling back to manual timing.")
3743

3844
outcomes_ms = []
3945
jax.block_until_ready(f(*args)) # warm it up!

0 commit comments

Comments
 (0)