Skip to content

Conversation

@kwmsmith
Copy link
Contributor

@kwmsmith kwmsmith commented Jul 7, 2014

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.

Slices the distribution object to remove all empty localarrays before
returning.  Only done if all dimensions use 'b' or 'n' in the dist
tuple.
@kwmsmith kwmsmith added the bug label Jul 7, 2014
@kwmsmith kwmsmith added this to the 0.4 milestone Jul 7, 2014
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(slice(None),)*self.ndim is the same as Ellipsis, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, it doesn't work though, so nevermind.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I tried Ellipsis, but it barfed. So this is the workaround for the workaround.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 [email protected] 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.

bgrant added a commit that referenced this pull request Jul 7, 2014
Adds workaround to remove empty local arrays
@bgrant bgrant merged commit 0f7db8b into master Jul 7, 2014
@bgrant bgrant deleted the bugfix/empty-locals branch July 7, 2014 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants