Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwendt committed Nov 7, 2024
2 parents 8d82f65 + 67c71e2 commit 03e7858
Show file tree
Hide file tree
Showing 27 changed files with 598 additions and 203 deletions.
6 changes: 3 additions & 3 deletions cpp/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ ConfigureNVBench(
# ##################################################################################################
# * strings benchmark -------------------------------------------------------------------
ConfigureBench(
STRINGS_BENCH string/copy.cu string/factory.cu string/filter.cpp string/repeat_strings.cpp
string/replace.cpp string/translate.cpp string/url_decode.cu
STRINGS_BENCH string/factory.cu string/filter.cpp string/repeat_strings.cpp string/replace.cpp
string/translate.cpp string/url_decode.cu
)

ConfigureNVBench(
Expand All @@ -369,12 +369,12 @@ ConfigureNVBench(
string/convert_durations.cpp
string/convert_fixed_point.cpp
string/convert_numerics.cpp
string/copy.cpp
string/copy_if_else.cpp
string/copy_range.cpp
string/count.cpp
string/extract.cpp
string/find.cpp
string/gather.cpp
string/join_strings.cpp
string/lengths.cpp
string/like.cpp
Expand Down
3 changes: 2 additions & 1 deletion cpp/benchmarks/ndsh/q09.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ void run_ndsh_q9(nvbench::state& state,

// Calculate the `nation`, `o_year`, and `amount` columns
auto n_name = std::make_unique<cudf::column>(joined_table->column("n_name"));
auto o_year = cudf::datetime::extract_year(joined_table->column("o_orderdate"));
auto o_year = cudf::datetime::extract_datetime_component(
joined_table->column("o_orderdate"), cudf::datetime::datetime_component::YEAR);
auto amount = calculate_amount(joined_table->column("l_discount"),
joined_table->column("l_extendedprice"),
joined_table->column("ps_supplycost"),
Expand Down
75 changes: 75 additions & 0 deletions cpp/benchmarks/string/copy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright (c) 2024, 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 <cudf/copying.hpp>
#include <cudf/strings/strings_column_view.hpp>
#include <cudf/utilities/default_stream.hpp>

#include <nvbench/nvbench.cuh>

static void bench_copy(nvbench::state& state)
{
auto const num_rows = static_cast<cudf::size_type>(state.get_int64("num_rows"));
auto const min_width = static_cast<cudf::size_type>(state.get_int64("min_width"));
auto const max_width = static_cast<cudf::size_type>(state.get_int64("max_width"));
auto const api = state.get_string("api");

data_profile const table_profile = data_profile_builder().distribution(
cudf::type_id::STRING, distribution_id::NORMAL, min_width, max_width);
auto const source =
create_random_table({cudf::type_id::STRING}, row_count{num_rows}, table_profile);

data_profile const map_profile = data_profile_builder().no_validity().distribution(
cudf::type_to_id<cudf::size_type>(), distribution_id::UNIFORM, 0, num_rows);
auto const map_table =
create_random_table({cudf::type_to_id<cudf::size_type>()}, row_count{num_rows}, map_profile);
auto const map_view = map_table->view().column(0);

auto stream = cudf::get_default_stream();
state.set_cuda_stream(nvbench::make_cuda_stream_view(stream.value()));

if (api == "gather") {
auto result =
cudf::gather(source->view(), map_view, cudf::out_of_bounds_policy::NULLIFY, stream);
auto chars_size = cudf::strings_column_view(result->view().column(0)).chars_size(stream);
state.add_global_memory_reads<nvbench::int8_t>(chars_size +
(map_view.size() * sizeof(cudf::size_type)));
state.add_global_memory_writes<nvbench::int8_t>(chars_size);
state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) {
cudf::gather(source->view(), map_view, cudf::out_of_bounds_policy::NULLIFY, stream);
});
} else if (api == "scatter") {
auto const target =
create_random_table({cudf::type_id::STRING}, row_count{num_rows}, table_profile);
auto result = cudf::scatter(source->view(), map_view, target->view(), stream);
auto chars_size = cudf::strings_column_view(result->view().column(0)).chars_size(stream);
state.add_global_memory_reads<nvbench::int8_t>(chars_size +
(map_view.size() * sizeof(cudf::size_type)));
state.add_global_memory_writes<nvbench::int8_t>(chars_size);
state.exec(nvbench::exec_tag::sync, [&](nvbench::launch& launch) {
cudf::scatter(source->view(), map_view, target->view(), stream);
});
}
}

NVBENCH_BENCH(bench_copy)
.set_name("copy")
.add_int64_axis("min_width", {0})
.add_int64_axis("max_width", {32, 64, 128, 256})
.add_int64_axis("num_rows", {32768, 262144, 2097152})
.add_string_axis("api", {"gather", "scatter"});
95 changes: 0 additions & 95 deletions cpp/benchmarks/string/copy.cu

This file was deleted.

60 changes: 0 additions & 60 deletions cpp/benchmarks/string/gather.cpp

This file was deleted.

6 changes: 5 additions & 1 deletion cpp/include/cudf/ast/detail/expression_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include <cudf/ast/expressions.hpp>
#include <cudf/table/table_view.hpp>
#include <cudf/types.hpp>
#include <cudf/utilities/memory_resource.hpp>
#include <cudf/utilities/span.hpp>

#include <thrust/scan.h>

#include <functional>
#include <numeric>
Expand Down Expand Up @@ -296,7 +300,7 @@ class expression_parser {
* @return The indices of the operands stored in the data references.
*/
std::vector<cudf::size_type> visit_operands(
std::vector<std::reference_wrapper<expression const>> operands);
cudf::host_span<std::reference_wrapper<cudf::ast::expression const> const> operands);

/**
* @brief Add a data reference to the internal list.
Expand Down
Loading

0 comments on commit 03e7858

Please sign in to comment.