enthought / enthought/distarray
Reductions do not properly support unstructured distributions
- Vorherrschende Sprache
- Python
- Sterne
- 5
- Forks
- 1
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
This reproduces the problem
```python
# Using IPython.parallel: 'dacluster start -n4' before running.
import numpy as np
from distarray.globalapi import Context
from distarray.globalapi.maps import Distribution, NoDistMap, UnstructuredMap
nparr = np.random.rand(4, 5)
context = Context()
m0 = UnstructuredMap(4, 3, [[0], [1], [2, 3]])
m1 = NoDistMap(5, 1)
distribution = Distribution.from_maps(
context,
maps=[m0, m1],
targets=[0, 1, 3]
)
darr = context.fromarray(nparr, distribution)
from IPython.core.debugger import Tracer; Tracer()()
darr.sum(axis=1) # boom!
```
This results in
```python
Traceback (most recent call last):
File "failure.py", line 19, in
darr.sum(axis=1) # boom!
File "/Users/cfarrow/projects/distarray/distarray/globalapi/distarray.py", line 383, in sum
return self._reduce('sum_reducer', axis, dtype, out)
File "/Users/cfarrow/projects/distarray/distarray/globalapi/distarray.py", line 362, in _reduce
ddpr = out_dist.get_dim_data_per_rank()
File "/Users/cfarrow/projects/distarray/distarray/globalapi/maps.py", line 830, in get_dim_data_per_rank
dds = [enumerate(m.get_dimdicts()) for m in self.maps]
File "/Users/cfarrow/projects/distarray/distarray/globalapi/maps.py", line 510, in get_dimdicts
raise ValueError()
ValueError
```
`Distribution.reduce` does not appear to consider `UnstructuredMap`, which leads to the `indices` used by the input `UnstructuredMap` to not be propagated to the output `UnstructuredMap`.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Führe die bereitgestellte IPython.parallel-Reproduktion mit `dacluster start -n4` aus und verfolge anschließend `distarray/globalapi/distarray.py` durch `_reduce` sowie `distarray/globalapi/maps.py` durch `Distribution.reduce`, `get_dim_data_per_rank` und `UnstructuredMap.get_dimdicts`. Als abgeschlossen gilt die Aufgabe, wenn `darr.sum(axis=1)` erfolgreich ausgeführt wird und die unstrukturierten Eingangsindizes an die Ausgabeverteilung weitergegeben werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- distributed-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100