forked from rapidsai/cudf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
bytes_per_second
to groupby max benchmark.
To calculate the number of bytes written and read by the benchmark a few helper function are introduced which calculate the payload size of a column, a table, and the results of a groupby. This patch relates to rapidsai#13735.
- Loading branch information
Martin Marenz
committed
Aug 28, 2023
1 parent
3c8ce98
commit 8a474b6
Showing
4 changed files
with
136 additions
and
11 deletions.
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,51 @@ | ||
/* | ||
* Copyright (c) 2020-2023, 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 "memory_statistics.hpp" | ||
|
||
#include <cudf/column/column.hpp> | ||
#include <cudf/null_mask.hpp> | ||
|
||
#include <numeric> | ||
|
||
uint64_t required_bytes(const cudf::column_view& column) | ||
{ | ||
uint64_t read_bytes = column.size() * cudf::size_of(column.type()); | ||
if (column.nullable()) { read_bytes += cudf::bitmask_allocation_size_bytes(column.size()); } | ||
|
||
return read_bytes; | ||
} | ||
|
||
uint64_t required_bytes(const cudf::table_view& table) | ||
{ | ||
return std::accumulate(table.begin(), table.end(), 0, [](uint64_t acc, const auto& col) { | ||
return acc + required_bytes(col); | ||
}); | ||
} | ||
|
||
uint64_t required_bytes( | ||
const cudf::host_span<cudf::groupby::aggregation_result>& aggregation_results) | ||
{ | ||
uint64_t read_bytes = 0; | ||
|
||
for (auto const& aggregation : aggregation_results) { // vector of aggregation results | ||
for (auto const& col : aggregation.results) { // vector of columns per result | ||
read_bytes += required_bytes(col->view()); | ||
} | ||
} | ||
|
||
return read_bytes; | ||
} |
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,57 @@ | ||
/* | ||
* Copyright (c) 2020-2023, 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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <cudf/column/column_view.hpp> | ||
#include <cudf/groupby.hpp> | ||
#include <cudf/table/table_view.hpp> | ||
#include <cudf/utilities/span.hpp> | ||
|
||
/** | ||
* @brief Calculate the number of bytes needed to completely read/write the provided column. | ||
* | ||
* The functions computes only the size of the payload of the column in bytes, it excludes | ||
* any metadata of the column structure itself. | ||
* | ||
* @param column View of the input column | ||
* @returns Number of bytes needed to read or write the column. | ||
*/ | ||
uint64_t required_bytes(const cudf::column_view& column); | ||
|
||
/** | ||
* @brief Calculate the number of bytes needed to completely read/write the provided table. | ||
* | ||
* The functions computes only the size of the payload of the table in bytes, it excludes | ||
* any metadata of the column structure itself. | ||
* | ||
* @param table View of the input table. | ||
* @returns Number of bytes needed to read or write the table. | ||
*/ | ||
uint64_t required_bytes(const cudf::table_view& table); | ||
|
||
/** | ||
* @brief Calculate the number of bytes needed to completely read/write the provided range of | ||
* aggregation results. | ||
* | ||
* The functions computes only the size of the payload of the aggregation results in bytes, it | ||
* excludes any metadata of the column structure itself. | ||
* | ||
* @param aggregation_results Sequence of aggregation results from groupby execution. | ||
* @returns Number of bytes needed to read or write the aggregation results. | ||
*/ | ||
uint64_t required_bytes( | ||
const cudf::host_span<cudf::groupby::aggregation_result>& aggregation_results); |
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