From cc7cce6398d2f6a7ddc4319d0e93459d291d78d8 Mon Sep 17 00:00:00 2001 From: Anurag Mukkara Date: Sun, 10 Sep 2023 07:55:57 +0000 Subject: [PATCH] Misc coding style --- include/cuco/detail/trie/trie_ref.inl | 10 +++++----- include/cuco/trie.cuh | 4 ++-- tests/trie/lookup_test.cu | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/cuco/detail/trie/trie_ref.inl b/include/cuco/detail/trie/trie_ref.inl index 33e505539..be385ed0a 100644 --- a/include/cuco/detail/trie/trie_ref.inl +++ b/include/cuco/detail/trie/trie_ref.inl @@ -50,14 +50,14 @@ class operator_impl - [[nodiscard]] __device__ size_type get_last_child_position(BitVectorRef louds, - size_type& node_id) const noexcept + template + [[nodiscard]] __device__ size_type last_child_position(BitsetRef louds, + size_type& node_id) const noexcept { size_type node_pos = 0; if (node_id != 0) { @@ -85,7 +85,7 @@ class operator_impl(*this).trie_; auto louds = trie->louds_refs_ptr_[level_id]; - auto end = get_last_child_position(louds, node_id); // Position of last child + auto end = last_child_position(louds, node_id); // Position of last child auto begin = node_id; // Position of first child, initialized after find_last_child call auto& level = trie->d_levels_ptr_[level_id]; diff --git a/include/cuco/trie.cuh b/include/cuco/trie.cuh index 5fab14303..099da41f3 100644 --- a/include/cuco/trie.cuh +++ b/include/cuco/trie.cuh @@ -107,8 +107,8 @@ class trie { level* d_levels_ptr_; ///< Device-side array of levels using bitset_ref = detail::dynamic_bitset<>::ref_type; ///< Read ref - thrust::device_vector louds_refs_; ///< refs to per-level louds bitvectors - thrust::device_vector outs_refs_; ///< refs to per-level outs bitvectors + thrust::device_vector louds_refs_; ///< refs to per-level louds bitsets + thrust::device_vector outs_refs_; ///< refs to per-level outs bitsets bitset_ref* louds_refs_ptr_; ///< Raw pointer to d_louds_refs_ bitset_ref* outs_refs_ptr_; ///< Raw pointer to d_outs_refs_ diff --git a/tests/trie/lookup_test.cu b/tests/trie/lookup_test.cu index ed1bf7721..b431aa002 100644 --- a/tests/trie/lookup_test.cu +++ b/tests/trie/lookup_test.cu @@ -25,14 +25,14 @@ #include struct valid_key { - valid_key(uint64_t num_keys) : num_keys_(num_keys) {} - __host__ __device__ bool operator()(uint64_t x) const { return x < num_keys_; } - const uint64_t num_keys_; + valid_key(size_t num_keys) : num_keys_(num_keys) {} + __host__ __device__ bool operator()(size_t x) const { return x < num_keys_; } + const size_t num_keys_; }; template void generate_keys(thrust::host_vector& keys, - thrust::host_vector& offsets, + thrust::host_vector& offsets, size_t num_keys, size_t max_key_value, size_t max_key_length) @@ -58,7 +58,7 @@ TEST_CASE("Lookup test", "") std::size_t max_key_value = 1000; std::size_t max_key_length = 32; thrust::host_vector keys; - thrust::host_vector offsets; + thrust::host_vector offsets; generate_keys(keys, offsets, num_keys, max_key_value, max_key_length); @@ -97,9 +97,9 @@ TEST_CASE("Lookup test", "") trie.build(); { - thrust::device_vector lookup_result(num_keys, -1lu); - thrust::device_vector device_keys = keys; - thrust::device_vector device_offsets = offsets; + thrust::device_vector lookup_result(num_keys, -1lu); + thrust::device_vector device_keys = keys; + thrust::device_vector device_offsets = offsets; trie.lookup( device_keys.begin(), device_offsets.begin(), device_offsets.end(), lookup_result.begin());