-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYSTEMDS-3832] MatrixBlock Append performance
This commit contains a new performance measuring script for appending matrices. See the PR for performance details Closes #2223
- Loading branch information
1 parent
52ca491
commit a06ea0f
Showing
6 changed files
with
210 additions
and
43 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
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
86 changes: 86 additions & 0 deletions
86
src/test/java/org/apache/sysds/performance/matrix/MatrixAppend.java
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 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.apache.sysds.performance.matrix; | ||
|
||
import org.apache.sysds.performance.TimingUtils.StatsType; | ||
import org.apache.sysds.performance.compression.APerfTest; | ||
import org.apache.sysds.performance.generators.ConstMatrix; | ||
import org.apache.sysds.performance.generators.GenMatrices; | ||
import org.apache.sysds.performance.generators.IGenerate; | ||
import org.apache.sysds.runtime.matrix.data.MatrixBlock; | ||
|
||
public class MatrixAppend extends APerfTest<Object, MatrixBlock> { | ||
|
||
final boolean cbind; | ||
|
||
final MatrixBlock base; | ||
final MatrixBlock[] others; | ||
final int n; | ||
|
||
public MatrixAppend(int N, int n, IGenerate<MatrixBlock> gen, boolean cbind) { | ||
super(N, 0, new ConstMatrix(gen.take()), StatsType.MEAN_STD_Q1); | ||
this.cbind = cbind; | ||
this.n = n; | ||
base = gen.take(); | ||
|
||
others = new MatrixBlock[n]; | ||
for(int i = 0; i < n; i++) { | ||
others[i] = gen.take(); | ||
} | ||
|
||
} | ||
|
||
public void run() throws Exception { | ||
|
||
execute(() -> append(base, others), // | ||
String.format("appending: rows:%5d cols:%5d sp:%3.1f Blocks:%4d rep:%6d ", // | ||
base.getNumRows(), base.getNumColumns(), base.getSparsity(), n, N)); | ||
|
||
} | ||
|
||
private void append(MatrixBlock a, MatrixBlock[] others) { | ||
a.append(others, null, cbind); | ||
} | ||
|
||
@Override | ||
protected String makeResString() { | ||
return ""; | ||
} | ||
|
||
public static void main(String[] args) throws Exception { | ||
IGenerate<MatrixBlock> in; | ||
int nBlocks; | ||
int nRepeats; | ||
if(args.length == 0) { | ||
in = new GenMatrices(1000, 10, 10, 1.0); | ||
nBlocks = 10; | ||
nRepeats = 100; | ||
} | ||
else { | ||
in = new GenMatrices(Integer.parseInt(args[1]), Integer.parseInt(args[2]), 10, Double.parseDouble(args[3])); | ||
nBlocks = Integer.parseInt(args[4]); | ||
nRepeats = Integer.parseInt(args[5]); | ||
} | ||
in.generate(nBlocks + 2); | ||
|
||
new MatrixAppend(nRepeats, nBlocks, in, false).run(); | ||
} | ||
|
||
} |
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,43 @@ | ||
#!/usr/bin/env bash | ||
#------------------------------------------------------------- | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
#------------------------------------------------------------- | ||
|
||
mvn package > /dev/null | ||
java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 100 100 1.0 1 30000 | ||
java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 1000 100 1.0 1 3000 | ||
java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 1000 1000 1.0 1 3000 | ||
java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 100 100 0.3 1 30000 | ||
java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 1000 100 0.3 1 3000 | ||
java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 1000 1000 0.3 1 3000 | ||
|
||
# java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 100 100 1.0 10 30000 | ||
# java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 1000 100 1.0 10 3000 | ||
# java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 1000 1000 1.0 10 1000 | ||
# java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 100 100 0.3 10 30000 | ||
# java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 1000 100 0.3 10 3000 | ||
# java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 1000 1000 0.3 10 1000 | ||
|
||
# java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 100 100 1.0 100 3000 | ||
# java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 1000 100 1.0 100 300 | ||
# java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 1000 1000 1.0 100 200 | ||
# java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 100 100 0.3 100 3000 | ||
# java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 1000 100 0.3 100 2000 | ||
# java -jar -XX:+UseNUMA target/systemds-3.3.0-SNAPSHOT-perf.jar 1008 1000 1000 0.3 100 1000 |