Skip to content

Commit a5c3861

Browse files
authored
Update map insert bench to avoid fully occupied map (#690)
This PR modifies the single map insert benchmark to construct the map on the fly in each loop iteration, preventing insertions into a fully occupied map.
1 parent 8acd383 commit a5c3861

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

benchmarks/static_map/insert_bench.cu

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021-2024, NVIDIA CORPORATION.
2+
* Copyright (c) 2021-2025, 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.
@@ -52,12 +52,14 @@ std::enable_if_t<(sizeof(Key) == sizeof(Value)), void> static_map_insert(
5252
return pair_type(key, {});
5353
});
5454

55-
state.add_element_count(num_keys);
56-
5755
auto map = cuco::static_map{size, cuco::empty_key<Key>{-1}, cuco::empty_value<Value>{-1}};
5856

59-
state.exec([&](nvbench::launch& launch) {
57+
state.add_element_count(num_keys);
58+
state.exec(nvbench::exec_tag::timer, [&](nvbench::launch& launch, auto& timer) {
59+
timer.start();
6060
map.insert_async(pairs.begin(), pairs.end(), {launch.get_stream()});
61+
timer.stop();
62+
map.clear_async({launch.get_stream()});
6163
});
6264
}
6365

0 commit comments

Comments
 (0)