MCPcopy Index your code
hub / github.com/FlashSampling/FlashSampling / benchmark

Function benchmark

src/fused_mm_sampling/bench/speed_test.py:111–128  ·  view source on GitHub ↗

Time kernel execution using CUDA events.

(case: Case)

Source from the content-addressed store, hash-verified

109
110
111def benchmark(case: Case) -> pd.DataFrame:
112 """Time kernel execution using CUDA events."""
113 fn = _prepare_case(case)
114 is_distributed = case.tp.size > 1
115 times_ms = bench_cuda_events(
116 fn,
117 warmup_iters=case.n_runs_warmup,
118 rep_iters=case.n_runs_benchmark,
119 is_distributed=is_distributed,
120 )
121 results = {
122 "name": case.name,
123 "total[s]": sum(times_ms) / 1_000,
124 "time[s]": [t / 1_000 for t in times_ms],
125 "time[ms]": times_ms,
126 "time[µs]": [t * 1_000 for t in times_ms],
127 }
128 return pd.DataFrame(results)
129
130
131def nsys_profile(case: Case) -> None:

Callers 1

benchmark_allFunction · 0.70

Calls 2

_prepare_caseFunction · 0.85
bench_cuda_eventsFunction · 0.85

Tested by

no test coverage detected