-
Notifications
You must be signed in to change notification settings - Fork 1
Restrict use of checked_{g,s}etitem #377
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
Conversation
See inline comment for a full description.
This way I don't need to add it separately to all the constructors. There's also the small benefit of resilience to changing out the underlying maps.
Incidental.
A copy of them had already been added to LocalArray's GlobalIndex object, I just had to use it.
distarray/dist/maps.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why all caps? I never took you for a FORTRAN 77 aficionado, @bgrant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Mon, May 19, 2014 at 5:18 PM, Kurt Smith notifications@github.comwrote:
Why all caps? I never took you for a FORTRAN 77 aficionado, @bgranthttps://github.com/bgrant
.What? You didn't see my Project Euler solutions in FORTRAN 77?
https://github.com/bgrant/project-euler/blob/master/fortran/euler.f
But seriously, you're probably right. It seemed kind of like a constant or
a flag to me, but I suppose the fact that it's a function belies that.
Maybe I could rename it to allows_precise_indexing
or
has_precise_indexing
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After all, to follow F77, you'd have to fit the name into 6 characters like PRCIDG
or something totally cryptic like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Mon, May 19, 2014 at 5:28 PM, Robert David Grant <
notifications@github.com> wrote:
In distarray/dist/maps.py:
@@ -592,3 +592,12 @@ def get_dim_data_per_rank(self):
coord_and_dd = [zip(*cdd) for cdd in cart_dds]
rank_and_dd = sorted((self.rank_from_coords[c], dd) for (c, dd) in coord_and_dd)
return [dd for (_, dd) in rank_and_dd]
+
- @Property
- def PRECISE_INDEXING(self):
On Mon, May 19, 2014 at 5:18 PM, Kurt Smith notifications@github.comwrote:
Why all caps? I never took you for a FORTRAN 77 aficionado, @bgranthttps://github.com/bgrant
https://github.com/bgrant .
What? You didn't seem my Project Euler solutions in FORTRAN 77?
https://github.com/bgrant/project-euler/blob/master/fortran/euler.f
Nice! You should capitalize EVERYTHING, though. And what's with
explicitly declaring your function variables? Real programmers use
implicit typing.
But seriously, you're probably right. It seemed kind of like a constant
or a flag to me, but I suppose the fact that it's a function belies that.
Maybe I could rename it toallows_precise_indexing
or
has_precise_indexing
?—
Reply to this email directly or view it on GitHubhttps://github.com//pull/377/files#r12819899
.
Kurt W. Smith, Ph.D. ksmith@enthought.com
Enthought, Inc. http://www.enthought.com | 512.536.1057
Updated @kwmsmith. |
Conflicts: distarray/dist/maps.py
@bgrant looks good -- ignore my comment about the targets stuff earlier. Using |
…ed-getitem Restrict use of checked_{g,s}etitem
The client only needs to use a
LocalArray
'schecked_getitem
orchecked_setitem
methods when it doesn't know for sure which engine owns a particular index; otherwise it can use aLocalArray
's raw__getitem__
or__setitem__
. With the addition of client-side maps, aDistArray
always knows where all of its indices are unless one of its dimensions is anUnstructuredMap
. The changes in this PR reflect this.To implement this, I add the
has_precise_index
property to client-sideDistribution
objects. This property isFalse
only when anUnstructuredMap
is present.Additionally, I remove the
checked_getitem
andchecked_setitem
methods from theLocalArray
class, which forces a user to useDistarray.global_index.checked_{g,s}etitem
, where they still reside. Previously,LocalArray
s had a__getitem__
that took local indices and achecked_getitem
that took global indices. This was confusing. Another option, if we wanted to be stricter with the Law of Demeter, would be to add these methods back but rename them something likeglobal_checked_getitem
.