You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Several Dask.dataframe functions operate by applying a function across all partitions, bringing the results together, and then calling a function on the concatenated results. This applies to functions like groupby-aggregations:
df.groupby(...).column.sum()
If the individual partitions have many groups and there are many partitions, then we try to bring all of these together to one node, which now has to manage many ** 2 values. This is bad both if the node doesn't have enough memory or if there is a bandwidth problem (more likely).
To resolve this we should use tree-reductions. We do this in other parts of the dask codebase, including dask.array reductions and dask.bag reductions. It requires us to think a bit more about our algorithms (we now have a map, an intermediate reduction, and a final reduction) but these are often fairly doable.
If you search in dask.bag for def reduction and split_every you'll see that we took a simpler approach there where we only did the cases where the intermediate-aggregation function and the final-aggregation function were the same. This works well for functions like min, max, sum, distinct, and count, but not for things like mean, var, and std.
For dask.dataframe we would probably want the full solution.
Activity
mrocklin commentedon Oct 13, 2016
If you search in dask.bag for
def reductionandsplit_everyyou'll see that we took a simpler approach there where we only did the cases where the intermediate-aggregation function and the final-aggregation function were the same. This works well for functions like min, max, sum, distinct, and count, but not for things like mean, var, and std.For dask.dataframe we would probably want the full solution.
mrocklin commentedon Oct 13, 2016
For example when splitting something like groupby-var we may need to add another function to our current chunk and agg functions:
Dataframe tree reductions (#1663)