-
Notifications
You must be signed in to change notification settings - Fork 884
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
Add groupby max
aggregation benchmark
#11464
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
bdc11e9
Remove redundant functions
ttnghia c650e8c
Fix NaN issue for min and max
ttnghia 934c4c6
Modify comments
ttnghia c9fe451
Modify comments again
ttnghia 82090b0
Fix copyright
ttnghia 144b84b
Add tests
ttnghia 218f3fb
Add benchmark
ttnghia ee270a0
Fix cmake style
ttnghia 4ef6f42
Reverse `aggregation.cuh`
ttnghia fefbbdc
Fix `device_atomics.cuh`
ttnghia 7101d5e
Use default stream in bench
ttnghia 7b25a2e
Improve data generation
ttnghia e67e570
Reverse `device_atoimics.cuh`
ttnghia f047b5a
Merge branch 'branch-22.08' into add_benchmark
ttnghia 1622f33
Reverse `device_operators.cuh`
ttnghia 73983bb
Reverse `temporary.hpp`
ttnghia 78a0761
Add integer benchmark
ttnghia 76dc0fe
Merge branch 'branch-22.10' into add_benchmark
ttnghia 625f256
Unify benchmarks
ttnghia 4d63020
Add null frequency
ttnghia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright (c) 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <benchmarks/common/generate_input.hpp> | ||
#include <benchmarks/fixture/rmm_pool_raii.hpp> | ||
|
||
#include <cudf/groupby.hpp> | ||
|
||
#include <nvbench/nvbench.cuh> | ||
|
||
template <typename Type> | ||
void bench_groupby_max(nvbench::state& state, nvbench::type_list<Type>) | ||
{ | ||
cudf::rmm_pool_raii pool_raii; | ||
const auto size = static_cast<cudf::size_type>(state.get_int64("num_rows")); | ||
|
||
auto const keys_table = [&] { | ||
data_profile profile; | ||
profile.set_null_frequency(std::nullopt); | ||
profile.set_cardinality(0); | ||
profile.set_distribution_params<int32_t>( | ||
cudf::type_to_id<int32_t>(), distribution_id::UNIFORM, 0, 100); | ||
return create_random_table({cudf::type_to_id<int32_t>()}, row_count{size}, profile); | ||
}(); | ||
|
||
auto const vals_table = [&] { | ||
data_profile profile; | ||
if (const auto null_freq = state.get_float64("null_frequency"); null_freq > 0) { | ||
profile.set_null_frequency({null_freq}); | ||
} else { | ||
profile.set_null_frequency(std::nullopt); | ||
} | ||
profile.set_cardinality(0); | ||
profile.set_distribution_params<Type>(cudf::type_to_id<Type>(), | ||
distribution_id::UNIFORM, | ||
static_cast<Type>(0), | ||
static_cast<Type>(1000)); | ||
return create_random_table({cudf::type_to_id<Type>()}, row_count{size}, profile); | ||
}(); | ||
|
||
auto const& keys = keys_table->get_column(0); | ||
auto const& vals = vals_table->get_column(0); | ||
|
||
auto gb_obj = cudf::groupby::groupby(cudf::table_view({keys, keys, keys})); | ||
|
||
std::vector<cudf::groupby::aggregation_request> requests; | ||
requests.emplace_back(cudf::groupby::aggregation_request()); | ||
requests[0].values = vals; | ||
requests[0].aggregations.push_back(cudf::make_max_aggregation<cudf::groupby_aggregation>()); | ||
|
||
state.set_cuda_stream(nvbench::make_cuda_stream_view(cudf::default_stream_value.value())); | ||
state.exec(nvbench::exec_tag::sync, | ||
[&](nvbench::launch& launch) { auto const result = gb_obj.aggregate(requests); }); | ||
} | ||
|
||
NVBENCH_BENCH_TYPES(bench_groupby_max, | ||
NVBENCH_TYPE_AXES(nvbench::type_list<int32_t, int64_t, float, double>)) | ||
.set_name("groupby_max") | ||
.add_int64_power_of_two_axis("num_rows", {12, 18, 24}) | ||
.add_float64_axis("null_frequency", {0, 0.1, 0.9}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be curious to know the performance impact when including nulls.
Could this be added as a state parameter?
Perhaps just a single value like 10% or less would be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added nulls for the values column.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that makes sense.