Skip to content

Commit

Permalink
Fix benchmarks to work with new aggregation types (#10428)
Browse files Browse the repository at this point in the history
Fixes benchmarks compile errors introduced by #10357 

Example:
```
/cudf/cpp/benchmarks/reduction/reduce.cpp: In function ‘void BM_reduction(benchmark::State&, const std::unique_ptr<cudf::aggregation>&)’:
/cudf/cpp/benchmarks/reduction/reduce.cpp:52:46: error: invalid initialization of reference of type ‘const std::unique_ptr<cudf::reduce_aggregation>&’ from expression of type ‘const std::unique_ptr<cudf::aggregation>’
   52 |     auto result = cudf::reduce(input_column, agg, output_dtype);
```

Aggregation types for reduce and scan were modified to include template types.

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)
  - https://github.com/nvdbaranec

URL: #10428
  • Loading branch information
davidwendt authored Mar 14, 2022
1 parent cf936b6 commit 61772d8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
7 changes: 4 additions & 3 deletions cpp/benchmarks/reduction/anyall.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,7 +28,8 @@ class Reduction : public cudf::benchmark {
};

template <typename type>
void BM_reduction_anyall(benchmark::State& state, std::unique_ptr<cudf::aggregation> const& agg)
void BM_reduction_anyall(benchmark::State& state,
std::unique_ptr<cudf::reduce_aggregation> const& agg)
{
const cudf::size_type column_size{static_cast<cudf::size_type>(state.range(0))};

Expand All @@ -48,7 +49,7 @@ void BM_reduction_anyall(benchmark::State& state, std::unique_ptr<cudf::aggregat
}

#define concat(a, b, c) a##b##c
#define get_agg(op) concat(cudf::make_, op, _aggregation())
#define get_agg(op) concat(cudf::make_, op, _aggregation<cudf::reduce_aggregation>())

// TYPE, OP
#define RBM_BENCHMARK_DEFINE(name, type, aggregation) \
Expand Down
7 changes: 4 additions & 3 deletions cpp/benchmarks/reduction/dictionary.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,7 +28,8 @@ class ReductionDictionary : public cudf::benchmark {
};

template <typename T>
void BM_reduction_dictionary(benchmark::State& state, std::unique_ptr<cudf::aggregation> const& agg)
void BM_reduction_dictionary(benchmark::State& state,
std::unique_ptr<cudf::reduce_aggregation> const& agg)
{
const cudf::size_type column_size{static_cast<cudf::size_type>(state.range(0))};

Expand All @@ -53,7 +54,7 @@ void BM_reduction_dictionary(benchmark::State& state, std::unique_ptr<cudf::aggr
}

#define concat(a, b, c) a##b##c
#define get_agg(op) concat(cudf::make_, op, _aggregation())
#define get_agg(op) concat(cudf::make_, op, _aggregation<cudf::reduce_aggregation>())

// TYPE, OP
#define RBM_BENCHMARK_DEFINE(name, type, aggregation) \
Expand Down
6 changes: 3 additions & 3 deletions cpp/benchmarks/reduction/reduce.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, NVIDIA CORPORATION.
* Copyright (c) 2020-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,7 +30,7 @@ class Reduction : public cudf::benchmark {
};

template <typename type>
void BM_reduction(benchmark::State& state, std::unique_ptr<cudf::aggregation> const& agg)
void BM_reduction(benchmark::State& state, std::unique_ptr<cudf::reduce_aggregation> const& agg)
{
const cudf::size_type column_size{(cudf::size_type)state.range(0)};

Expand All @@ -54,7 +54,7 @@ void BM_reduction(benchmark::State& state, std::unique_ptr<cudf::aggregation> co
}

#define concat(a, b, c) a##b##c
#define get_agg(op) concat(cudf::make_, op, _aggregation())
#define get_agg(op) concat(cudf::make_, op, _aggregation<cudf::reduce_aggregation>())

// TYPE, OP
#define RBM_BENCHMARK_DEFINE(name, type, aggregation) \
Expand Down
3 changes: 2 additions & 1 deletion cpp/benchmarks/reduction/scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ static void BM_reduction_scan(benchmark::State& state, bool include_nulls)

for (auto _ : state) {
cuda_event_timer timer(state, true);
auto result = cudf::scan(input, cudf::make_min_aggregation(), cudf::scan_type::INCLUSIVE);
auto result = cudf::scan(
input, cudf::make_min_aggregation<cudf::scan_aggregation>(), cudf::scan_type::INCLUSIVE);
}
}

Expand Down

0 comments on commit 61772d8

Please sign in to comment.