From 55f50341d41cad4e17266d74a6c0dd38cd547110 Mon Sep 17 00:00:00 2001 From: Karthikeyan Natarajan Date: Mon, 14 Feb 2022 20:08:52 +0530 Subject: [PATCH 1/3] use device functions for input generation in join bench --- cpp/benchmarks/join/join_common.hpp | 40 +++++++++++++++++++---------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/cpp/benchmarks/join/join_common.hpp b/cpp/benchmarks/join/join_common.hpp index e88253395d8..d4aee865750 100644 --- a/cpp/benchmarks/join/join_common.hpp +++ b/cpp/benchmarks/join/join_common.hpp @@ -20,9 +20,14 @@ #include #include +#include +#include #include +#include +#include #include +#include #include #include #include @@ -35,6 +40,18 @@ #include "generate_input_tables.cuh" +struct null75_generator { + thrust::minstd_rand engine; + thrust::uniform_int_distribution rand_gen; + null75_generator() : engine(), rand_gen() {} + __device__ bool operator()(size_t i) + { + engine.discard(i); + // roughly 75% nulls + return (rand_gen(engine) & 3) == 0; + } +}; + template rand_gen(0, build_table_size); - auto build_random_null_mask = [&rand_gen](int size) { + auto build_random_null_mask = [](int size) { // roughly 75% nulls - auto validity = thrust::make_transform_iterator( - thrust::make_counting_iterator(0), - [&rand_gen](auto i) { return (rand_gen.generate() & 3) == 0; }); - return cudf::test::detail::make_null_mask(validity, validity + size); + auto validity = + thrust::make_transform_iterator(thrust::make_counting_iterator(0), null75_generator{}); + return cudf::detail::valid_if(validity, validity + size, thrust::identity{}).first; }; std::unique_ptr build_key_column = [&]() { @@ -96,17 +111,14 @@ static void BM_join(state_type& state, Join JoinFunc) selectivity, multiplicity); - auto payload_data_it = thrust::make_counting_iterator(0); - cudf::test::fixed_width_column_wrapper build_payload_column( - payload_data_it, payload_data_it + build_table_size); - - cudf::test::fixed_width_column_wrapper probe_payload_column( - payload_data_it, payload_data_it + probe_table_size); + auto init = cudf::make_fixed_width_scalar(static_cast(0)); + auto build_payload_column = cudf::sequence(build_table_size, *init); + auto probe_payload_column = cudf::sequence(probe_table_size, *init); CHECK_CUDA(0); - cudf::table_view build_table({build_key_column->view(), build_payload_column}); - cudf::table_view probe_table({probe_key_column->view(), probe_payload_column}); + cudf::table_view build_table({build_key_column->view(), *build_payload_column}); + cudf::table_view probe_table({probe_key_column->view(), *probe_payload_column}); // Setup join parameters and result table [[maybe_unused]] std::vector columns_to_join = {0}; From 0fdd3175e7f6294e8bae2d4f49071075e20c0a64 Mon Sep 17 00:00:00 2001 From: Karthikeyan <6488848+karthikeyann@users.noreply.github.com> Date: Mon, 14 Feb 2022 20:35:46 +0530 Subject: [PATCH 2/3] update copyright year --- cpp/benchmarks/join/join_common.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/benchmarks/join/join_common.hpp b/cpp/benchmarks/join/join_common.hpp index d4aee865750..6ff37f17dbe 100644 --- a/cpp/benchmarks/join/join_common.hpp +++ b/cpp/benchmarks/join/join_common.hpp @@ -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. From 9f4e4e19c4babb7f920160d4accaf05441a5ec2d Mon Sep 17 00:00:00 2001 From: Karthikeyan <6488848+karthikeyann@users.noreply.github.com> Date: Wed, 16 Feb 2022 00:17:30 +0530 Subject: [PATCH 3/3] reorder includes --- cpp/benchmarks/join/join_common.hpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cpp/benchmarks/join/join_common.hpp b/cpp/benchmarks/join/join_common.hpp index 6ff37f17dbe..f2b9cb1bdb9 100644 --- a/cpp/benchmarks/join/join_common.hpp +++ b/cpp/benchmarks/join/join_common.hpp @@ -16,12 +16,13 @@ #pragma once -#include -#include +#include "generate_input_tables.cuh" -#include -#include -#include +#include +#include + +#include +#include #include #include @@ -30,15 +31,14 @@ #include #include #include -#include -#include -#include -#include +#include -#include +#include +#include +#include -#include "generate_input_tables.cuh" +#include struct null75_generator { thrust::minstd_rand engine;