Alternative parallel execution frameworks in xarray · Issue #6807 · pydata/xarray (original) (raw)
Is your feature request related to a problem?
Since early on the project xarray has supported wrapping dask.array
objects in a first-class manner. However recent work on flexible array wrapping has made it possible to wrap all sorts of array types (and with #6804 we should support wrapping any array that conforms to the array API standard).
Currently though the only way to parallelize array operations with xarray "automatically" is to use dask. (You could use xarray-beam or other options too but they don't "automatically" generate the computation for you like dask does.)
When dask is the only type of parallel framework exposing an array-like API then there is no need for flexibility, but now we have nascent projects like cubed to consider too. @tomwhite
Describe the solution you'd like
Refactor the internals so that dask is one option among many, and that any newer options can plug in in an extensible way.
In particular cubed deliberately uses the same API as dask.array
, exposing:
- the methods needed to conform to the array API standard
- a
.chunk
and.compute
method, which we could dispatch to - dask-like functions to create computation graphs including blockwise, map_blocks, and rechunk
I would like to see xarray able to wrap any array-like object which offers this set of methods / functions, and call the corresponding version of that method for the correct library (i.e. dask vs cubed) automatically.
That way users could try different parallel execution frameworks simply via a switch like
ds.chunk(**chunk_pattern, manager="dask")
and see which one works best for their particular problem.
Describe alternatives you've considered
If we leave it the way it is now then xarray will not be truly flexible in this respect.
Any library can wrap (or subclass if they are really brave) xarray objects to provide parallelism but that's not the same level of flexibility.
Additional context
PR about making xarray able to wrap objects conforming to the new array API standard