Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit benchmark iterations using environment variable #10060

Merged
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions cpp/benchmarks/fixture/benchmark_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ namespace {
// memory resource factory helpers
inline auto make_cuda() { return std::make_shared<rmm::mr::cuda_memory_resource>(); }

inline auto make_pool()
inline auto benchmark_pool_instance()
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
{
return rmm::mr::make_owning_wrapper<rmm::mr::pool_memory_resource>(make_cuda());
static rmm::mr::cuda_memory_resource cuda_mr;
static rmm::mr::pool_memory_resource pool_mr{&cuda_mr};
return std::shared_ptr<rmm::mr::device_memory_resource>(&pool_mr);
}
} // namespace

Expand Down Expand Up @@ -68,9 +70,15 @@ inline auto make_pool()
*/
class benchmark : public ::benchmark::Fixture {
public:
benchmark() : ::benchmark::Fixture()
{
const char* env_iterations = std::getenv("CUDF_BENCHMARK_ITERATIONS");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not keen on limiting the number of benchmark iterations for all benchmarks arbitrarily like this. GBench/NVbench run as many iterations as is needed to determine statistical significance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not for actual benchmarking results. This is just to enable benchmark binaries run as part of CI or nightly builds to ensure there is nothing broken in benchmarks.

if (env_iterations != nullptr) { this->Iterations(std::max(0L, atol(env_iterations))); }
}

void SetUp(const ::benchmark::State& state) override
{
mr = make_pool();
mr = benchmark_pool_instance();
karthikeyann marked this conversation as resolved.
Show resolved Hide resolved
rmm::mr::set_current_device_resource(mr.get()); // set default resource to pool
}

Expand Down