|
Zip and Skip Tries
|
Extends the ZipTrie class to incorporate parallel key comparisons leveraging GPU acceleration (CUDA).
More...


Public Types | |
| using | ZT = ZipTrie< CHAR_T, MEMORY_EFFICIENT, RANK_T, CHAR_SIZE_BITS > |
| Alias for the base ZipTrie class template instantiation for brevity. | |
| using | LCP_T = typename ZT::LCP_T |
Alias for the LCP type used, inherited from the base class (ZipTrie::LCP_T). | |
| using | KEY_T = typename ZT::KEY_T |
Alias for the Key type used, inherited from the base class (ZipTrie::KEY_T). | |
| using | SearchResults = typename ZT::SearchResults |
| Removes a node with a given key from the zip tree. (Not implemented) | |
Public Types inherited from ZipTrie< CHAR_T, MEMORY_EFFICIENT, RANK_T, CHAR_SIZE_BITS > | |
| using | LCP_T = std::conditional_t< MEMORY_EFFICIENT, MemoryEfficientLCP, unsigned > |
| The type used to store Longest Common Prefix values. | |
| using | KEY_T = BitString< CHAR_T, CHAR_SIZE_BITS > |
The type used for keys, an instantiation of the BitString template. | |
Public Member Functions | |
| ParallelZipTrie (unsigned max_size, unsigned max_lcp_length) | |
| Constructs a ParallelZipTrie. | |
| ~ParallelZipTrie () | |
| Destructor for ParallelZipTrie. | |
| void | insert (const KEY_T *key) noexcept |
| Inserts a key into the parallel zip trie using parallel comparison logic. | |
| SearchResults | search (const KEY_T *key) const noexcept override |
| Performs a search for a key within the ParallelZipTrie using parallel comparison logic. | |
| unsigned | size () const noexcept |
| Returns the number of nodes (keys) currently stored in the trie. | |
Public Member Functions inherited from ZipTrie< CHAR_T, MEMORY_EFFICIENT, RANK_T, CHAR_SIZE_BITS > | |
| ZipTrie (unsigned max_size, unsigned max_lcp_length) noexcept | |
| Constructs an empty ZipTrie. | |
| int | get_depth (const KEY_T *key) const noexcept |
| Calculates the depth of a given key in the trie. | |
| int | height () const noexcept |
| Calculates the height of the trie. | |
| double | get_average_height () const noexcept |
| Calculates the average depth of all nodes currently in the trie. | |
| unsigned | size () const noexcept |
| Returns the number of nodes (keys) currently stored in the trie. | |
| bool | contains (const KEY_T *key) const noexcept |
| Checks if a key exists within the trie. | |
| LCP_T | lcp (const KEY_T *key) const noexcept |
| Finds the Longest Common Prefix (LCP) between the search key and the path taken in the trie. | |
| void | insert (const KEY_T *key) noexcept |
| Inserts a key into the zip trie. | |
| const RANK_T & | get_root_rank () const noexcept |
| Removes a node with a given key from the zip tree. (Not implemented) | |
| void | set (const KEY_T *key, RANK_T rank, unsigned left, unsigned right, LCP_T predecessor_lcp, LCP_T successor_lcp) noexcept |
| Directly adds a pre-constructed bucket to the internal storage vector. | |
| void | set_root_index (unsigned root_index) noexcept |
| Directly sets the root index of the trie. | |
| void | to_dot (const std::string &file_path) const noexcept |
| Generates a DOT language representation of the trie structure for visualization. | |
Protected Types | |
| using | AncestorLCPs = typename ZT::AncestorLCPs |
Alias for the AncestorLCPs struct from the base class ZipTrie. | |
| using | Bucket = typename ZT::Bucket |
Alias for the Bucket (node) struct from the base class ZipTrie. | |
| using | ComparisonResult = typename ZT::ComparisonResult |
Alias for the ComparisonResult struct from the base class ZipTrie. | |
Protected Member Functions | |
| MemoryEfficientLCP | get_memory_efficient_lcp (size_t num) const noexcept |
Using declaration for the LCP approximation helper (if MEMORY_EFFICIENT is true) from ZipTrie. | |
| template<typename CompareFunction > | |
| SearchResults | search_recursive (const KEY_T *key, CompareFunction compare_func) const noexcept |
Using declaration for the recursive search helper from the base class ZipTrie. | |
| template<typename CompareFunction > | |
| unsigned | insert_recursive (Bucket *x, unsigned x_index, unsigned v_index, AncestorLCPs ancestor_lcps, CompareFunction compare_func) noexcept |
Using declaration for the recursive insert helper from the base class ZipTrie. | |
| std::optional< ComparisonResult > | k_compare_prefix_check (const Bucket &v, const AncestorLCPs &ancestor_lcps, size_t &out_start_lcp_val) const noexcept |
Using declaration for the LCP prefix check optimization helper from ZipTrie. | |
| LCP_T | convert_lcp (size_t val) const noexcept |
Using declaration for the LCP value conversion helper from ZipTrie. | |
Protected Member Functions inherited from ZipTrie< CHAR_T, MEMORY_EFFICIENT, RANK_T, CHAR_SIZE_BITS > | |
| MemoryEfficientLCP | get_memory_efficient_lcp (size_t num) const noexcept |
Converts a standard LCP length (size_t) into the MemoryEfficientLCP format. | |
| template<typename CompareFunction > | |
| SearchResults | search_recursive (const KEY_T *key, CompareFunction compare_func) const noexcept |
Recursive helper function for the public search method. | |
| template<typename CompareFunction > | |
| unsigned | insert_recursive (Bucket *x, unsigned x_index, unsigned v_index, AncestorLCPs ancestor_lcps, CompareFunction compare_func) noexcept |
Recursive helper function for inserting a new node x. | |
| std::optional< ComparisonResult > | k_compare_prefix_check (const Bucket &v, const AncestorLCPs &ancestor_lcps, size_t &out_start_lcp_val) const noexcept |
| Performs an initial check based on ancestor LCPs before full key comparison (k-compare optimization). | |
| LCP_T | convert_lcp (size_t val) const noexcept |
Converts an exact LCP length (e.g., number of matching characters/bits) to the LCP_T type. | |
Protected Attributes | |
| unsigned | _root_index |
Using declaration for the root index from the base class ZipTrie. | |
| unsigned | _max_lcp_length |
Using declaration for the maximum LCP length storage from the base class ZipTrie. | |
| uint8_t | _log_max_size |
Using declaration for the log max size storage from the base class ZipTrie. | |
| std::vector< Bucket > | _buckets |
Using declaration for the node storage vector (std::vector<Bucket>) from the base class ZipTrie. | |
Protected Attributes inherited from ZipTrie< CHAR_T, MEMORY_EFFICIENT, RANK_T, CHAR_SIZE_BITS > | |
| unsigned | _root_index |
Index of the root node within the _buckets vector. Initialized to NULLPTR for an empty trie. | |
| unsigned | _max_lcp_length |
| Stores the maximum possible LCP length provided during construction. | |
| uint8_t | _log_max_size |
Stores the approximate log base 2 of the max_size provided during construction. | |
| std::vector< Bucket > | _buckets |
A contiguous vector storing all the nodes (Buckets) of the trie. | |
Static Protected Attributes | |
| static constexpr unsigned | NULLPTR |
Using declaration for the null pointer constant (unsigned) from the base class ZipTrie. | |
Static Protected Attributes inherited from ZipTrie< CHAR_T, MEMORY_EFFICIENT, RANK_T, CHAR_SIZE_BITS > | |
| static constexpr unsigned | NULLPTR = std::numeric_limits<unsigned>::max() |
Represents a null child pointer index using the maximum value of unsigned. | |
Private Member Functions | |
| ComparisonResult | k_compare (const KEY_T *x, const Bucket &v, const AncestorLCPs &ancestor_lcps, size_t &comparison_size, size_t &max_copied) const noexcept |
Performs key comparison using parallel logic, overriding the base class k_compare. | |
Private Attributes | |
| uintmax_t * | d_a |
Pointer to device memory buffer 'a', used as primary input/output for parallel key comparisons (e.g., via BitString::par_k_compare). | |
| uintmax_t * | d_largeblock |
Pointer to auxiliary device memory buffer ('largeblock'), used as temporary storage or workspace during parallel key comparisons by kernels like par_find_mismatch. | |
Extends the ZipTrie class to incorporate parallel key comparisons leveraging GPU acceleration (CUDA).
This class inherits the core structure and logic of ZipTrie but overrides key comparison-related methods (k_compare, search, insert) to utilize a parallel comparison function (par_k_compare from BitString). It manages CUDA device memory buffers (d_a, d_largeblock) required for these parallel comparisons, allocating them in the constructor and freeing them in the destructor. This allows for potentially faster trie operations when comparing long keys, at the cost of requiring CUDA-enabled hardware and managing GPU memory. The LCP-based prefix check optimization (k_compare_prefix_check) from the base class is still utilized to avoid unnecessary parallel comparisons when possible.
| CHAR_T | The underlying character type used in the keys (BitString). |
| MEMORY_EFFICIENT | If true, uses MemoryEfficientLCP; otherwise, uses unsigned for LCP storage. |
| RANK_T | The type used for node ranks (default: GeometricRank). |
| CHAR_SIZE_BITS | The number of significant bits per character in CHAR_T. |
Definition at line 42 of file ParallelZipTrie.cuh.
|
protected |
Alias for the AncestorLCPs struct from the base class ZipTrie.
Definition at line 137 of file ParallelZipTrie.cuh.
|
protected |
Alias for the Bucket (node) struct from the base class ZipTrie.
Definition at line 139 of file ParallelZipTrie.cuh.
|
protected |
Alias for the ComparisonResult struct from the base class ZipTrie.
Definition at line 141 of file ParallelZipTrie.cuh.
| using ParallelZipTrie< CHAR_T, MEMORY_EFFICIENT, RANK_T, CHAR_SIZE_BITS >::KEY_T = typename ZT::KEY_T |
Alias for the Key type used, inherited from the base class (ZipTrie::KEY_T).
Definition at line 51 of file ParallelZipTrie.cuh.
| using ParallelZipTrie< CHAR_T, MEMORY_EFFICIENT, RANK_T, CHAR_SIZE_BITS >::LCP_T = typename ZT::LCP_T |
Alias for the LCP type used, inherited from the base class (ZipTrie::LCP_T).
Definition at line 49 of file ParallelZipTrie.cuh.
| using ParallelZipTrie< CHAR_T, MEMORY_EFFICIENT, RANK_T, CHAR_SIZE_BITS >::SearchResults = typename ZT::SearchResults |
Removes a node with a given key from the zip tree. (Not implemented)
| key | key of node to remove |
Alias for the SearchResults struct defined in the base ZipTrie class.
Definition at line 106 of file ParallelZipTrie.cuh.
| using ParallelZipTrie< CHAR_T, MEMORY_EFFICIENT, RANK_T, CHAR_SIZE_BITS >::ZT = ZipTrie<CHAR_T, MEMORY_EFFICIENT, RANK_T, CHAR_SIZE_BITS> |
Alias for the base ZipTrie class template instantiation for brevity.
Definition at line 46 of file ParallelZipTrie.cuh.
| ParallelZipTrie< CHAR_T, MEMORY_EFFICIENT, RANK_T, CHAR_SIZE_BITS >::ParallelZipTrie | ( | unsigned | max_size, |
| unsigned | max_lcp_length | ||
| ) |
Constructs a ParallelZipTrie.
Initializes the base ZipTrie and allocates necessary CUDA device memory buffers (d_a, d_largeblock) required for the parallel key comparisons (BitString::par_k_compare). The size of the allocated buffers is determined by the max_lcp_length parameter.
| max_size | Hint for reserving memory for the expected maximum number of nodes (passed to base class constructor). |
| max_lcp_length | The maximum possible LCP length (in characters/bits), used for device memory allocation size calculation. |
Definition at line 195 of file ParallelZipTrie.cuh.
Destructor for ParallelZipTrie.
Frees the CUDA device memory buffers (d_a, d_largeblock) allocated in the constructor.
Definition at line 209 of file ParallelZipTrie.cuh.
|
inlineprotectednoexcept |
Using declaration for the LCP value conversion helper from ZipTrie.
Definition at line 492 of file ZipTrie.hpp.
|
inlineprotectednoexcept |
Using declaration for the LCP approximation helper (if MEMORY_EFFICIENT is true) from ZipTrie.
Definition at line 391 of file ZipTrie.hpp.
|
noexcept |
Inserts a key into the parallel zip trie using parallel comparison logic.
This method overrides the base class insert. It adds the key with a random rank to the internal storage (_buckets) and then calls the recursive insertion helper (insert_recursive), providing a comparison function lambda that utilizes the parallel k_compare implementation of this class. The parallel k_compare leverages BitString::par_k_compare for GPU acceleration when beneficial.
| key | Pointer to the new key to insert. Must be non-null and point to a valid KEY_T object. |
key must exceed the lifetime of the ParallelZipTrie. Definition at line 292 of file ParallelZipTrie.cuh.
|
protectednoexcept |
Using declaration for the recursive insert helper from the base class ZipTrie.
Definition at line 433 of file ZipTrie.hpp.
|
inlineprivatenoexcept |
Performs key comparison using parallel logic, overriding the base class k_compare.
This method implements the core parallel comparison strategy for ParallelZipTrie. It first leverages the inherited k_compare_prefix_check optimization. If a full comparison is necessary, it iteratively calls the BitString::par_k_compare function, which performs the comparison on the GPU. The comparison_size parameter controls the chunk size (number of characters) compared in each parallel step and is adapted dynamically: it increases if blocks match to compare larger chunks next time, and decreases if a mismatch is found to potentially refine the LCP more quickly in subsequent comparisons within the same search/insert operation.
| x | Pointer to the key being searched for or inserted. | |
| v | Constant reference to the current node (Bucket) being compared against. | |
| ancestor_lcps | The LCPs computed along the path from the root down to v's parent. | |
| [in,out] | comparison_size | Controls the block size (number of characters) for the parallel comparison step. Its value is adapted based on the comparison outcome. |
| [in,out] | max_copied | Tracks state related to data copied to device memory (d_a) by par_k_compare to potentially optimize subsequent copies within the same search/insert operation. |
comparison) of x vs v and the calculated Longest Common Prefix (lcp) between them (converted to LCP_T). BitString::par_k_compare function and relies on the device memory buffers d_a and d_largeblock managed by this class. Definition at line 217 of file ParallelZipTrie.cuh.
|
protectednoexcept |
Using declaration for the LCP prefix check optimization helper from ZipTrie.
Definition at line 478 of file ZipTrie.hpp.
|
overridevirtualnoexcept |
Performs a search for a key within the ParallelZipTrie using parallel comparison logic.
Overrides the base class search method. It initializes state required for parallel comparison (comparison_size, max_copied) and calls the recursive search helper (search_recursive) inherited from the base class. Crucially, it passes a comparison function lambda that invokes the parallel k_compare implementation defined within this ParallelZipTrie class.
| key | Pointer to the key to search for. |
Reimplemented from ZipTrie< CHAR_T, MEMORY_EFFICIENT, RANK_T, CHAR_SIZE_BITS >.
Definition at line 273 of file ParallelZipTrie.cuh.
|
protectednoexcept |
Using declaration for the recursive search helper from the base class ZipTrie.
Definition at line 407 of file ZipTrie.hpp.
|
noexcept |
Returns the number of nodes (keys) currently stored in the trie.
Inherited directly from the base ZipTrie class via the using declaration.
Definition at line 183 of file ZipTrie.hpp.
|
protected |
Using declaration for the node storage vector (std::vector<Bucket>) from the base class ZipTrie.
Definition at line 379 of file ZipTrie.hpp.
|
protected |
Using declaration for the log max size storage from the base class ZipTrie.
Definition at line 323 of file ZipTrie.hpp.
|
protected |
Using declaration for the maximum LCP length storage from the base class ZipTrie.
Definition at line 317 of file ZipTrie.hpp.
|
protected |
Using declaration for the root index from the base class ZipTrie.
Definition at line 312 of file ZipTrie.hpp.
|
private |
Pointer to device memory buffer 'a', used as primary input/output for parallel key comparisons (e.g., via BitString::par_k_compare).
Definition at line 157 of file ParallelZipTrie.cuh.
|
private |
Pointer to auxiliary device memory buffer ('largeblock'), used as temporary storage or workspace during parallel key comparisons by kernels like par_find_mismatch.
Definition at line 159 of file ParallelZipTrie.cuh.
|
staticconstexprprotected |
Using declaration for the null pointer constant (unsigned) from the base class ZipTrie.
Definition at line 326 of file ZipTrie.hpp.