diff --git a/cpp/benchmarks/CMakeLists.txt b/cpp/benchmarks/CMakeLists.txt index 0704180bad0..a815f6609e3 100644 --- a/cpp/benchmarks/CMakeLists.txt +++ b/cpp/benchmarks/CMakeLists.txt @@ -254,7 +254,7 @@ ConfigureBench( string/convert_durations.cpp string/convert_fixed_point.cpp string/convert_numerics.cpp - string/copy.cpp + string/copy.cu string/extract.cpp string/factory.cu string/filter.cpp diff --git a/cpp/benchmarks/string/copy.cpp b/cpp/benchmarks/string/copy.cu similarity index 83% rename from cpp/benchmarks/string/copy.cpp rename to cpp/benchmarks/string/copy.cu index d40b0e069bc..2f064e71c44 100644 --- a/cpp/benchmarks/string/copy.cpp +++ b/cpp/benchmarks/string/copy.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, NVIDIA CORPORATION. + * Copyright (c) 2021-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. @@ -14,7 +14,8 @@ * limitations under the License. */ -#include +#include "string_bench_args.hpp" + #include #include #include @@ -23,10 +24,7 @@ #include #include -#include -#include - -#include "string_bench_args.hpp" +#include class StringCopy : public cudf::benchmark { }; @@ -47,11 +45,14 @@ static void BM_copy(benchmark::State& state, copy_type ct) create_random_table({cudf::type_id::STRING}, 1, row_count{n_rows}, table_profile); // scatter indices - std::vector host_map_data(n_rows); - std::iota(host_map_data.begin(), host_map_data.end(), 0); - std::random_shuffle(host_map_data.begin(), host_map_data.end()); - cudf::test::fixed_width_column_wrapper index_map(host_map_data.begin(), - host_map_data.end()); + auto index_map_col = make_numeric_column( + cudf::data_type{cudf::type_id::INT32}, n_rows, cudf::mask_state::UNALLOCATED); + auto index_map = index_map_col->mutable_view(); + thrust::shuffle_copy(thrust::device, + thrust::counting_iterator(0), + thrust::counting_iterator(n_rows), + index_map.begin(), + thrust::default_random_engine()); for (auto _ : state) { cuda_event_timer raii(state, true, rmm::cuda_stream_default);