Skip to content

Commit

Permalink
Run 10 ... vector
Browse files Browse the repository at this point in the history
  • Loading branch information
Baunsgaard committed Aug 1, 2023
1 parent 5e47778 commit fd21b91
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 27 deletions.
34 changes: 26 additions & 8 deletions src/test/java/org/apache/sysds/performance/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,37 @@ private static void exec(int prog, String[] args) throws InterruptedException, E
break;
case 8:
new WriteTest(100, new ConstMatrix(1000, 1000, 32, 1.0)).run();
case 9:
int rows = Integer.parseInt(args[1]);
int cols = Integer.parseInt(args[2]);
int unique = Integer.parseInt(args[3]);
double sparsity = Double.parseDouble(args[4]);
int k = Integer.parseInt(args[5]);
int n = Integer.parseInt(args[6]);
new WriteTest(n, new ConstMatrix(rows, cols, unique, sparsity), k).run();
break;
case 9:
run9(args);
case 10:
run10(args);
break;
default:
break;
}
}

private static void run9(String[] args) throws InterruptedException, Exception {
int rows = Integer.parseInt(args[1]);
int cols = Integer.parseInt(args[2]);
int unique = Integer.parseInt(args[3]);
double sparsity = Double.parseDouble(args[4]);
int k = Integer.parseInt(args[5]);
int n = Integer.parseInt(args[6]);
new WriteTest(n, new ConstMatrix(rows, cols, unique, sparsity), k).run();
}

private static void run10(String[] args) throws InterruptedException, Exception {
int rows = Integer.parseInt(args[1]);
int cols = Integer.parseInt(args[2]);
int unique = Integer.parseInt(args[3]);
double sparsity = Double.parseDouble(args[4]);
int k = Integer.parseInt(args[5]);
int n = Integer.parseInt(args[6]);
new WriteTest(n, new ConstMatrix(rows, cols, unique, sparsity), k).runVector();
}

public static void main(String[] args) {
try {
exec(Integer.parseInt(args[0]), args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void run() throws Exception, InterruptedException {
execute(() -> sumTask(k), "Sum");
final MatrixBlock v = genVector();
execute(() -> matrixVector(v, k), "MV mult");

final CompressionScheme sch2 = CLALibScheme.getScheme(getC());
execute(() -> updateAndApplyScheme(sch2, k), "Update&Apply Scheme");
execute(() -> updateAndApplySchemeFused(sch2, k), "Update&Apply Scheme Fused");
Expand All @@ -60,6 +60,12 @@ public void run() throws Exception, InterruptedException {

}

public void runVector() throws Exception, InterruptedException {
System.out.println(this);
final MatrixBlock v = genVector();
execute(() -> matrixVector(v, k), "MV mult");
}

private void matrixVector(MatrixBlock v, int k) {
MatrixBlock mb = gen.take();
long in = mb.getInMemorySize();
Expand Down Expand Up @@ -143,14 +149,13 @@ protected String makeResString(double[] times) {
double totalTime = 0.0;
for(int i = 0; i < ret.size(); i++) // set times
ret.get(i).time = times[i] / 1000; // ms to sec

ret.sort(WriteTest::compare);

final int l = ret.size();
final int remove = (int)Math.floor((double)l * 0.05);

final int el = l - remove *2;
final int remove = (int) Math.floor((double) l * 0.05);

final int el = l - remove * 2;

for(int i = remove; i < ret.size() - remove; i++) {
InOut e = ret.get(i);
Expand All @@ -170,7 +175,7 @@ protected String makeResString(double[] times) {
for(int i = remove; i < ret.size() - remove; i++) {
InOut e = ret.get(i);
varIn += Math.pow(e.in / e.time - bytePerMsIn, 2);
varOut += Math.pow(e.out /e.time - bytePerMsOut, 2);
varOut += Math.pow(e.out / e.time - bytePerMsOut, 2);
}

double stdIn = Math.sqrt(varIn / el);
Expand All @@ -180,19 +185,19 @@ protected String makeResString(double[] times) {
}

// protected String changeValue(double bytePerMs) {
// // double bytePerSec = bytePerMs * 1000;
// if(bytePerSec > 1000000000) {
// return String.format("%6.2f GB/s", bytePerSec / 1024 / 1024 / 1024);
// }
// else if(bytePerSec > 1000000) {
// return String.format("%6.2f MB/s", bytePerSec / 1024 / 1024);
// }
// else if(bytePerSec > 1000) {
// return String.format("%6.2f KB/s", bytePerSec / 1024);
// }
// else {
// return String.format("%6.2f B/s", bytePerSec);
// }
// // double bytePerSec = bytePerMs * 1000;
// if(bytePerSec > 1000000000) {
// return String.format("%6.2f GB/s", bytePerSec / 1024 / 1024 / 1024);
// }
// else if(bytePerSec > 1000000) {
// return String.format("%6.2f MB/s", bytePerSec / 1024 / 1024);
// }
// else if(bytePerSec > 1000) {
// return String.format("%6.2f KB/s", bytePerSec / 1024);
// }
// else {
// return String.format("%6.2f B/s", bytePerSec);
// }
// }

public static int compare(InOut a, InOut b) {
Expand All @@ -204,6 +209,11 @@ else if(a.time < b.time)
return 1;
}

@Override
public String toString() {
return super.toString() + " threads: " + k;
}

protected class InOut {
protected long in;
protected long out;
Expand All @@ -215,4 +225,5 @@ protected InOut(long in, long out) {
}

}

}

0 comments on commit fd21b91

Please sign in to comment.