dask 2021.10.0

ParametersReturns
prefixscan_blelloch(func, preop, binop, x, axis=None, dtype=None, out=None)

The Blelloch prefix scan is work-efficient and exposes parallelism. A parallel cumsum works by first taking the sum of each block, then do a binary tree merge followed by a fan-out (i.e., the Brent-Kung pattern). We then take the cumsum of each block and add the sum of the previous blocks.

When performing a cumsum across N chunks, this method has 2 * lg(N) levels of dependencies. In contrast, the sequential method has N levels of dependencies.

Floating point operations should be more accurate with this method compared to sequential.

Parameters

func : callable

Cumulative function (e.g. np.cumsum )

preop : callable

Function to get the final value of a cumulative function (e.g., np.sum )

binop : callable

Associative function (e.g. add )

x : dask array
axis : int
dtype : dtype

Returns

dask array

Generic function to perform parallel cumulative scan (a.k.a prefix scan)

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /dask/array/reductions.py#1178
type: <class 'function'>
Commit: