MCPcopy Create free account
hub / github.com/dask/dask / _split_up_single_chunk

Function _split_up_single_chunk

dask/array/core.py:3422–3438  ·  view source on GitHub ↗
(
    c: int, this_chunksize_tolerance: float, max_chunk_size: int, proposed: int
)

Source from the content-addressed store, hash-verified

3420
3421
3422def _split_up_single_chunk(
3423 c: int, this_chunksize_tolerance: float, max_chunk_size: int, proposed: int
3424) -> list[int]:
3425 # Calculate by what factor we have to split this chunk
3426 m = c / proposed
3427 if math.ceil(m) / m > this_chunksize_tolerance:
3428 # We want to smooth things potentially if rounding up would change the result
3429 # by a lot
3430 m = math.ceil(c / max_chunk_size)
3431 else:
3432 m = math.ceil(m)
3433 # split the chunk
3434 new_c, remainder = divmod(c, min(m, c))
3435 x = [new_c] * min(m, c)
3436 for i in range(remainder):
3437 x[i] += 1
3438 return x
3439
3440
3441def round_to(c, s):

Callers

nothing calls this directly

Calls 2

divmodFunction · 0.90
minFunction · 0.90

Tested by

no test coverage detected