MCPcopy Create free account
hub / github.com/FlashSampling/FlashSampling / run_cupti

Function run_cupti

src/fused_mm_sampling/bench/speed_test.py:207–235  ·  view source on GitHub ↗

Run benchmarks using FlashInfer's CUPTI-based bench_gpu_time.

(args: Args)

Source from the content-addressed store, hash-verified

205
206
207def run_cupti(args: Args) -> None:
208 """Run benchmarks using FlashInfer's CUPTI-based bench_gpu_time."""
209 tp = args.make_tp()
210 is_distributed = tp.size > 1
211 rows = []
212 for provider in args.providers():
213 case = as_case(args, provider)
214 fn = _prepare_case(case)
215
216 tp.rank0_print(f"Benchmarking {provider}...")
217 times_ms = bench_cupti(
218 fn,
219 warmup_iters=args.n_runs_warmup,
220 rep_iters=args.n_runs_benchmark,
221 is_distributed=is_distributed,
222 )
223 times_md = pd.Series(times_ms)
224 rows.append(
225 {
226 "Provider": provider,
227 "median_ms": times_md.median(),
228 "min_ms": times_md.min(),
229 "max_ms": times_md.max(),
230 "iters": len(times_ms),
231 }
232 )
233
234 if tp.is_rank0():
235 _print_and_dump_cupti_results(rows, args)
236
237
238def _print_and_dump_cupti_results(rows: list[dict], args: Args) -> None:

Callers 1

_run_speed_test_implFunction · 0.85

Calls 8

as_caseFunction · 0.85
_prepare_caseFunction · 0.85
bench_cuptiFunction · 0.85
make_tpMethod · 0.80
providersMethod · 0.80
rank0_printMethod · 0.80
is_rank0Method · 0.80

Tested by

no test coverage detected