You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemml.apache.org by mb...@apache.org on 2015/11/25 18:51:24 UTC
[1/4] incubator-systemml git commit: Fix matrix block
boolean/int/double vector converter utils (sparse)
Repository: incubator-systemml
Updated Branches:
refs/heads/master ff0bdad64 -> 52ec04aff
Fix matrix block boolean/int/double vector converter utils (sparse)
Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/16633032
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/16633032
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/16633032
Branch: refs/heads/master
Commit: 16633032194ff5704cf192ad9423547a5d4b9033
Parents: ff0bdad
Author: Matthias Boehm <mb...@us.ibm.com>
Authored: Tue Nov 24 19:11:15 2015 -0800
Committer: Matthias Boehm <mb...@us.ibm.com>
Committed: Tue Nov 24 19:11:15 2015 -0800
----------------------------------------------------------------------
.../ibm/bi/dml/runtime/util/DataConverter.java | 25 ++++++++------------
1 file changed, 10 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/16633032/src/main/java/com/ibm/bi/dml/runtime/util/DataConverter.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/ibm/bi/dml/runtime/util/DataConverter.java b/src/main/java/com/ibm/bi/dml/runtime/util/DataConverter.java
index 2be9a77..c9d4d91 100644
--- a/src/main/java/com/ibm/bi/dml/runtime/util/DataConverter.java
+++ b/src/main/java/com/ibm/bi/dml/runtime/util/DataConverter.java
@@ -353,17 +353,14 @@ public class DataConverter
while( iter.hasNext() )
{
IJV cell = iter.next();
- ret[cell.i*rows+cell.j] = (cell.v != 0.0);
+ ret[cell.i*cols+cell.j] = (cell.v != 0.0);
}
}
else
{
- if( !mb.isEmptyBlock(false) )
- {
- for( int i=0; i<rows; i++ )
- for( int j=0; j<cols; j++ )
- ret[i*cols+j] = (mb.getValueDenseUnsafe(i, j) != 0.0);
- }
+ for( int i=0, cix=0; i<rows; i++ )
+ for( int j=0; j<cols; j++, cix++)
+ ret[cix] = (mb.getValueDenseUnsafe(i, j) != 0.0);
}
}
@@ -391,16 +388,15 @@ public class DataConverter
while( iter.hasNext() )
{
IJV cell = iter.next();
- ret[cell.i*rows+cell.j] = (int)cell.v;
+ ret[cell.i*cols+cell.j] = (int)cell.v;
}
}
else
{
//memcopy row major representation if at least 1 non-zero
- if( !mb.isEmptyBlock(false) )
- for( int i=0; i<rows; i++ )
- for( int j=0; j<cols; j++ )
- ret[i*cols+j] = (int)(mb.getValueDenseUnsafe(i, j));
+ for( int i=0, cix=0; i<rows; i++ )
+ for( int j=0; j<cols; j++, cix++ )
+ ret[cix] = (int)(mb.getValueDenseUnsafe(i, j));
}
}
@@ -426,14 +422,13 @@ public class DataConverter
while( iter.hasNext() )
{
IJV cell = iter.next();
- ret[cell.i*rows+cell.j] = cell.v;
+ ret[cell.i*cols+cell.j] = cell.v;
}
}
else
{
//memcopy row major representation if at least 1 non-zero
- if( !mb.isEmptyBlock(false) )
- System.arraycopy(mb.getDenseArray(), 0, ret, 0, rows*cols);
+ System.arraycopy(mb.getDenseArray(), 0, ret, 0, rows*cols);
}
}
[3/4] incubator-systemml git commit: Fix memory estimate correction
tsmm (output mem instead of op mem)
Posted by mb...@apache.org.
Fix memory estimate correction tsmm (output mem instead of op mem)
Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/d16968e5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/d16968e5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/d16968e5
Branch: refs/heads/master
Commit: d16968e567f91882d1fa332736fd7fb56883cf64
Parents: 3631f23
Author: Matthias Boehm <mb...@us.ibm.com>
Authored: Tue Nov 24 21:53:27 2015 -0800
Committer: Matthias Boehm <mb...@us.ibm.com>
Committed: Tue Nov 24 21:53:27 2015 -0800
----------------------------------------------------------------------
src/main/java/com/ibm/bi/dml/hops/AggBinaryOp.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/d16968e5/src/main/java/com/ibm/bi/dml/hops/AggBinaryOp.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/ibm/bi/dml/hops/AggBinaryOp.java b/src/main/java/com/ibm/bi/dml/hops/AggBinaryOp.java
index 720befa..005744f 100644
--- a/src/main/java/com/ibm/bi/dml/hops/AggBinaryOp.java
+++ b/src/main/java/com/ibm/bi/dml/hops/AggBinaryOp.java
@@ -304,9 +304,12 @@ public class AggBinaryOp extends Hop implements MultiThreadedHop
//tsmm left is guaranteed to require only X but not t(X), while
//tsmm right might have additional requirements to transpose X if sparse
+ //NOTE: as a heuristic this correction is only applied if not a column vector because
+ //most other vector operations require memory for at least two vectors (we aim for
+ //consistency in order to prevent anomalies in parfor opt leading to small degree of par)
MMTSJType mmtsj = checkTransposeSelf();
- if( mmtsj.isLeft() && getInput().get(0).dimsKnown() ){
- _memEstimate = _memEstimate - getInput().get(1)._memEstimate;
+ if( mmtsj.isLeft() && getInput().get(1).dimsKnown() && getInput().get(1).getDim2()>1 ) {
+ _memEstimate = _memEstimate - getInput().get(0)._outputMemEstimate;
}
}
[4/4] incubator-systemml git commit: Fix parfor rewrite 'inject rdd
repartitioning' (awareness of transpose)
Posted by mb...@apache.org.
Fix parfor rewrite 'inject rdd repartitioning' (awareness of transpose)
Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/52ec04af
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/52ec04af
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/52ec04af
Branch: refs/heads/master
Commit: 52ec04aff0a841265b50302ee24e0a5af713d9d2
Parents: d16968e
Author: Matthias Boehm <mb...@us.ibm.com>
Authored: Tue Nov 24 22:25:53 2015 -0800
Committer: Matthias Boehm <mb...@us.ibm.com>
Committed: Tue Nov 24 22:25:53 2015 -0800
----------------------------------------------------------------------
.../parfor/opt/OptimizerRuleBased.java | 21 +++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/52ec04af/src/main/java/com/ibm/bi/dml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/ibm/bi/dml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java b/src/main/java/com/ibm/bi/dml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java
index b1d2622..ae581e6 100644
--- a/src/main/java/com/ibm/bi/dml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java
+++ b/src/main/java/com/ibm/bi/dml/runtime/controlprogram/parfor/opt/OptimizerRuleBased.java
@@ -2242,15 +2242,22 @@ public class OptimizerRuleBased extends Optimizer
private void rCollectZipmmPartitioningCandidates( OptNode n, HashSet<String> cand )
{
//collect zipmm inputs
- if( n.getNodeType()==NodeType.HOP ) {
+ if( n.getNodeType()==NodeType.HOP )
+ {
Hop h = OptTreeConverter.getAbstractPlanMapping().getMappedHop(n.getID());
if( h instanceof AggBinaryOp && (((AggBinaryOp)h).getMMultMethod()==MMultMethod.ZIPMM
- ||((AggBinaryOp)h).getMMultMethod()==MMultMethod.CPMM) ){
-
- if( h.getInput().get(0) instanceof DataOp )
- cand.add( h.getInput().get(0).getName() );
- if( h.getInput().get(1) instanceof DataOp )
- cand.add( h.getInput().get(1).getName() );
+ ||((AggBinaryOp)h).getMMultMethod()==MMultMethod.CPMM) )
+ {
+ //found zipmm or cpmm (unknowns) which might turn into zipmm
+ //check for dataop or dataops under transpose on both sides
+ for( Hop in : h.getInput() ) {
+ if( in instanceof DataOp )
+ cand.add( in.getName() );
+ else if( in instanceof ReorgOp
+ && ((ReorgOp)in).getOp()==ReOrgOp.TRANSPOSE
+ && in.getInput().get(0) instanceof DataOp )
+ cand.add( in.getInput().get(0).getName() );
+ }
}
}
[2/4] incubator-systemml git commit: Fix remove empty columns w/
selection vector (awareness of sel flags)
Posted by mb...@apache.org.
Fix remove empty columns w/ selection vector (awareness of sel flags)
Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/3631f23e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/3631f23e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/3631f23e
Branch: refs/heads/master
Commit: 3631f23e6ce1711df3a2eb0732438cdcc999f2bc
Parents: 1663303
Author: Matthias Boehm <mb...@us.ibm.com>
Authored: Tue Nov 24 20:27:40 2015 -0800
Committer: Matthias Boehm <mb...@us.ibm.com>
Committed: Tue Nov 24 20:27:40 2015 -0800
----------------------------------------------------------------------
.../dml/runtime/matrix/data/LibMatrixReorg.java | 27 ++++++++++++--------
1 file changed, 16 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/3631f23e/src/main/java/com/ibm/bi/dml/runtime/matrix/data/LibMatrixReorg.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/ibm/bi/dml/runtime/matrix/data/LibMatrixReorg.java b/src/main/java/com/ibm/bi/dml/runtime/matrix/data/LibMatrixReorg.java
index 6d8d924..31fe405 100644
--- a/src/main/java/com/ibm/bi/dml/runtime/matrix/data/LibMatrixReorg.java
+++ b/src/main/java/com/ibm/bi/dml/runtime/matrix/data/LibMatrixReorg.java
@@ -1669,8 +1669,8 @@ public class LibMatrixReorg
boolean[] flags = null;
int rlen2 = 0;
- if(select == null) {
-
+ if(select == null)
+ {
flags = new boolean[ m ]; //false
//Step 1: scan block and determine non-empty rows
@@ -1699,12 +1699,12 @@ public class LibMatrixReorg
}
}
}
- } else {
+ }
+ else {
flags = DataConverter.convertToBooleanVector(select);
rlen2 = (int)select.getNonZeros();
}
-
//Step 2: reset result and copy rows
//dense stays dense if correct input representation (but robust for any input),
//sparse might be dense/sparse
@@ -1770,7 +1770,8 @@ public class LibMatrixReorg
//(we optimized for cache-friendly behavior and hence don't do early abort)
boolean[] flags = null;
- if (select == null) {
+ if (select == null)
+ {
flags = new boolean[ n ]; //false
if( in.sparse ) //SPARSE
{
@@ -1793,21 +1794,24 @@ public class LibMatrixReorg
if( a[aix] != 0 )
flags[j] = true;
}
- } else {
+ }
+ else {
flags = DataConverter.convertToBooleanVector(select);
}
//Step 2: determine number of columns
int clen2 = 0;
- for( int j=0; j<n; j++ )
+ for( int j=0; j<n; j++ ) {
clen2 += flags[j] ? 1 : 0;
+ }
//Step 3: create mapping of flags to target indexes
int[] cix = new int[n];
- for( int j=0, pos=0; j<n; j++ )
+ for( int j=0, pos=0; j<n; j++ ) {
if( flags[j] )
cix[j] = pos++;
+ }
//Step 3: reset result and copy cols
//dense stays dense if correct input representation (but robust for any input),
@@ -1827,7 +1831,8 @@ public class LibMatrixReorg
int[] aix = a[i].getIndexContainer();
double[] avals = a[i].getValueContainer();
for( int j=0; j<alen; j++ )
- ret.appendValue(i, cix[aix[j]], avals[j]);
+ if( flags[aix[j]] )
+ ret.appendValue(i, cix[aix[j]], avals[j]);
}
}
else if( !in.sparse && !ret.sparse ) //DENSE <- DENSE
@@ -1838,7 +1843,7 @@ public class LibMatrixReorg
for(int i=0, aix=0, lcix=0; i<m; i++, lcix+=clen2)
for(int j=0; j<n; j++, aix++)
- if( a[aix] != 0 )
+ if( flags[j] )
c[ lcix+cix[j] ] = a[aix];
}
else //SPARSE <- DENSE
@@ -1848,7 +1853,7 @@ public class LibMatrixReorg
for(int i=0, aix=0; i<m; i++)
for(int j=0; j<n; j++, aix++)
- if( a[aix] != 0 )
+ if( flags[j] && a[aix]!=0 )
ret.appendValue(i, cix[j], a[aix]);
}