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

Function main

benchmarking/plot_bsz_sweep_runtime.py:200–243  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

198
199
200def main():
201 parser = argparse.ArgumentParser(description=__doc__)
202 parser.add_argument(
203 "--n_procs", type=int, default=N_PROCS, help="Number of processes (default: 1)"
204 )
205 parser.add_argument("--case", default=CASE, help="Benchmark case (default: small)")
206 parser.add_argument("--ncu-dir", type=Path, default=None)
207 parser.add_argument("--proton-dir", type=Path, default=None)
208 parser.add_argument("--out-dir", type=Path, default=None)
209 parser.add_argument("--fmt", default="png", help="Output image format (default: png)")
210 parser.add_argument(
211 "--use-name-flashsampling",
212 action="store_true",
213 help="Use 'FlashSampling' instead of 'FMMS' in plot labels",
214 )
215 args = parser.parse_args()
216 if args.ncu_dir is None:
217 args.ncu_dir = SWEEPS / "ncu-txt" / f"tp{args.n_procs}" / f"case-{args.case}"
218 if args.proton_dir is None:
219 args.proton_dir = SWEEPS / "proton" / f"tp{args.n_procs}" / f"case-{args.case}"
220 if args.out_dir is None:
221 args.out_dir = SWEEPS / f"tp{args.n_procs}"
222
223 args.out_dir.mkdir(parents=True, exist_ok=True)
224 rows = load_data(args.ncu_dir, args.proton_dir)
225 if args.use_name_flashsampling:
226 rows["method"] = rows["method"].replace(FLASHSAMPLING_RENAMES)
227 save_csv(rows, args.out_dir / "runtime-breakdown.csv")
228 plot(
229 rows,
230 args.out_dir / "sampling-latency",
231 args.fmt,
232 y_col="sampling_us",
233 y_label="Sampling Latency (\u00b5s)",
234 y_cap=800,
235 )
236 plot(
237 rows,
238 args.out_dir / "matmul-latency",
239 args.fmt,
240 y_col="matmul_us",
241 y_label="Matmul Latency (\u00b5s)",
242 style="bar",
243 )
244
245
246if __name__ == "__main__":

Callers 1

Calls 3

load_dataFunction · 0.85
save_csvFunction · 0.85
plotFunction · 0.85

Tested by

no test coverage detected