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

Add bytes_per_second to transpose benchmark #14170

Merged
Merged
Changes from 3 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
6 changes: 4 additions & 2 deletions cpp/benchmarks/transpose/transpose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@
#include <cudf/column/column_factories.hpp>
#include <cudf/table/table.hpp>
#include <cudf/transpose.hpp>
#include <cudf/types.hpp>

#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/transform_iterator.h>

static void BM_transpose(benchmark::State& state)
{
auto count = state.range(0);
constexpr auto column_type = cudf::data_type{cudf::type_id::INT32};
auto int_column_generator =
thrust::make_transform_iterator(thrust::counting_iterator(0), [count](int i) {
return cudf::make_numeric_column(
cudf::data_type{cudf::type_id::INT32}, count, cudf::mask_state::ALL_VALID);
column_type, count, cudf::mask_state::ALL_VALID);
});

auto input_table = cudf::table(std::vector(int_column_generator, int_column_generator + count));
Expand All @@ -42,7 +44,7 @@ static void BM_transpose(benchmark::State& state)
}

// Collect memory statistics.
auto const bytes_read = input.num_columns() * input.num_rows() * (sizeof(int32_t));
auto const bytes_read = input.num_columns() * input.num_rows() * cudf::size_of(column_type);
Copy link
Member

Choose a reason for hiding this comment

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

💡 suggestion: ‏ This is one way to do it. But I think the way I suggested is a bit better because it all happens at compile time, whereas cudf::size_of() invokes the type dispatcher at run time. Not that it will affect benchmarks, but it just seems cleaner to use sizeof(cudf::id_to_type<column_type>).

auto const bytes_written = bytes_read;
// Account for nullability in input and output.
auto const null_bytes =
Expand Down