From 4e5ebcf9b0d478c4574cdb51b6b6cea6a9dae082 Mon Sep 17 00:00:00 2001 From: Yunsong Wang Date: Wed, 18 May 2022 11:14:05 -0400 Subject: [PATCH] Add back missing tests + fix a sync issue --- benchmarks/hash_table/static_map_bench.cu | 64 ++++++++++++++++++++--- 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/benchmarks/hash_table/static_map_bench.cu b/benchmarks/hash_table/static_map_bench.cu index 1e8f7789b..a6c30c40c 100644 --- a/benchmarks/hash_table/static_map_bench.cu +++ b/benchmarks/hash_table/static_map_bench.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-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,13 +14,16 @@ * limitations under the License. */ -#include "cuco/static_map.cuh" +#include + +#include +#include + #include + #include #include #include -#include -#include enum class dist_type { UNIQUE, UNIFORM, GAUSSIAN }; @@ -145,6 +148,9 @@ static void BM_static_map_search_all(::benchmark::State& state) for (auto _ : state) { map.find(d_keys.begin(), d_keys.end(), d_results.begin()); + // TODO: get rid of sync and rewrite the benchmark with `nvbench` + // once https://github.com/NVIDIA/nvbench/pull/80 is merged + cudaDeviceSynchronize(); } state.SetBytesProcessed((sizeof(Key) + sizeof(Value)) * int64_t(state.iterations()) * @@ -202,11 +208,55 @@ BENCHMARK_TEMPLATE(BM_static_map_insert, int32_t, int32_t, dist_type::UNIQUE) ->Apply(generate_size_and_occupancy) ->UseManualTime(); -BENCHMARK_TEMPLATE(BM_static_map_erase_all, int32_t, int32_t, dist_type::UNIQUE) +BENCHMARK_TEMPLATE(BM_static_map_search_all, int32_t, int32_t, dist_type::UNIQUE) ->Unit(benchmark::kMillisecond) ->Apply(generate_size_and_occupancy); -BENCHMARK_TEMPLATE(BM_static_map_insert, int32_t, int32_t, dist_type::UNIQUE) +BENCHMARK_TEMPLATE(BM_static_map_insert, int32_t, int32_t, dist_type::UNIFORM) + ->Unit(benchmark::kMillisecond) + ->Apply(generate_size_and_occupancy) + ->UseManualTime(); + +BENCHMARK_TEMPLATE(BM_static_map_search_all, int32_t, int32_t, dist_type::UNIFORM) + ->Unit(benchmark::kMillisecond) + ->Apply(generate_size_and_occupancy); + +BENCHMARK_TEMPLATE(BM_static_map_insert, int32_t, int32_t, dist_type::GAUSSIAN) + ->Unit(benchmark::kMillisecond) + ->Apply(generate_size_and_occupancy) + ->UseManualTime(); + +BENCHMARK_TEMPLATE(BM_static_map_search_all, int32_t, int32_t, dist_type::GAUSSIAN) + ->Unit(benchmark::kMillisecond) + ->Apply(generate_size_and_occupancy); + +BENCHMARK_TEMPLATE(BM_static_map_insert, int64_t, int64_t, dist_type::UNIQUE) ->Unit(benchmark::kMillisecond) ->Apply(generate_size_and_occupancy) - ->UseManualTime(); \ No newline at end of file + ->UseManualTime(); + +BENCHMARK_TEMPLATE(BM_static_map_search_all, int64_t, int64_t, dist_type::UNIQUE) + ->Unit(benchmark::kMillisecond) + ->Apply(generate_size_and_occupancy); + +BENCHMARK_TEMPLATE(BM_static_map_insert, int64_t, int64_t, dist_type::UNIFORM) + ->Unit(benchmark::kMillisecond) + ->Apply(generate_size_and_occupancy) + ->UseManualTime(); + +BENCHMARK_TEMPLATE(BM_static_map_search_all, int64_t, int64_t, dist_type::UNIFORM) + ->Unit(benchmark::kMillisecond) + ->Apply(generate_size_and_occupancy); + +BENCHMARK_TEMPLATE(BM_static_map_insert, int64_t, int64_t, dist_type::GAUSSIAN) + ->Unit(benchmark::kMillisecond) + ->Apply(generate_size_and_occupancy) + ->UseManualTime(); + +BENCHMARK_TEMPLATE(BM_static_map_search_all, int64_t, int64_t, dist_type::GAUSSIAN) + ->Unit(benchmark::kMillisecond) + ->Apply(generate_size_and_occupancy); + +BENCHMARK_TEMPLATE(BM_static_map_erase_all, int32_t, int32_t, dist_type::UNIQUE) + ->Unit(benchmark::kMillisecond) + ->Apply(generate_size_and_occupancy);