-
Notifications
You must be signed in to change notification settings - Fork 421
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
Enable bulk transfers of sparse arrays #25243
Enable bulk transfers of sparse arrays #25243
Conversation
This uses a new doi routine in a specific place to enable localization of sparse domains when doing my new optimization. Engin has told me the more principled way to do it, but I wanted to get this into a commit in a standalone branch first before refactoring. Interestingly, my test here seems to show that we don't correctly store 'definedConst' for sparse subdomains at present; though it does work for const arrays, which is the case I actually care about at present. So future work here to generalize this. --- Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
--- Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
--- Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
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.
Nice. A small addition to testing (different but equivalent domains) would be nice.
(though he technically didn't request it) --- Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
…f domain This adds a test Engin requested in his review to make sure that the bulk assignment logic between sparse arrays is comparing domain index sets precisely, and not relying on identity. Though other tests (including my not-yet-checked in sparse matrix-matrix multiplication) arguably do this by virtue of the domain localization optimization, this does it more expicitly by creating two domains with different identities but the same indices, and assigning arrays back and forth between them, modifying the arrays slightly along the way. For a multilocale run, I'm creating the arrays on different locales, but the domains on the same locale, somewhat arbitrarily; this arguably covers a slightly different case than the existing tests of the localization optimization, since in that case, the domains and arrays are on different locales. --- Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
Forgot that this test existed in the second-to-previous commit --- Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
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.
One minor question, but no need to check with me again before merging. Thanks!
This is a code I've been writing, looking at sparse matrix-matrix multiplication in Chapel to start to get more experience with our sparse features, look for gaps, check performance, etc. So far, the effort has resulted in improvements in the forms of PRs #25152, #25244, #24391, and #25243. This is a work-in-progress that almost certainly needs additional improvements in terms of performance, generality, ergonomics, but it's a good start and in a state to start exercising some of the aforementioned PRs. See the README for additional details.
This PR adds the
doiBulkTransfer[To|From]Known()
routines to the two sparse layouts we currently support in order to enable sparse arrays to be initialized using patterns likevar copy = mySparseArray;
where, previously, this resulted in a complaint about being unable to zip sparse arrays due to falling into the most general implementation of array-array transfers.Here, I'm adding some tests of this capability using the domain localization PR that I merged today (#24391) to prove that sparse arrays can be localized and accessed without incurring communication. I've turned on comm counts to track how many transfers are required, where I expect we could significantly reduce this over time by adding support for bulk transfer of the sparse domains themselves in the future (?).
Interestingly, one of the two cases that ought to cause my domain localization optimization to fire doesn't currently, suggesting that we don't set up definedConst properly for sparse subdomains; happily, the case I care about (const array, non-const domain) does work properly, so here I've checked in the tests to show that the other case doesn't work—another area for future improvement and a pre-existing issue not related to this effort.