Struct sql_ops::partition::PartitionOffsets
source · [−]pub struct PartitionOffsets<T: DeviceCopy> { /* private fields */ }
Expand description
Partition offsets for an array of chunked partitions.
The offsets describe a PartitionedRelation
. The offsets reference
partitions within an array. Optionally, each partition includes padding.
Layout
The layout looks as follows (C = chunk, P = partition):
C0.P0 | C0.P1 | ... | C0.PN | C1.P0 | C1.P1 | ... | C1.PN | ... | CM.PN
Note that no restrictions are placed on the data layout (i.e., offsets may be numerically unordered).
offsets
vs. local_offsets
Chunked prefix sums inherently have local offsets for each chunk. In contrast, contiguous histograms only have one set of “global” offsets.
The partitioning operator requires a set of local offsets for each chunk.
Thus, the contiguous prefix sum variants output local_offsets
in addition
to the normal offsets
.
Invariants
len
must match inPartitionedRelation
radix_bits
must match inGpuRadixPartitioner
max_chunks
must equal the maximum number of chunks computed at runtime (e.g., the grid size)
Implementations
sourceimpl<T: DeviceCopy> PartitionOffsets<T>
impl<T: DeviceCopy> PartitionOffsets<T>
sourcepub fn new(
histogram_algorithm_type: HistogramAlgorithmType,
max_chunks: u32,
radix_bits: u32,
alloc_fn: MemAllocFn<u64>
) -> Self
pub fn new(
histogram_algorithm_type: HistogramAlgorithmType,
max_chunks: u32,
radix_bits: u32,
alloc_fn: MemAllocFn<u64>
) -> Self
Creates a new partition offsets array.
sourcepub fn len(&self) -> Option<usize>
pub fn len(&self) -> Option<usize>
Returns the total number of elements in the relation (excluding padding).
If the prefix sum is not yet computed, then None
is returned.
sourcepub fn num_chunks(&self) -> u32
pub fn num_chunks(&self) -> u32
Returs the number of chunks.
sourcepub fn chunks_mut(&mut self) -> PartitionOffsetsChunksMut<'_, T>ⓘNotable traits for PartitionOffsetsChunksMut<'a, T>impl<'a, T: DeviceCopy> Iterator for PartitionOffsetsChunksMut<'a, T> type Item = PartitionOffsetsMutSlice<'a, T>;
pub fn chunks_mut(&mut self) -> PartitionOffsetsChunksMut<'_, T>ⓘNotable traits for PartitionOffsetsChunksMut<'a, T>impl<'a, T: DeviceCopy> Iterator for PartitionOffsetsChunksMut<'a, T> type Item = PartitionOffsetsMutSlice<'a, T>;
Returns an iterator over the chunks contained inside the offsets.
Chunks are non-overlapping and can safely be used for parallel processing.
sourcepub fn radix_bits(&self) -> u32
pub fn radix_bits(&self) -> u32
Returns the number of radix bits.
sourcepub fn partition_len(&self, partition_id: u32) -> Result<usize>
pub fn partition_len(&self, partition_id: u32) -> Result<usize>
Returns the length of the requested partition.
If the offsets are accessible by the CPU (i.e., in DerefMem), then the length is returned. Otherwise, the function returns an error.
Trait Implementations
sourceimpl<T: Debug + DeviceCopy> Debug for PartitionOffsets<T>
impl<T: Debug + DeviceCopy> Debug for PartitionOffsets<T>
sourceimpl<T: DeviceCopy> MemLock for PartitionOffsets<T>
impl<T: DeviceCopy> MemLock for PartitionOffsets<T>
sourcefn mlock(&mut self) -> NumaGpuResult<()>
fn mlock(&mut self) -> NumaGpuResult<()>
Lock memory
sourcefn munlock(&mut self) -> NumaGpuResult<()>
fn munlock(&mut self) -> NumaGpuResult<()>
Unlock memory
Auto Trait Implementations
impl<T> RefUnwindSafe for PartitionOffsets<T> where
T: RefUnwindSafe,
impl<T> Send for PartitionOffsets<T> where
T: Send,
impl<T> Sync for PartitionOffsets<T> where
T: Sync,
impl<T> Unpin for PartitionOffsets<T> where
T: Unpin,
impl<T> UnwindSafe for PartitionOffsets<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more