|
| nvbench_manager ()=default |
|
| ~nvbench_manager ()=default |
|
void | initialize (int &argc, char **argv) |
| Initialize the NVBench library.
|
|
template<typename Func , typename... Args> |
nvbench::benchmark_base & | add_nvbench (const char *name, Func f, Args &&...args) |
| Register a benchmark function with NVBench.
|
|
void | run () |
| Run the registered benchmarks.
|
|
Manager class for NVBench integration.
This class handles the initialization, registration, and execution of benchmarks using the NVBench library. It provides methods to initialize the library with command-line arguments, register benchmark functions, and run the benchmarks.
template<typename Func , typename... Args>
nvbench::benchmark_base & comppare::plugin::nvbenchplugin::nvbench_manager::add_nvbench |
( |
const char * |
name, |
|
|
Func |
f, |
|
|
Args &&... |
args |
|
) |
| |
|
inline |
Register a benchmark function with NVBench.
- Template Parameters
-
Func | The type of the benchmark function. |
Args | The types of the arguments to the benchmark function. |
- Parameters
-
name | The name of the benchmark. |
f | The function/implementation to register. |
args | The arguments to pass to the benchmark function. |
- Returns
- A reference to the registered benchmark.
This helper simplifies registering a benchmark by automatically wrapping the provided function and its arguments into a NVBench-compatible lambda. The lambda sets the current benchmark state and invokes the function with the captured arguments.
Usage example:
void saxpy(int n, float a, const float* x, float* y);
add_nvbench(
"SAXPY", saxpy, 1<<20, 2.0f, x_data, y_data);
nvbench::benchmark_base & add_nvbench(const char *name, Func f, Args &&...args)
Register a benchmark function with NVBench.
Definition nvbench.hpp:177
This is equivalent to writing a manual NVBench function:
static void BM_SAXPY(nvbench::state &
state) {
state.exec([&](nvbench::launch& launch) {
saxpy<<<numBlocks, blockSize>>>(a, d_x, d_y, n);
});
}
NVBENCH_BENCH(BM_SAXPY);
State class to manage the benchmark state.
Definition nvbench.hpp:81