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

Function _prepare_case

src/fused_mm_sampling/bench/speed_test.py:97–108  ·  view source on GitHub ↗

Set up sampler and fn for a benchmark case.

(case: Case)

Source from the content-addressed store, hash-verified

95
96
97def _prepare_case(case: Case):
98 """Set up sampler and fn for a benchmark case."""
99 case.tp.rank0_print("=" * 80)
100 case.tp.rank0_print(f"Benchmarking {case.name}...")
101 kwargs = case.make_fn_kwargs()
102 sampler = get_sampler(case.name, weights=kwargs["weights"])
103 sampler.prepare()
104
105 def fn():
106 return sampler.sample(**kwargs)
107
108 return fn
109
110
111def benchmark(case: Case) -> pd.DataFrame:

Callers 3

benchmarkFunction · 0.85
nsys_profileFunction · 0.85
run_cuptiFunction · 0.85

Calls 4

get_samplerFunction · 0.85
rank0_printMethod · 0.80
make_fn_kwargsMethod · 0.80
prepareMethod · 0.45

Tested by

no test coverage detected