• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2 include/cuco/dynamic_map.cuh | 62 ++++++++++++++++++++++++++++++++++--
3 include/cuco/traits.hpp      |  2 +-
4 2 files changed, 60 insertions(+), 4 deletions(-)
5
6diff --git a/include/cuco/dynamic_map.cuh b/include/cuco/dynamic_map.cuh
7index 866f948..af3ea03 100644
8--- a/include/cuco/dynamic_map.cuh
9+++ b/include/cuco/dynamic_map.cuh
10@@ -103,8 +103,8 @@ class dynamic_map {
11   using key_type        = Key;                               ///< Key type
12   using mapped_type     = Value;                             ///< Type of mapped values
13   using atomic_ctr_type = cuda::atomic<std::size_t, Scope>;  ///< Type of atomic counters
14-  using view_type = typename static_map<Key, Value, Scope>::device_view;  ///< Device view type
15-  using mutable_view_type = typename static_map<Key, Value, Scope>::device_mutable_view;
16+  using view_type = typename static_map<Key, Value, Scope, Allocator>::device_view;  ///< Device view type
17+  using mutable_view_type = typename static_map<Key, Value, Scope, Allocator>::device_mutable_view;
18   ///< Device mutable view type
19
20   dynamic_map(dynamic_map const&) = delete;
21@@ -248,6 +248,62 @@ class dynamic_map {
22    */
23   float get_load_factor() const noexcept { return static_cast<float>(size_) / capacity_; }
24
25+  /**
26+   * @brief Update the size of the hash map.
27+   *
28+   * @param size The number of the size to be updated.
29+   */
30+  void update_size(std::size_t size) {
31+    size_ = size;
32+  }
33+
34+  /**
35+   * @brief Update the size of the submap.
36+   *
37+   * @param submap_idx The index of submap whose size need to be updated.
38+   * @param size The number of the size of submap to be updated.
39+   */
40+  void update_submap_size(std::size_t submap_idx, std::size_t size) {
41+    submaps_[submap_idx]->size_ = size;
42+  }
43+
44+  /**
45+   * @brief Gets the all submaps of the hash map.
46+   *
47+   * @return The all submaps of the hash map.
48+   */
49+  const std::vector<std::unique_ptr<static_map<key_type, mapped_type, Scope, Allocator>>>& get_submaps() const noexcept {
50+    return submaps_;
51+  }
52+
53+  /**
54+   * @brief Gets the all mutable views for all submaps of the hash map.
55+   *
56+   * @return All mutable views for all submaps of the hash map.
57+   */
58+  thrust::device_vector<mutable_view_type>& get_submap_mutable_views() noexcept { return submap_mutable_views_; }
59+
60+  /**
61+   * @brief Gets the all mutable views for all submaps of the hash map.
62+   *
63+   * @return All mutable views for all submaps of the hash map.
64+   */
65+  thrust::device_vector<view_type>& get_submap_views() noexcept { return submap_views_; }
66+
67+  /**
68+   * @brief Gets the max load factor of the hash map.
69+   *
70+   * @return The max load factor of the hash map.
71+   */
72+  float get_max_load_factor() const noexcept { return max_load_factor_; }
73+
74+  /**
75+   * @brief Gets minimum insert size of the hash map.
76+   *
77+   * @return The minimum insert size of the hash map.
78+   */
79+  std::size_t get_min_insert_size() const noexcept { return min_insert_size_; }
80+
81  private:
82   key_type empty_key_sentinel_{};       ///< Key value that represents an empty slot
83   mapped_type empty_value_sentinel_{};  ///< Initial value of empty slot
84@@ -255,7 +311,7 @@ class dynamic_map {
85   std::size_t capacity_{};              ///< Maximum number of keys that can be inserted
86   float max_load_factor_{};             ///< Max load factor before capacity growth
87
88-  std::vector<std::unique_ptr<static_map<key_type, mapped_type, Scope>>>
89+  std::vector<std::unique_ptr<static_map<key_type, mapped_type, Scope, Allocator>>>
90     submaps_;                                      ///< vector of pointers to each submap
91   thrust::device_vector<view_type> submap_views_;  ///< vector of device views for each submap
92   thrust::device_vector<mutable_view_type>
93diff --git a/include/cuco/traits.hpp b/include/cuco/traits.hpp
94index 948b587..b7fbbc4 100644
95--- a/include/cuco/traits.hpp
96+++ b/include/cuco/traits.hpp
97@@ -16,7 +16,7 @@
98
99 #pragma once
100
101-#include <type_traits>
102+// #include <type_traits>
103
104 namespace cuco {
105
106