Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reductions do not properly support unstructured distributions #659

Open
cfarrow opened this issue Dec 13, 2016 · 0 comments
Open

Reductions do not properly support unstructured distributions #659

cfarrow opened this issue Dec 13, 2016 · 0 comments

Comments

@cfarrow
Copy link

cfarrow commented Dec 13, 2016

This reproduces the problem

# 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

Traceback (most recent call last):
  File "failure.py", line 19, in <module>
    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant