Debian Codegraph @

docs/source/array.rst

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 Array
2 =====
3
4 .. toctree::
5 :maxdepth: 1
6 :hidden:
7
8 array-best-practices.rst
9 array-chunks.rst
10 array-creation.rst
11 array-overlap.rst
12 array-design.rst
13 array-sparse.rst
14 array-stats.rst
15 array-slicing.rst
16 array-assignment.rst
17 array-stack.rst
18 array-gufunc.rst
19 array-random.rst
20 array-api.rst
21 array-numpy-compatibility.rst
22
23 Dask Array implements a subset of the NumPy ndarray interface using blocked
24 algorithms, cutting up the large array into many small arrays. This lets us
25 compute on arrays larger than memory using all of our cores. We coordinate
26 these blocked algorithms using Dask graphs.
27
28 .. raw:: html
29
30 <iframe width="560"
31 height="315"
32 src="https://www.youtube.com/embed/9h_61hXCDuI"
33 style="margin: 0 auto 20px auto; display: block;"
34 frameborder="0"
35 allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
36 allowfullscreen></iframe>
37
38 Examples
39 --------
40
41 Visit https://examples.dask.org/array.html to see and run examples using
42 Dask Array.
43
44 Design
45 ------
46
47 .. image:: images/dask-array.svg
48 :alt: Dask arrays coordinate many numpy arrays
49 :align: right
50 :scale: 35%
51
52 Dask arrays coordinate many NumPy arrays (or "duck arrays" that are
53 sufficiently NumPy-like in API such as CuPy or Sparse arrays) arranged into a
54 grid. These arrays may live on disk or on other machines.
55
56 New duck array chunk types (types below Dask on
57 `NEP-13's type-casting hierarchy`_) can be registered via
58 :func:`~dask.array.register_chunk_type`. Any other duck array types that are
59 not registered will be deferred to in binary operations and NumPy
60 ufuncs/functions (that is, Dask will return ``NotImplemented``). Note, however,
61 that *any* ndarray-like type can be inserted into a Dask Array using
62 :func:`~dask.array.Array.from_array`.
63
64 Common Uses
65 -----------
66
67 Dask Array is used in fields like atmospheric and oceanographic science, large
68 scale imaging, genomics, numerical algorithms for optimization or statistics,
69 and more.
70
71 Scope
72 -----
73
74 Dask arrays support most of the NumPy interface like the following:
75
76 - Arithmetic and scalar mathematics: ``+, *, exp, log, ...``
77 - Reductions along axes: ``sum(), mean(), std(), sum(axis=0), ...``
78 - Tensor contractions / dot products / matrix multiply: ``tensordot``
79 - Axis reordering / transpose: ``transpose``
80 - Slicing: ``x[:100, 500:100:-2]``
81 - Fancy indexing along single axes with lists or NumPy arrays: ``x[:, [10, 1, 5]]``
82 - Array protocols like ``__array__`` and ``__array_ufunc__``
83 - Some linear algebra: ``svd, qr, solve, solve_triangular, lstsq``
84 - ...
85
86
87 However, Dask Array does not implement the entire NumPy interface. Users expecting this
88 will be disappointed. Notably, Dask Array lacks the following features:
89
90 - Much of ``np.linalg`` has not been implemented.
91 This has been done by a number of excellent BLAS/LAPACK implementations,
92 and is the focus of numerous ongoing academic research projects
93 - Arrays with unknown shapes do not support all operations
94 - Operations like ``sort`` which are notoriously
95 difficult to do in parallel, and are of somewhat diminished value on very
96 large data (you rarely actually need a full sort).
97 Often we include parallel-friendly alternatives like ``topk``
98 - Dask Array doesn't implement operations like ``tolist`` that would be very
99 inefficient for larger datasets. Likewise, it is very inefficient to iterate
100 over a Dask array with for loops
101 - Dask development is driven by immediate need, hence many lesser used
102 functions have not been implemented. Community contributions are encouraged
103
104 See :doc:`the dask.array API<array-api>` for a more extensive list of
105 functionality.
106
107 Execution
108 ---------
109
110 By default, Dask Array uses the threaded scheduler in order to avoid data
111 transfer costs, and because NumPy releases the GIL well. It is also quite
112 effective on a cluster using the `dask.distributed`_ scheduler.
113
114 .. _`dask.distributed`: https://distributed.dask.org/en/latest/
115 .. _`NEP-13's type-casting hierarchy`: https://numpy.org/neps/nep-0013-ufunc-overrides.html#type-casting-hierarchy