pyphi.parallel.chunking#

Pure index-partition helpers for parallel chunking.

No PyPhi imports: these decide how item indices are grouped into chunks, either evenly (count-balanced) or by estimated cost (weight-balanced).

Functions

cost_balanced_partition(weights, k)

Greedily LPT-pack item indices into min(k, n) cost-balanced bins.

even_partition(n, k)

Split range(n) into min(k, n) contiguous, near-equal bins.

iter_chunks(materialized, chunksize, num_workers)

Yield chunk tuples for parallel dispatch.