Return a chunk dimension that is close to an even multiple or factor We want values for c that are nicely aligned with s. If c is smaller than s we use the original chunk size and accept an uneven chunk at the end. If c is larger than s then we want the largest multiple of s that
(c, s)
| 3444 | |
| 3445 | |
| 3446 | def round_to(c, s): |
| 3447 | """Return a chunk dimension that is close to an even multiple or factor |
| 3448 | |
| 3449 | We want values for c that are nicely aligned with s. |
| 3450 | |
| 3451 | If c is smaller than s we use the original chunk size and accept an |
| 3452 | uneven chunk at the end. |
| 3453 | |
| 3454 | If c is larger than s then we want the largest multiple of s that is still |
| 3455 | smaller than c. |
| 3456 | """ |
| 3457 | if c <= s: |
| 3458 | return max(1, int(c)) |
| 3459 | else: |
| 3460 | return c // s * s |
| 3461 | |
| 3462 | |
| 3463 | def _get_chunk_shape(a): |
no test coverage detected
searching dependent graphs…