11/*
2- * Copyright (c) 2023-2024 , NVIDIA CORPORATION.
2+ * Copyright (c) 2023-2026 , NVIDIA CORPORATION.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
2222#include < hash/hash.hpp>
2323#include < nvbench/nvbench.cuh>
2424
25- static void bloom_filter_put (nvbench::state& state)
25+ namespace {
26+
27+ void bloom_filter_put_impl (nvbench::state& state, int version)
2628{
2729 constexpr int num_rows = 150'000'000 ;
2830 constexpr int num_hashes = 3 ;
2931
30- // create the bloom filter
3132 cudf::size_type const bloom_filter_bytes = state.get_int64 (" bloom_filter_bytes" );
3233 cudf::size_type const bloom_filter_longs = bloom_filter_bytes / sizeof (int64_t );
33- auto bloom_filter = spark_rapids_jni::bloom_filter_create (num_hashes, bloom_filter_longs);
34+ auto bloom_filter =
35+ spark_rapids_jni::bloom_filter_create (version, num_hashes, bloom_filter_longs);
3436
35- // create a column of hashed values
3637 data_profile_builder builder;
3738 builder.no_validity ();
3839 auto const src = create_random_table ({{cudf::type_id::INT64}}, row_count{num_rows}, builder);
@@ -41,7 +42,7 @@ static void bloom_filter_put(nvbench::state& state)
4142 auto const stream = cudf::get_default_stream ();
4243 state.set_cuda_stream (nvbench::make_cuda_stream_view (stream.value ()));
4344 state.exec (nvbench::exec_tag::timer | nvbench::exec_tag::sync,
44- [&](nvbench::launch& launch , auto & timer) {
45+ [&](nvbench::launch&, auto & timer) {
4546 timer.start ();
4647 spark_rapids_jni::bloom_filter_put (*bloom_filter, *input);
4748 stream.synchronize ();
@@ -57,7 +58,24 @@ static void bloom_filter_put(nvbench::state& state)
5758 state.add_element_count (static_cast <double >(bytes_written) / time, " Write bytes/sec" );
5859}
5960
60- NVBENCH_BENCH (bloom_filter_put)
61- .set_name(" Bloom Filter Put" )
61+ void bloom_filter_put_v1 (nvbench::state& state)
62+ {
63+ bloom_filter_put_impl (state, spark_rapids_jni::bloom_filter_version_1);
64+ }
65+
66+ void bloom_filter_put_v2 (nvbench::state& state)
67+ {
68+ bloom_filter_put_impl (state, spark_rapids_jni::bloom_filter_version_2);
69+ }
70+
71+ } // namespace
72+
73+ NVBENCH_BENCH (bloom_filter_put_v1)
74+ .set_name(" Bloom Filter Put V1" )
75+ .add_int64_axis(" bloom_filter_bytes" ,
76+ {512 * 1024 , 1024 * 1024 , 2 * 1024 * 1024 , 4 * 1024 * 1024 , 8 * 1024 * 1024 });
77+
78+ NVBENCH_BENCH (bloom_filter_put_v2)
79+ .set_name(" Bloom Filter Put V2" )
6280 .add_int64_axis(" bloom_filter_bytes" ,
6381 {512 * 1024 , 1024 * 1024 , 2 * 1024 * 1024 , 4 * 1024 * 1024 , 8 * 1024 * 1024 });
0 commit comments