Skip to content

Using dask="allowed" is slightly faster #207

Open
@ahuang11

Description

@ahuang11

From:
https://xarray.pydata.org/en/stable/dask.html

Tip
For the majority of NumPy functions that are already wrapped by Dask, it’s usually a better idea to use the pre-existing dask.array function, by using either a pre-existing xarray methods or apply_ufunc() with dask='allowed'. Dask can often have a more efficient implementation that makes use of the specialized structure of a problem, unlike the generic speedups offered by dask='parallelized'.

So, I simply set dask="allowed"

    return xr.apply_ufunc(
        _rmse,
        a,
        b,
        weights,
        input_core_dims=input_core_dims,
        kwargs={"axis": axis, "skipna": skipna},
        dask="allowed",
        output_dtypes=[float],
        keep_attrs=keep_attrs,
    )

And a decent speedup
image
Almost 2x with bigger arrays!
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions