Criterion registration macro

This commit is contained in:
Georgy Evtushenko
2024-01-08 14:20:17 -08:00
parent fade52fa2e
commit 2dd4c18e2f
2 changed files with 10 additions and 2 deletions

View File

@@ -65,8 +65,7 @@ public:
};
// Register the criterion with NVBench:
static nvbench::stopping_criterion& criterion_ref = //
nvbench::criterion_manager::get().add(std::make_unique<fixed_criterion>());
NVBENCH_REGISTER_CRITERION(fixed_criterion);
void throughput_bench(nvbench::state &state)
{

View File

@@ -51,4 +51,13 @@ public:
static nvbench::stopping_criterion::params_description get_params_description();
};
/**
* Given a stopping criterion type `TYPE`, registers it in the criterion manager
*
* See the `custom_criterion.cu` example for usage.
*/
#define NVBENCH_REGISTER_CRITERION(TYPE) \
static nvbench::stopping_criterion& NVBENCH_UNIQUE_IDENTIFIER(TYPE) = \
nvbench::criterion_manager::get().add(std::make_unique<TYPE>()) \
} // namespace nvbench