(state: "nvbench.State")
| 159 | """Run benchmarks using NVBench.""" |
| 160 | |
| 161 | def nvbench_kernel(state: "nvbench.State"): |
| 162 | provider = state.get_string("Provider") |
| 163 | case = as_case(args, provider) |
| 164 | kwargs = case.make_fn_kwargs() |
| 165 | sampler = get_sampler(provider, weights=kwargs["weights"]) |
| 166 | sampler.prepare() |
| 167 | |
| 168 | # Warmup (compile, autotune, etc.) |
| 169 | sampler.sample(**kwargs) |
| 170 | torch.cuda.synchronize() |
| 171 | |
| 172 | def launcher(launch: "nvbench.Launch"): |
| 173 | stream = _as_torch_stream(launch.get_stream()) |
| 174 | with torch.cuda.stream(stream): |
| 175 | sampler.sample(**kwargs) |
| 176 | |
| 177 | state.exec(launcher, batched=False) |
| 178 | |
| 179 | csv_args = [] |
| 180 | if args.tgt_dir is not None: |
nothing calls this directly
no test coverage detected