MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / print_report

Function print_report

kernelbench/scorer.py:246–302  ·  view source on GitHub ↗

Print a leaderboard-style report.

(results: Optional[List[Dict]] = None)

Source from the content-addressed store, hash-verified

244
245
246def print_report(results: Optional[List[Dict]] = None) -> None:
247 """Print a leaderboard-style report."""
248 scores = load_scores()
249
250 if results is None:
251 results = list(scores.get("problems", {}).values())
252
253 if not results:
254 print("No results found. Run scorer first.")
255 return
256
257 # Group by level
258 by_level: Dict[int, List[Dict]] = {}
259 for r in results:
260 lvl = r.get("level", 0)
261 by_level.setdefault(lvl, []).append(r)
262
263 print("\n" + "=" * 70)
264 print("KERNELBENCH RESULTS")
265 print("=" * 70)
266
267 for lvl in sorted(by_level):
268 level_results = by_level[lvl]
269 n_total = len(level_results)
270 n_correct = sum(1 for r in level_results if r.get("correctness") == "PASS")
271 n_errors = sum(1 for r in level_results if r.get("error"))
272
273 fast_p = compute_all_fast_p(level_results)
274
275 print(f"\nLevel {lvl}: {n_total} problems")
276 print(f" Correct: {n_correct}/{n_total} ({100 * n_correct / n_total:.1f}%)")
277 if n_errors:
278 print(f" Errors: {n_errors}")
279
280 print(f" fast_p scores:")
281 for key, val in fast_p.items():
282 bar = "#" * int(val * 40) + "." * (40 - int(val * 40))
283 print(f" {key:>8}: {val:.3f} [{bar}]")
284
285 # Top speedups
286 correct_results = [r for r in level_results if r.get("correctness") == "PASS"]
287 if correct_results:
288 top = sorted(correct_results, key=lambda r: r.get("speedup", 0), reverse=True)[:5]
289 print(f" Top speedups:")
290 for r in top:
291 pid = r.get("problem_id", "?")
292 print(f" P{pid:03d}: {r.get('speedup', 0):.2f}x")
293
294 # Aggregate across all levels
295 all_results = [r for rs in by_level.values() for r in rs]
296 if len(by_level) > 1:
297 print(f"\nAggregate ({len(all_results)} problems):")
298 agg_fast_p = compute_all_fast_p(all_results)
299 for key, val in agg_fast_p.items():
300 print(f" {key:>8}: {val:.3f}")
301
302 print("\n" + "=" * 70)
303

Callers 1

mainFunction · 0.70

Calls 2

load_scoresFunction · 0.85
compute_all_fast_pFunction · 0.85

Tested by

no test coverage detected