Skip to content

Commit 54fcbe2

Browse files
committed
create new test cases
1 parent 3f69d53 commit 54fcbe2

6 files changed

Lines changed: 119 additions & 10 deletions

File tree

src/test/java/org/apache/sysds/performance/primitives/ExpressionTest.java

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,43 @@ public class ExpressionTest {
2323
private static final String TEST_NAME = "expression";
2424
private static final String TEST_NAME1 = TEST_NAME+"1";
2525
private static final String TEST_NAME2 = TEST_NAME+"2";
26+
private static final String TEST_NAME3 = TEST_NAME+"3";
27+
private static final String TEST_NAME4 = TEST_NAME+"4";
28+
private static final String TEST_NAME5 = TEST_NAME+"5";
2629

2730
private static final String TEST_DIR = "./src/test/scripts/performance/primitives/";
2831

2932
private final static double sparsity1 = 0.9;
3033
private final static double sparsity2 = 0.1;
3134
private final static double eps = 1e-8;
32-
private int rows = 2000;
33-
private int cols = 10000;
34-
double[] sparsities = new double[] {1, 0.3333333, 0.1111111, 0.0333333, 0.0111111, 0.0033333, 0.0011111, 0.0003333, 0.0001111, 0.0000333, 0.0000111, 0.0000033, 0.0000011, 0.0000003, 0.0000001};
35-
int warmupRuns = 100;
36-
int repetitions = 2500;
35+
private int rows = 100;
36+
private int cols = 100;
37+
// double[] sparsities = new double[] {1, 0.3333333, 0.1111111, 0.0333333, 0.0111111, 0.0033333, 0.0011111, 0.0003333, 0.0001111, 0.0000333, 0.0000111, 0.0000033, 0.0000011, 0.0000003, 0.0000001};
38+
double[] sparsities = new double[] {0.01, 0.3333};
39+
int warmupRuns = 10;
40+
int repetitions = 10;
3741

3842
public static void main(String[] args) {
43+
System.out.println("First------------------------------------------------");
44+
new ExpressionTest().runSparseBenchmark(TEST_NAME1);
45+
System.out.println("Second------------------------------------------------");
46+
new ExpressionTest().runSparseBenchmark(TEST_NAME2);
47+
System.out.println("Third------------------------------------------------");
48+
new ExpressionTest().runSparseBenchmark(TEST_NAME3);
49+
System.out.println("Fourth------------------------------------------------");
50+
new ExpressionTest().runSparseBenchmark(TEST_NAME4);
51+
System.out.println("Fifth------------------------------------------------");
52+
new ExpressionTest().runSparseBenchmark(TEST_NAME5);
53+
// System.out.println("First------------------------------------------------");
3954
// new ExpressionTest().runSparseBenchmark(TEST_NAME1);
40-
new ExpressionTest().runDenseBenchmark(TEST_NAME1);
55+
// System.out.println("Second------------------------------------------------");
56+
// new ExpressionTest().runSparseBenchmark(TEST_NAME2);
57+
// System.out.println("Third------------------------------------------------");
58+
// new ExpressionTest().runSparseBenchmark(TEST_NAME3);
59+
// System.out.println("Fourth------------------------------------------------");
60+
// new ExpressionTest().runSparseBenchmark(TEST_NAME4);
61+
// System.out.println("Fifth------------------------------------------------");
62+
// new ExpressionTest().runSparseBenchmark(TEST_NAME5);
4163
}
4264

4365
public void runSparseBenchmark(String testname) {
@@ -92,12 +114,12 @@ private String[] runPerfTest(String testname, boolean sparseRowVec, Types.ExecTy
92114
}
93115

94116
DMLScript.SPARSE_INTERMEDIATE = oldSparse;
95-
conn.close();
96117
}
97118
catch(IOException e) {
98119
throw new RuntimeException(e);
99120
}
100121
finally {
122+
conn.close();
101123
OptimizerUtils.ALLOW_AUTO_VECTORIZATION = true;
102124
OptimizerUtils.ALLOW_OPERATOR_FUSION = true;
103125
}

src/test/scripts/performance/primitives/expression1.dml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
A = read($1);
2323
B = read($2);
2424
v = read($3);
25-
while(FALSE) { }
2625

27-
S = B*rowMaxs(A*v)
26+
# S = B*rowMaxs(A*v)
27+
S = (A*v)/rowSums(A*v)
2828

2929
write(S, $4);
3030

src/test/scripts/performance/primitives/expression2.dml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121

2222
A = read($1);
2323
B = read($2);
24+
v = read($3)
2425

25-
S = (A!=0) * (B-A)
26+
# S = (A!=0) * (B-A)
27+
S = (A/v)+rowMeans(A-v)
2628

2729
write(S, $4);
2830

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#-------------------------------------------------------------
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
#-------------------------------------------------------------
21+
22+
A = read($1);
23+
24+
S = as.matrix(sum(rowMins(A)))
25+
26+
write(S, $4);
27+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#-------------------------------------------------------------
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
#-------------------------------------------------------------
21+
22+
A = read($1);
23+
B = read($2);
24+
v = read($3)
25+
26+
S = colSums(A / rowSums(B*v))
27+
28+
write(S, $4);
29+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#-------------------------------------------------------------
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
#-------------------------------------------------------------
21+
22+
A = read($1);
23+
B = read($2);
24+
v = read($3)
25+
26+
S = B + (A <= rowMins(A))
27+
28+
write(S, $4);
29+

0 commit comments

Comments
 (0)