Adds workaround to remove empty local arrays#502
Conversation
Slices the distribution object to remove all empty localarrays before returning. Only done if all dimensions use 'b' or 'n' in the dist tuple.
There was a problem hiding this comment.
(slice(None),)*self.ndim is the same as Ellipsis, right?
There was a problem hiding this comment.
Heh, it doesn't work though, so nevermind.
There was a problem hiding this comment.
Yeah, I tried Ellipsis, but it barfed. So this is the workaround for the workaround.
There was a problem hiding this comment.
Merged. I think it barfed because I don't call sanitize_indices inside
Distribution.slice-- I call it before calling Distribution.slice.
On Mon, Jul 7, 2014 at 4:02 PM, Kurt Smith notifications@github.com wrote:
In distarray/dist/maps.py:
@@ -612,7 +612,17 @@ def new(cls, context, shape, dist=None, grid_shape=None, targets=None):
# list of `ClientMap` objects, one per dimension. maps = [map_from_sizes(*args) for args in zip(shape, dist, grid_shape)]
return cls.from_maps(context=context, maps=maps, targets=targets)
self = cls.from_maps(context=context, maps=maps, targets=targets)
# TODO: FIXME: this is a workaround. The reason we slice here is to# return a distribution with no empty local shapes. The `from_maps()`# classmethod should be fixed to ensure no empty local arrays are# created in the first place. That will remove the need to slice the# distribution to remove empty localshapes.if all(d in ('n', 'b') for d in self.dist):self = self.slice((slice(None),)*self.ndim)Yeah, I tried Ellipsis, but it barfed. So this is the workaround for the
workaround.—
Reply to this email directly or view it on GitHub
https://github.com/enthought/distarray/pull/502/files#r14622248.
Adds workaround to remove empty local arrays
Slices the distribution object to remove all empty localarrays before
returning. Only done if all dimensions use 'b' or 'n' in the dist
tuple.
Generalizes the fix in PRs #444 and #447.