|
Zip and Skip Tries
|
CUDA-accelerated Most Significant Word finding algorithms. More...
#include <cstddef>#include <cstdint>

Go to the source code of this file.
Functions | |
| size_t | seq_find_mismatch (const uintmax_t *const a, const uintmax_t *const b, size_t n) |
| Sequential implementation of finding the first mismatching word between two arrays. | |
| size_t | par_find_mismatch (const uintmax_t *const a, const uintmax_t *const b, size_t n) |
| GPU-accelerated implementation of finding the first mismatching word. | |
| size_t | par_find_mismatch (const uintmax_t *const d_a, const uintmax_t *const b, uintmax_t *d_large_block, size_t n) |
| GPU-accelerated mismatch finding with pre-allocated device memory. | |
| uintmax_t * | alloc_large_block_to_device (size_t max_n) |
| Allocates a large block of device memory for parallel mismatch operations. | |
CUDA-accelerated Most Significant Word finding algorithms.
Provides functions for finding the most significant word (MSW) and the first mismatching word between two arrays of words. The implementation uses GPU-accelerated algorithms with a square root decomposition approach for efficient parallel processing.
Definition in file msw.cuh.
Allocates a large block of device memory for parallel mismatch operations.
Allocates enough memory for the square root decomposition algorithm, which requires space for the second array, section information, and √n additional elements.
| max_n | Maximum number of elements to be processed |
Calculates the required memory size based on the input size n and allocates a contiguous block of memory on the device. The size is calculated to accommodate:
| n | Number of elements to be processed |
Definition at line 256 of file msw.cu.
GPU-accelerated implementation of finding the first mismatching word.
Allocates device memory, copies data, and uses parallel algorithms to find the first mismatch. Uses a square root decomposition approach that divides the arrays into √n chunks for efficient parallel processing.
| a | First input array (host memory) |
| b | Second input array (host memory) |
| n | Number of elements in the arrays |
GPU-accelerated implementation of finding the first mismatching word.
This function handles all the device memory management, including:
This provides a simpler interface for callers who don't need to manage device memory themselves or reuse memory across multiple calls.
| a | First input array (host memory) |
| b | Second input array (host memory) |
| n | Number of elements in the arrays |
Definition at line 280 of file msw.cu.
| size_t par_find_mismatch | ( | const uintmax_t *const | d_a, |
| const uintmax_t *const | b, | ||
| uintmax_t * | d_large_block, | ||
| size_t | n | ||
| ) |
GPU-accelerated mismatch finding with pre-allocated device memory.
Uses a square root decomposition approach: first divides the input into √n chunks, identifies the first chunk with a mismatch in O(n) time and constant span, then finds the exact mismatch within that chunk, also in O(n) time and constant span.
| d_a | First input array (already in device memory) |
| b | Second input array (host memory, will be copied to device) |
| d_large_block | Pre-allocated device memory block for temporary storage |
| n | Number of elements in the arrays |
GPU-accelerated mismatch finding with pre-allocated device memory.
This function implements a two-phase square root decomposition algorithm:
The algorithm uses three CUDA kernels:
Time complexity: O(n) work with O(1) span when sufficient threads are available Space complexity: O(n + sqrt(n)) for temporary storage
| d_a | First input array (already in device memory) |
| b | Second input array (host memory, will be copied to device) |
| d_large_block | Pre-allocated device memory block for temporary storage |
| n | Number of elements in the arrays |
Definition at line 178 of file msw.cu.
Sequential implementation of finding the first mismatching word between two arrays.
Compares two arrays element by element until finding the first mismatch. This is the baseline CPU implementation.
| a | First input array (host memory) |
| b | Second input array (host memory) |
| n | Number of elements in the arrays |
This is a simple linear scan through both arrays, comparing corresponding elements until a mismatch is found. This function serves as a baseline for comparison with the parallel implementation and is used for validation.
Time complexity: O(n) in the worst case Space complexity: O(1)
| arr1 | First input array |
| arr2 | Second input array |
| size | Number of elements in the arrays |