nvbench icon indicating copy to clipboard operation
nvbench copied to clipboard

Allow kernel_generator to be stateful

Open oleksandr-pavlyk opened this issue 8 months ago • 0 comments

In python kernel generator is a user-defined callable. We need to capture Python object of that callable in kernel generator provided for each benchmark.

To this end, nvbench::benchmark has been modified to have member of kernel_generator type (must be copy-constructable). Constructor acquires an optional parameter of type kernel_generator with default value of default-contstructed instance.

nvbench::runner was modified to store kernel_generator instance as well. Its run method creates a fresh copy of stored instance for each invocation, just as it was happening before.

nvbench tests/examples pass with this change.

oleksandr-pavlyk avatar Jun 18 '25 19:06 oleksandr-pavlyk