You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemds.apache.org by mb...@apache.org on 2022/08/07 13:53:49 UTC
[systemds] branch main updated (674b4e5941 -> 8488788205)
This is an automated email from the ASF dual-hosted git repository.
mboehm7 pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git
from 674b4e5941 [MINOR] Fix corrupted -stats output (unchecked federated statistics)
new 89720cc90a [MINOR] Mark additional unary ops for multi-threaded operations
new 8488788205 [SYSTEMDS-3418] Fix missing large block support in replace operations
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/main/java/org/apache/sysds/hops/UnaryOp.java | 19 +++++++-------
.../sysds/runtime/matrix/data/MatrixBlock.java | 29 +++++++++++++---------
2 files changed, 26 insertions(+), 22 deletions(-)
[systemds] 02/02: [SYSTEMDS-3418] Fix missing large block support in replace operations
Posted by mb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mboehm7 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git
commit 848878820589943fce6c5751d5ed04ca884a9a2d
Author: Matthias Boehm <mb...@gmail.com>
AuthorDate: Sun Aug 7 15:53:25 2022 +0200
[SYSTEMDS-3418] Fix missing large block support in replace operations
So far the existing sparse-dense and dense-dense replace operations only
supported normal dense blocks with up to 16GB and thus failed on large
multi-block dense blocks. This patch generalizes the existing kernels
with negligible runtime overhead for small blocks.
---
.../sysds/runtime/matrix/data/MatrixBlock.java | 29 +++++++++++++---------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/src/main/java/org/apache/sysds/runtime/matrix/data/MatrixBlock.java b/src/main/java/org/apache/sysds/runtime/matrix/data/MatrixBlock.java
index e2fa983343..d06d5a4177 100644
--- a/src/main/java/org/apache/sysds/runtime/matrix/data/MatrixBlock.java
+++ b/src/main/java/org/apache/sysds/runtime/matrix/data/MatrixBlock.java
@@ -5249,40 +5249,45 @@ public class MatrixBlock extends MatrixValue implements CacheBlock, Externalizab
ret.sparse = false;
ret.allocateDenseBlock();
SparseBlock a = sparseBlock;
- double[] c = ret.getDenseBlockValues();
+ DenseBlock c = ret.getDenseBlock();
//initialize with replacement (since all 0 values, see SPARSITY_TURN_POINT)
- Arrays.fill(c, replacement);
+ c.reset(rlen, clen, replacement);
//overwrite with existing values (via scatter)
if( a != null ) //check for empty matrix
- for( int i=0, cix=0; i<rlen; i++, cix+=clen ) {
+ for( int i=0; i<rlen; i++ ) {
if( !a.isEmpty(i) ) {
int apos = a.pos(i);
+ int cpos = c.pos(i);
int alen = a.size(i);
int[] aix = a.indexes(i);
double[] avals = a.values(i);
+ double[] cvals = c.values(i);
for( int j=apos; j<apos+alen; j++ )
if( avals[ j ] != 0 )
- c[ cix+aix[j] ] = avals[ j ];
+ cvals[ cpos+aix[j] ] = avals[ j ];
}
}
}
}
else { //DENSE <- DENSE
- int mn = ret.rlen * ret.clen;
- ret.allocateDenseBlock();
- double[] a = getDenseBlockValues();
- double[] c = ret.getDenseBlockValues();
- for( int i=0; i<mn; i++ ) {
- c[i] = ( a[i]== pattern || (NaNpattern && Double.isNaN(a[i])) ) ?
- replacement : a[i];
+ DenseBlock a = getDenseBlock();
+ DenseBlock c = ret.allocateDenseBlock().getDenseBlock();
+ for( int bi=0; bi<a.numBlocks(); bi++ ) {
+ int len = a.blockSize(bi);
+ double[] avals = a.valuesAt(bi);
+ double[] cvals = c.valuesAt(bi);
+ for( int i=0; i<len; i++ ) {
+ cvals[i] = (avals[i]== pattern
+ || (NaNpattern && Double.isNaN(avals[i]))) ?
+ replacement : avals[i];
+ }
}
}
ret.recomputeNonZeros();
ret.examSparsity();
-
return ret;
}
[systemds] 01/02: [MINOR] Mark additional unary ops for multi-threaded operations
Posted by mb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mboehm7 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git
commit 89720cc90aab994ac2ff11d213a324b22d2b1498
Author: Matthias Boehm <mb...@gmail.com>
AuthorDate: Sun Aug 7 15:22:38 2022 +0200
[MINOR] Mark additional unary ops for multi-threaded operations
This patch adds a few missing operations so the compiler generates
multi-threaded unary operations. On 10M x 1K (80GB) round operations
this improved local performance substantially by more than 50s.
---
src/main/java/org/apache/sysds/hops/UnaryOp.java | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/main/java/org/apache/sysds/hops/UnaryOp.java b/src/main/java/org/apache/sysds/hops/UnaryOp.java
index 38a20fffc0..430c181552 100644
--- a/src/main/java/org/apache/sysds/hops/UnaryOp.java
+++ b/src/main/java/org/apache/sysds/hops/UnaryOp.java
@@ -173,8 +173,8 @@ public class UnaryOp extends MultiThreadedHop
final boolean inplace = OptimizerUtils.ALLOW_UNARY_UPDATE_IN_PLACE &&
input.getParent().size() == 1 && (!(input instanceof DataOp) || !((DataOp) input).isRead());
- k = isCumulativeUnaryOperation() || isExpensiveUnaryOperation() ? OptimizerUtils
- .getConstrainedNumThreads(_maxNumThreads) : 1;
+ k = isCumulativeUnaryOperation() || isExpensiveUnaryOperation() ?
+ OptimizerUtils.getConstrainedNumThreads(_maxNumThreads) : 1;
ret = new Unary(input.constructLops(), _op, getDataType(), getValueType(), et, k, inplace);
}
}
@@ -450,14 +450,13 @@ public class UnaryOp extends MultiThreadedHop
|| _op == OpOp1.CAST_AS_INT);
}
- public boolean isExpensiveUnaryOperation() {
- return (_op == OpOp1.EXP
- || _op == OpOp1.LOG
- || _op == OpOp1.SIGMOID
- || _op == OpOp1.COMPRESS
- || _op == OpOp1.DECOMPRESS
- || _op == OpOp1.MEDIAN
- || _op == OpOp1.IQM);
+ public boolean isExpensiveUnaryOperation() {
+ return (_op == OpOp1.EXP || _op == OpOp1.LOG
+ || _op == OpOp1.ROUND || _op == OpOp1.FLOOR || _op == OpOp1.CEIL
+ || _op == OpOp1.SIGMOID || _op == OpOp1.SPROP || _op == OpOp1.SOFTMAX
+ || _op == OpOp1.TAN || _op == OpOp1.TANH || _op == OpOp1.ATAN
+ || _op == OpOp1.COMPRESS || _op == OpOp1.DECOMPRESS
+ || _op == OpOp1.MEDIAN || _op == OpOp1.IQM);
}
public boolean isMetadataOperation() {