forked from Bears-R-Us/arkouda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sparse matrix testing and added features (Bears-R-Us#3745)
* Add func to convert sparse matrix to pdarrays We convert sparse matrices to a 3 tuple of pdarrays with row, cols, and vals Signed-off-by: Shreyas Khandekar <60454060+ShreyasKhandekar@users.noreply.github.com> * switch to using list of pdarrays We use the MsgTuple.fromResponses function to return a list of multiple pdarrays instead of a tupl, this minimzes the comm between the server and client. Signed-off-by: Shreyas Khandekar <60454060+ShreyasKhandekar@users.noreply.github.com> * Add fill_vals to populate a sparse array with values Signed-off-by: Shreyas Khandekar <60454060+ShreyasKhandekar@users.noreply.github.com> * Add tests for sparse matrix features Signed-off-by: Shreyas Khandekar <60454060+ShreyasKhandekar@users.noreply.github.com> * Add sparse_test to pytest, module in ServerModule Signed-off-by: Shreyas Khandekar <60454060+ShreyasKhandekar@users.noreply.github.com> * Add sparse matrix compat module for 2.0 Signed-off-by: Shreyas Khandekar <60454060+ShreyasKhandekar@users.noreply.github.com> * Add missing newlines at the end of files Signed-off-by: Shreyas Khandekar <60454060+ShreyasKhandekar@users.noreply.github.com> * List public object in sparrayclass with __all__ Signed-off-by: Shreyas Khandekar <60454060+ShreyasKhandekar@users.noreply.github.com> * Comment out non distributed version of mult Comment out the non ditributed version of the sparse matrix multiplication and also reduce the problem size in the test to make sure we don't run out of memory Signed-off-by: Shreyas Khandekar <60454060+ShreyasKhandekar@users.noreply.github.com> * Changes made based on feedback Signed-off-by: Shreyas Khandekar <60454060+ShreyasKhandekar@users.noreply.github.com> --------- Signed-off-by: Shreyas Khandekar <60454060+ShreyasKhandekar@users.noreply.github.com>
- Loading branch information
1 parent
e5723b3
commit b47e1fa
Showing
9 changed files
with
339 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ SegmentedMsg | |
SequenceMsg | ||
SetMsg | ||
SortMsg | ||
SparseMatrixMsg | ||
StatsMsg | ||
TimeClassMsg | ||
TransferMsg | ||
|
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
module ArkoudaSparseMatrixCompat { | ||
use SparseBlockDist; | ||
|
||
proc SparseBlockDom.setLocalSubdomain(locIndices, loc: locale = here) { | ||
if loc != here then | ||
halt("setLocalSubdomain() doesn't currently support remote updates"); | ||
ref myBlock = this.myLocDom!.mySparseBlock; | ||
if myBlock.type != locIndices.type then | ||
compilerError("setLocalSubdomain() expects its argument to be of type ", | ||
myBlock.type:string); | ||
else | ||
myBlock = locIndices; | ||
} | ||
|
||
proc SparseBlockArr.getLocalSubarray(localeRow, localeCol) const ref { | ||
return this.locArr[localeRow, localeCol]!.myElems; | ||
} | ||
|
||
proc SparseBlockArr.getLocalSubarray(localeIdx) const ref { | ||
return this.locArr[localeIdx]!.myElems; | ||
} | ||
|
||
proc SparseBlockArr.setLocalSubarray(locNonzeroes, loc: locale = here) { | ||
if loc != here then | ||
halt("setLocalSubarray() doesn't currently support remote updates"); | ||
ref myBlock = this.myLocArr!.myElems; | ||
if myBlock.type != locNonzeroes.type then | ||
compilerError("setLocalSubarray() expects its argument to be of type ", | ||
myBlock.type:string); | ||
else | ||
myBlock.data = locNonzeroes.data; | ||
} | ||
|
||
proc SparseBlockDom.dsiTargetLocales() const ref { | ||
return dist.targetLocales; | ||
} | ||
|
||
proc SparseBlockArr.dsiTargetLocales() const ref { | ||
return dom.dsiTargetLocales(); | ||
} | ||
|
||
use LayoutCS; | ||
|
||
proc CSDom.rows() { | ||
return this.rowRange; | ||
} | ||
|
||
proc CSDom.cols() { | ||
return this.colRange; | ||
} | ||
|
||
@chpldoc.nodoc | ||
iter CSDom.uidsInRowCol(rc) { | ||
for uid in startIdx[rc]..<startIdx[rc+1] do | ||
yield uid; | ||
} | ||
|
||
proc CSArr.rows() { | ||
return this.dom.rows(); | ||
} | ||
|
||
proc CSArr.cols() { | ||
return this.dom.cols(); | ||
} | ||
|
||
@chpldoc.nodoc | ||
iter CSArr.indsAndVals(rc) { | ||
ref dom = this.dom; | ||
for uid in dom.uidsInRowCol(rc) do | ||
yield (dom.idx[uid], this.data[uid]); | ||
} | ||
|
||
iter CSArr.colsAndVals(r) { | ||
if this.dom.compressRows == false then | ||
compilerError("Can't (efficiently) iterate over rows using a CSC layout"); | ||
for colVal in indsAndVals(r) do | ||
yield colVal; | ||
} | ||
|
||
iter CSArr.rowsAndVals(c) { | ||
if this.dom.compressRows == true then | ||
compilerError("Can't (efficiently) iterate over columns using a CSR layout"); | ||
for rowVal in indsAndVals(c) do | ||
yield rowVal; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module ArkoudaSparseMatrixCompat {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module ArkoudaSparseMatrixCompat {} |
Oops, something went wrong.