-
Notifications
You must be signed in to change notification settings - Fork 54
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
Support different lshape maps in binary ops #887
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ben-bou
force-pushed
the
features/880-bin_op_different_distribution
branch
from
November 7, 2021 22:24
1958470
to
cb053e6
Compare
ben-bou
reviewed
Nov 8, 2021
b = ht.zeros(10000, split=0) | ||
c = a[:-1] + b[1:] | ||
``` | ||
In such cases, one of the operands is redistributed IN PLACE to match the distribution map of the other operand. |
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 in-place? This means that a binop can manipulate its arguments
ben-bou
reviewed
Nov 8, 2021
heat/core/_operations.py
Outdated
if ( | ||
t2.split is not None | ||
and not (t2.lshape_map[:, t2.split] == t1.lshape_map[:, t1.split]).all() | ||
and t2.lshape_map[:, t2.split].sum() == t1.lshape_map[:, t1.split].sum() |
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.
The last condition is not necessary:
output_shape
is already determined, so shapes are compatible- no (shape)broadcasting is happening in the split dimension because of lines 152 to 175
-> elements in split-dimension are already equal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Implementing support for binary operations on distributed DNDarrays of same shape, same split, but different distribution map, i.e.:
Issue/s resolved: #880
Changes proposed:
redistribute_
one of the two DNDarrays to match the distribution map of the other.__binary_op
documentationType of change
Memory requirements
Memory requirements are consistent with the extra memory requirements of
DNDarray.redistribute_()
.Performance
Performance slow-down is consistent with redistributing a DNDarray before a binary operation.
Due Diligence
Does this change modify the behaviour of other functions? If so, which?
no, but it redistributes one of the operands in place.