Commit Graph

20 Commits

Author SHA1 Message Date
Oleksandr Pavlyk
9ea77bccaa Implement CLI option to control warmups for cold measurements (#339)
* Implement warmup-runs count, supported as CLI

CLI option --warmup-runs implemented and documented.

The warm-up counts is enforced to always be positive.
This is necessary to ensure that JIT-ting has occurred,
and use of blocking kernel would not result in time-outs.

Test is option parser is added.

* Ensure that measure_cold::run_warmup instantiates blocking kernel

Because warm-up runs are executed without use of blocking kernel,
the blocking kernel was not jitted until actual measurements were
collected. The module loading cost incurred during the first run
shows as elevated CPU time noise value for the first measurement
as noted in https://github.com/NVIDIA/nvbench/pull/339

This PR adds `this->block_stream(); this->unblock_stream();` prior
to executing warm-up loop with use of blocking kernel disabled.

This ensures that blocking kernel is instantiated during the warm-up,
but it no other kernel is launched between its launch and stream sync
thus avoiding deadlocking.

* Rename --warmup-runs to --cold-warmup-runs, add --cold-max-warmup-walltime

Since configurable number of warmups only applies to measure_cold.cuh
rename the CLI option to reflect that.

Also add --cold-max-warmup-walltime (defaults to -1, i.e. disabled).
If enabled, exits warmup loop before request count is reached if
the wall-time expanded executign warmups exceeds this max-warmup-walltime
value.
2026-05-12 14:30:08 -05:00
Oleksandr Pavlyk
7dfbcad27c Create directories for output files (#360)
* QOL UX, NVBench creates directories for output JSON, MD, CSV files

This closes #185 and supports specifying
`--json path/to/nonexistent/folder/result.json`

This would create sequence of folders where to place result.json

```
(py313) :~/repos/nvbench$ rm -rf /tmp/nested/
(py313) :~/repos/nvbench$ ./build2/bin/nvbench.example.cpp20.axes -b copy_type_and_block_size_sweep -a Type=I32 -a BlockSize=64 --jsonbin /tmp/nested/json/axes.json --md /tmp/nested/md/res.md --csv /tmp/nested/csv/res.csv > /dev/null 2>&1
(py313) :~/repos/nvbench$ tree /tmp/nested/
/tmp/nested/
├── csv
│   └── res.csv
├── json
│   ├── axes.json
│   ├── axes.json-bin
│   │   └── 0.bin
│   └── axes.json-freqs-bin
│       └── 0.bin
└── md
    └── res.md

6 directories, 5 files
```

* Add a test that non-existent output folder is created

* Remove throwing custom error message. Use default

* Replace static_assert(false, ...) with #error
2026-05-12 10:26:28 -05:00
Allison Piper
f44f5cc22c Remove min-time/max-noise API. (#223)
These are now owned by the stdrel stopping criterion, and should not be exposed directly in the benchmark/state/etc APIs.

This will affect users that are calling
`NVBENCH_BENCH(...).set_min_time(...)` or
`NVBENCH_BENCH(...).set_max_noise(...)`.

These can be updated to
`NVBENCH_BENCH(...).set_criterion_param_float64(["min-time"|"max-noise"], ...)`.
2025-05-08 10:02:54 -04:00
Sergey Pavlov
433376fd83 Restrict stopping criterion parameter usage in command line (#174)
* restrict stopping criterion parameter usage in command line
* Update docs for stopping criterion.
* Add convenience benchmark_base API for criterion params.
* Add more test cases for stopping criterion parsing.

---------

Co-authored-by: Sergey Pavlov <psvvsp89@gmail.com>
Co-authored-by: Allison Piper <alliepiper16@gmail.com>
2025-04-30 15:53:45 -04:00
Allison Piper
3440855dbd Formatting updates. 2025-04-14 17:26:12 +00:00
Georgy Evtushenko
b789240c76 Entropy-based stopping criterion 2024-01-05 14:59:48 -08:00
Vyas Ramasubramani
a3b729bca8 fmt::memory_buffer is no longer an iterator. 2022-11-03 10:04:02 -07:00
Allison Vacanti
0dcd915ea6 Fix test failure. 2021-03-18 16:07:50 -04:00
Allison Vacanti
4e83e048ba Store percentages as ratios.
Human-readable outputs (md) and CLI inputs still use percentages.
In-memory and machine-readable outputs (csv, json) use ratios.

This is the convention that spreadsheet apps expect. Fixes #2.
2021-03-18 13:42:43 -04:00
Allison Vacanti
cc01d8863c Fix copyright year. 2021-03-08 18:39:27 -05:00
Allison Vacanti
078919b6b4 Add LICENSE file and boilerplate.
for i in `find  ./ -regex ".*\.cuh?$"`
do
  sh -c "cat ~/boilerplate ${i} > tmp && mv tmp ${i}"
done
2021-03-04 16:03:02 -05:00
Allison Vacanti
37e753f7b6 Update benchmark macros:
s/NVBENCH_CREATE/NVBENCH_BENCH/g
s/NVBENCH_BENCH_TEMPLATE/NVBENCH_BENCH_TYPES/g

This will fit nicer once the exec_tags version are added:

NVBENCH_BENCH
NVBENCH_BENCH_TYPES
NVBENCH_BENCH_FLAGS
NVBENCH_BENCH_TYPES_FLAGS
2021-02-16 16:08:38 -05:00
Allison Vacanti
bb871094c3 Fixes for multidevice/gcc.
- Allow devices to be cleared during benchmark definition.
- Fix various demangling bugs.
2021-02-15 21:26:21 -05:00
Allison Vacanti
6c67578dcd Implement skip_time and improve logging. 2021-02-15 17:39:46 -05:00
Allison Vacanti
92cc3b1189 Execute benchmarks on all devices. 2021-02-12 20:53:10 -05:00
Allison Vacanti
3bc8291b28 Allow benchmarks to be specified by index with --benchmark. 2021-02-10 21:40:39 -05:00
Allison Vacanti
0477514bb6 Axis spec revamp.
- Add support for single values ("Axis=Value").
- Make other value specs shell friendly:
  - Range: "Axis:(2:10:2)"  -> "Axis=[2:10:2]"
  - List:  "Axis:{2,3,4,5}" -> "Axis=[2,3,4,5]"
  - ":" -> "=" feels more natural
  - "{}()" characters have special meaning in bash.
  - "[]" character don't require escapes.
  - Using the same braces for both ranges/list is easier to remember,
    only the delimiter changes.
2021-02-10 09:55:50 -05:00
Allison Vacanti
e302583c67 Fix usages of ASSERT_MSG that creates empty __VA_ARGS__.
Invoking a variadic macro with zero variadic args is illegal until
C++20. The extra calls to fmt::format were unnecessary, anyway.
2021-02-04 18:54:20 -05:00
Allison Vacanti
6bb22b952c Add option parsing to NVBENCH_MAIN.
- Convert benchmark_manager into a read-only structure.
  - Mutable benchmarks will be provided by
    `option_parser::get_benchmarks()` or
    `benchmark_manager::clone_benchmarks()`.
2021-02-04 13:15:21 -05:00
Allison Vacanti
efd4442d1b Add option_parser.
Currently supports `--benchmark` and `--axis` options.
2021-02-03 21:39:17 -05:00