20#include <unordered_map>
45template<
typename CHAR_T,
unsigned CHAR_SIZE_BITS = sizeof(CHAR_T) * 8>
149template<
typename CHAR_T,
unsigned CHAR_SIZE_BITS>
164template<
typename CHAR_T,
unsigned CHAR_SIZE_BITS>
174template<
typename CHAR_T,
unsigned CHAR_SIZE_BITS>
178 ResultLCP result = { std::strong_ordering::equal, lcp };
184 auto [comparison,
next_lcp] =
key1->par_k_compare(*
key2, lcp, m_comparison_size, d_a, d_largeblock, m_max_copied);
187 result.
result = comparison;
190 if (comparison == std::strong_ordering::equal)
200 m_comparison_size *= 2;
212 m_comparison_size = std::max(KEY_T::MIN_PAR_COMPARE_CHAR_SIZE, m_comparison_size / 2);
217template<
typename CHAR_T,
unsigned CHAR_SIZE_BITS>
222 return insert(key, get_random_height());
225template<
typename CHAR_T,
unsigned CHAR_SIZE_BITS>
230 m_comparison_size = KEY_T::MIN_PAR_COMPARE_CHAR_SIZE;
234 return ST::insert(key, height);
237template<
typename CHAR_T,
unsigned CHAR_SIZE_BITS>
242 m_comparison_size = KEY_T::MIN_PAR_COMPARE_CHAR_SIZE;
Defines the BitString class for compact character string storage and comparison.
Defines the SkipTrie class, a skip list based data structure optimized for string storage and retriev...
A class to store strings compactly into integers, packing multiple characters into a single word.
static constexpr unsigned ALPHA
Number of characters that can be packed into a single storage word.
Implements a GPU-accelerated skip list data structure optimized for efficient string operations.
size_t m_comparison_size
Current size (in characters) used for parallel comparisons, adjusted dynamically.
ResultLCP compare(const KEY_T *key1, const KEY_T *key2, size_t lcp) const noexcept
Compares two keys using GPU-accelerated parallel comparison.
uintmax_t * d_largeblock
Large block of device (GPU) memory for more complex parallel operations.
EqualOrSuccessor find_equal_or_successor(const KEY_T *key, const bool require_level0) const noexcept
Finds the node containing the exact key or its immediate successor, using parallel comparison.
uintmax_t * d_a
Device (GPU) memory for parallel string comparison operations.
size_t m_max_size
Maximum total size of keys that can be stored, used for GPU memory allocation.
ParallelSkipTrie(size_t max_size)
Constructs a new ParallelSkipTrie with allocated GPU memory for parallel operations.
size_t m_max_copied
Tracks the maximum number of characters copied to the GPU during comparison operations.
~ParallelSkipTrie()
Destructor for the ParallelSkipTrie class.
bool insert(const KEY_T *key) noexcept
Inserts a new key into the skip list with a randomly generated height.
Implements a skip list data structure optimized for storing and retrieving BitString keys.
size_t lcp(const KEY_T *key) const noexcept
Calculates the Longest Common Prefix (LCP) between a given key and its position in the skip list sear...
size_t height() const noexcept
Returns the current maximum height of the skip list.
static size_t get_random_height()
Generates a random height for a new node based on a geometric distribution.
Provides utility functions and classes for CUDA operations.
void device_free(T *d_arr)
Frees memory on the CUDA device.
T * alloc_to_device(size_t size)
Allocates memory on the CUDA device.
uintmax_t * alloc_large_block_to_device(size_t n)
Allocates a large block of device memory for parallel mismatch operations.
CUDA-accelerated Most Significant Word finding algorithms.
Helper struct to return a Node pointer, a flag indicating equality, and an LCP value.
Helper struct to return a comparison result (ordering) and an LCP value.
std::strong_ordering result
The result of the comparison (std::strong_ordering::less, equal, or greater).
size_t lcp
The Longest Common Prefix length calculated during the comparison.