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 2016/03/20 11:38:06 UTC
[2/3] incubator-systemml git commit: Performance core matrixmult
library (load balancing multi-threaded exec)
Performance core matrixmult library (load balancing multi-threaded exec)
So far we used static load balancing (task partitioning) in order to
reduce scheduling overheads. However, we've seen for both io-bound
matrix-vector and compute-bound matrix-matrix imbalance issues of up to
25%. We now used fixed task partitioning with a number of tasks of
Math.max(Math.min(8*k,ru/8), k). For example on 16GB matrix-vector
multiplications, this improved runtimes from 710ms-770ms to 675ms-685ms
after JIT, i.e., roughly 10% improvement and lower variance.
Compute-intensive use cases showed similar improvements.
Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/e6df6982
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/e6df6982
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/e6df6982
Branch: refs/heads/master
Commit: e6df6982b0472bc2d82ef0d5b8d9b35f501d7d03
Parents: 9228811
Author: Matthias Boehm <mb...@us.ibm.com>
Authored: Sun Mar 20 02:50:19 2016 -0700
Committer: Matthias Boehm <mb...@us.ibm.com>
Committed: Sun Mar 20 02:50:19 2016 -0700
----------------------------------------------------------------------
.../org/apache/sysml/runtime/matrix/data/LibMatrixMult.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/e6df6982/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java b/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java
index 583460b..004fc77 100644
--- a/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java
+++ b/src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixMult.java
@@ -185,8 +185,9 @@ public class LibMatrixMult
try {
ExecutorService pool = Executors.newFixedThreadPool( k );
ArrayList<MatrixMultTask> tasks = new ArrayList<MatrixMultTask>();
- int blklen = (int)(Math.ceil((double)ru/k));
- for( int i=0; i<k & i*blklen<ru; i++ )
+ int nk = pm2 ? k : Math.max(Math.min(8*k,ru/8), k);
+ int blklen = (int)(Math.ceil((double)ru/nk));
+ for( int i=0; i<nk & i*blklen<ru; i++ )
tasks.add(new MatrixMultTask(m1, m2, ret, tm2, pm2, i*blklen, Math.min((i+1)*blklen, ru)));
//execute tasks
List<Future<Object>> taskret = pool.invokeAll(tasks);