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

move input generation for type dispatcher benchmark to device #10280

Merged
Merged
Changes from all 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
24 changes: 11 additions & 13 deletions cpp/benchmarks/type_dispatcher/type_dispatcher.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-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 All @@ -14,15 +14,16 @@
* limitations under the License.
*/

#include "../fixture/benchmark_fixture.hpp"
#include "../synchronization/synchronization.hpp"
#include <benchmarks/fixture/benchmark_fixture.hpp>
#include <benchmarks/synchronization/synchronization.hpp>

#include <cudf_test/column_wrapper.hpp>

#include <cudf/column/column_device_view.cuh>
#include <cudf/column/column_view.hpp>
#include <cudf/detail/iterator.cuh>
#include <cudf/detail/utilities/cuda.cuh>
#include <cudf/filling.hpp>
#include <cudf/scalar/scalar_factories.hpp>
#include <cudf/table/table_device_view.cuh>
#include <cudf/table/table_view.hpp>

Expand Down Expand Up @@ -170,21 +171,18 @@ void launch_kernel(cudf::mutable_table_view input, T** d_ptr, int work_per_threa
template <class TypeParam, FunctorType functor_type, DispatchingType dispatching_type>
void type_dispatcher_benchmark(::benchmark::State& state)
{
const auto source_size = static_cast<cudf::size_type>(state.range(1));

const auto n_cols = static_cast<cudf::size_type>(state.range(0));

const auto n_cols = static_cast<cudf::size_type>(state.range(0));
const auto source_size = static_cast<cudf::size_type>(state.range(1));
const auto work_per_thread = static_cast<cudf::size_type>(state.range(2));

auto data = cudf::detail::make_counting_transform_iterator(0, [](auto i) { return i; });
auto init = cudf::make_fixed_width_scalar<TypeParam>(static_cast<TypeParam>(0));

std::vector<cudf::test::fixed_width_column_wrapper<TypeParam>> source_column_wrappers;
std::vector<std::unique_ptr<cudf::column>> source_column_wrappers;
std::vector<cudf::mutable_column_view> source_columns;

for (int i = 0; i < n_cols; ++i) {
source_column_wrappers.push_back(
cudf::test::fixed_width_column_wrapper<TypeParam>(data, data + source_size));
source_columns.push_back(source_column_wrappers[i]);
source_column_wrappers.push_back(cudf::sequence(source_size, *init));
source_columns.push_back(*source_column_wrappers[i]);
}
cudf::mutable_table_view source_table{source_columns};

Expand Down