Skip to main content

split_batch

Function split_batch 

Source
pub fn split_batch(
    total: usize,
    num_workers: usize,
    strategy: BatchSplitStrategy,
) -> Vec<usize>
Expand description

Split a batch into chunks according to strategy.

ยงExample

use trueno::brick::{split_batch, BatchSplitStrategy};

let chunks = split_batch(100, 4, BatchSplitStrategy::Equal);
assert_eq!(chunks.len(), 4);
assert_eq!(chunks.iter().sum::<usize>(), 100);