--- /dev/null
+public class Banking extends Thread {
+ Account myacc;
+ public Banking(Account myacc) {
+ this.myacc = myacc;
+ }
+
+ public void run() {
+ for(int i = 0; i < 10000; i++) {
+ myacc
+
+
+
+
+ }
+
+ public static void main(String[] args) {
+ Banking[] b;
+ int[] mid = new int[2];
+ mid[0] = (128<<24)|(195<<16)|(175<<8)|79; //dw-8
+ mid[1] = (128<<24)|(195<<16)|(175<<8)|73; //dw-5
+ atomic {
+ b = global new Banking[2];
+ for(int i = 0; i < 2; i++) {
+ b[i] = global new Banking();
+ b[i].myacc = global new Account(i);
+ }
+ }
+
+ Banking tmp;
+ for(int i = 0; i < 2; i++) {
+ atomic {
+ tmp = b[i];
+ }
+ tmp.start(mid[i]);
+ }
+
+ for(int i = 0; i < 2; i++) {
+ atomic {
+ tmp = b[i];
+ }
+ tmp.join();
+ }
+ }
+}
+
+class Account {
+ int custid;
+ int balance;
+
+ public Account(int custid) {
+ this.custid = custid;
+ this.balance = 0;
+ }
+
+ public void deposit(int amt) {
+ balance += amt;
+ }
+
+ public void withdraw(int amt) {
+ if(amt > balance) {
+ System.printString("Amount is greater than balance\n");
+ } else {
+ balance -= amt;
+ }
+ }
+}
--- /dev/null
+/*************************************************************************
+* Compilation: javac Cell.java
+* Execution: java Cell
+*
+*
+*************************************************************************/
+
+public class Cell {
+ private boolean spin; // up (true) or down (false)
+
+ public Cell(boolean spin) {
+ this.spin = spin;
+ }
+
+ // random spin - up with probability p
+ public Cell(double p) {
+ spin = (Math.random() < p);
+ }
+
+ // flip the spin
+ public void flip() { spin = !spin; }
+
+ // +1 if up, -1 if down
+ public double magnetization() {
+ if (spin) return +1.0;
+ else return -1.0;
+ }
+
+ // draw cell according to value of spin
+ public void draw(double x, double y) {
+ /*
+ if (spin) StdDraw.setPenColor(StdDraw.WHITE);
+ else StdDraw.setPenColor(StdDraw.BLUE);
+ StdDraw.filledSquare(x, y, 1);
+ */
+ }
+
+ // string representation
+ public String toString() {
+ if (spin) return "+";
+ else return "-";
+ }
+
+
+
+ public static void main(String[] args) {
+ }
+}
--- /dev/null
+public class Metropolis {
+ public static void main(String[] args) {
+ int N = Integer.parseInt(args[0]);
+ double kT = Double.parseDouble(args[1]);
+ StdDraw.setXscale(0, N);
+ StdDraw.setYscale(0, N);
+ State state = new State(N, 0.5);
+ while (true) {
+ state.phase(kT);
+ state.draw();
+ StdDraw.show(50);
+ }
+ }
+}
--- /dev/null
+public class ReadArrayObj extends Thread {
+ int id, nthreads;
+ ReadArrayObj[] myra;
+ int val;
+
+ public ReadArrayObj() {
+ }
+
+ public ReadArrayObj(int id, int nthreads, ReadArrayObj[] ra) {
+ this.id = id;
+ this.nthreads = nthreads;
+ myra = ra;
+ }
+
+ public void run() {
+ int tmpid;
+ Barrier barr;
+ barr = new Barrier("128.195.175.84");
+ //Create array objects locally
+ atomic {
+ tmpid = id;
+ myra[tmpid] = global new ReadArrayObj();
+ myra[tmpid].val = tmpid*10+1;
+ }
+
+ Barrier.enterBarrier(barr);
+
+ /*
+ //All machines reading data from array
+ int val;
+ for(int i=0; i<10000; i++) {
+ atomic {
+ for(int j=0; j<nthreads; j++) {
+ val = myra[j].val;
+ }
+ }
+ }
+ */
+ }
+
+ public static void main(String[] args) {
+ int nthreads;
+ BarrierServer mybarr;
+ if(args.length>0) {
+ nthreads = Integer.parseInt(args[0]);
+ }
+
+ int[] mid = new int[5];
+ mid[0] = (128<<24)|(195<<16)|(175<<8)|84;//dw-10
+ mid[1] = (128<<24)|(195<<16)|(175<<8)|85;//dw-11
+ mid[2] = (128<<24)|(195<<16)|(175<<8)|86;//dw-12
+ mid[3] = (128<<24)|(195<<16)|(175<<8)|87;//dw-13
+ mid[4] = (128<<24)|(195<<16)|(175<<8)|88;//dw-14
+
+ ReadArrayObj[] a;
+ atomic {
+ a=global new ReadArrayObj[nthreads]; //create object a
+ mybarr = global new BarrierServer(nthreads);
+ }
+
+ mybarr.start(mid[0]);
+
+ ReadArrayObjWrap[] ra = new ReadArrayObjWrap[nthreads];
+
+ atomic {
+ for(int i=0;i<nthreads; i++) {
+ ra[i] = new ReadArrayObjWrap(global new ReadArrayObj(i, nthreads, a));
+ }
+ }
+
+ boolean waitfordone=true;
+ while(waitfordone) {
+ atomic { //Master aborts are from here
+ if (mybarr.done)
+ waitfordone=false;
+ }
+ }
+
+ for(int i =0; i<nthreads; i++)
+ ra[i].ra.start(mid[i]);
+
+ for(int i =0; i<nthreads; i++)
+ ra[i].ra.join();
+
+ System.printString("Finished\n");
+ }
+}
--- /dev/null
+public class WriteArrayObj extends Thread {
+ WriteArrayObj[] mywa;
+ int nthreads;
+ int val, lower, start;
+
+ public WriteArrayObj() {
+ }
+
+ public WriteArrayObj(int lower, WriteArrayObj[] wa, int nthreads, int start) {
+ this.lower = lower;
+ mywa = wa;
+ this.nthreads = nthreads;
+ this.start = start;
+ }
+
+ public void run() {
+ Barrier barr;
+ barr = new Barrier("128.195.175.84");
+ //Create array objects locally
+ atomic { //Remote machine aborts come from here
+ for(int i=lower; i<nthreads*nthreads; i=i+nthreads) {
+ mywa[i] = global new WriteArrayObj();
+ }
+ }
+
+ Barrier.enterBarrier(barr);
+/*
+ //Write into array elements
+ Integer val;
+ for(int j=0; j<10000; j++) {
+ atomic {
+ val = global new Integer(10);
+ for(int i=start;i<start+nthreads; i++) {
+ mywa[i].val = val.intValue();
+ }
+ }
+ }
+ */
+ }
+
+ public static void main(String[] args) {
+ int nthreads;
+ BarrierServer mybarr;
+ if(args.length>0) {
+ nthreads = Integer.parseInt(args[0]);
+ }
+
+ int[] mid = new int[5];
+ mid[0] = (128<<24)|(195<<16)|(175<<8)|84;//dw-10
+ mid[1] = (128<<24)|(195<<16)|(175<<8)|85;//dw-11
+ mid[2] = (128<<24)|(195<<16)|(175<<8)|86;//dw-12
+ mid[3] = (128<<24)|(195<<16)|(175<<8)|87;//dw-13
+ mid[4] = (128<<24)|(195<<16)|(175<<8)|88;//dw-14
+
+ WriteArrayObj[] wao;
+ atomic {
+ wao=global new WriteArrayObj[nthreads*nthreads]; //create array of objects
+ mybarr = global new BarrierServer(nthreads);
+ }
+ mybarr.start(mid[0]);
+
+ WriteArrayObjWrap[] wawrap = new WriteArrayObjWrap[nthreads];
+
+ atomic {
+ for(int i=0;i<nthreads; i++) {
+ int start = i * nthreads;
+ wawrap[i] = new WriteArrayObjWrap(global new WriteArrayObj(i,wao, nthreads,start));
+ }
+ }
+
+ boolean waitfordone=true;
+ while(waitfordone) {
+ atomic { //Master aborts come from here
+ if (mybarr.done)
+ waitfordone=false;
+ }
+ }
+
+ for(int i =0; i<nthreads; i++)
+ wawrap[i].wa.start(mid[i]);
+
+ for(int i =0; i<nthreads; i++)
+ wawrap[i].wa.join();
+
+ System.printString("Finished\n");
+ }
+}
--- /dev/null
+public class ReadArray extends Thread {
+ int id;
+ ReadArray[] myra;
+ int val;
+
+ public ReadArray() {
+ }
+
+ public ReadArray(int id, ReadArray[] ra) {
+ this.id = id;
+ myra = ra;
+ }
+
+ public void run() {
+ int tmpid;
+ //Create tmpidth array object locally
+ atomic {
+ tmpid = id;
+ myra[tmpid] = global new ReadArray();
+ myra[tmpid].val = tmpid*10+1;
+ }
+ }
+
+
+ public static void main(String[] args) {
+ int nthreads;
+ if(args.length>0) {
+ nthreads = Integer.parseInt(args[0]);
+ }
+ int[] mid = new int[5];
+ mid[0] = (128<<24)|(195<<16)|(175<<8)|84;//dw-10
+ mid[1] = (128<<24)|(195<<16)|(175<<8)|85;//dw-11
+ mid[2] = (128<<24)|(195<<16)|(175<<8)|86;//dw-12
+ mid[3] = (128<<24)|(195<<16)|(175<<8)|87;//dw-13
+ mid[4] = (128<<24)|(195<<16)|(175<<8)|88;//dw-14
+
+ ReadArray[] a;
+ atomic {
+ a=global new ReadArray[nthreads]; //create object a
+ }
+
+ ReadArrayWrap[] ra = new ReadArrayWrap[nthreads];
+
+ atomic {
+ for(int i=0;i<nthreads; i++) {
+ ra[i] = new ReadArrayWrap(global new ReadArray(i, a));
+ }
+ }
+ for(int i =0; i<nthreads; i++)
+ ra[i].ra.start(mid[i]);
+
+ for(int i =0; i<nthreads; i++)
+ ra[i].ra.join();
+
+ //Read Array elements
+ /*
+ for(int j=0; j<10000; j++) {
+ atomic {
+ int val;
+ for(int i=0; i<nthreads; i++) {
+ val = a[i].val;
+ }
+ }
+ }
+ */
+
+ System.printString("Finished\n");
+ }
+}
--- /dev/null
+public class WriteArray extends Thread {
+ WriteArray[] mywa;
+ int val, id;
+
+ public WriteArray() {
+ }
+
+ public WriteArray(WriteArray[] wa, int id) {
+ mywa = wa;
+ this.id = id;
+ }
+
+ public void run() {
+ //Create idth array object locally
+ atomic {
+ mywa[id] = global new WriteArray();
+ }
+ }
+
+ public static void main(String[] args) {
+ int nthreads;
+ if(args.length>0) {
+ nthreads = Integer.parseInt(args[0]);
+ }
+
+ int[] mid = new int[5];
+ mid[0] = (128<<24)|(195<<16)|(175<<8)|84;//dw-10
+ mid[1] = (128<<24)|(195<<16)|(175<<8)|85;//dw-11
+ mid[2] = (128<<24)|(195<<16)|(175<<8)|86;//dw-12
+ mid[3] = (128<<24)|(195<<16)|(175<<8)|87;//dw-13
+ mid[4] = (128<<24)|(195<<16)|(175<<8)|88;//dw-14
+
+ WriteArray[] wa;
+ atomic {
+ wa=global new WriteArray[nthreads]; //create nthreads objects
+ }
+
+ WriteArrayWrap[] wawrap = new WriteArrayWrap[nthreads];
+ atomic {
+ for(int i=0;i<nthreads; i++) {
+ wawrap[i] = new WriteArrayWrap(global new WriteArray(wa, i));
+ }
+ }
+
+ for(int i =0; i<nthreads; i++)
+ wawrap[i].wa.start(mid[i]);
+
+ for(int i =0; i<nthreads; i++)
+ wawrap[i].wa.join();
+
+ //Write into Array
+ /*
+ Integer val;
+ for(int j=0; j<10000; j++) {
+ atomic {
+ val = global new Integer(10);
+ for(int i=0; i<nthreads; i++) {
+ wa[i].val = val.intValue();
+ }
+ }
+ }
+ */
+ System.printString("Finished\n");
+ }
+}
--- /dev/null
+public class ReadArrayObjWrap {
+ public global ReadArrayObj ra;
+ public ReadArrayObjWrap() {
+ }
+ public ReadArrayObjWrap(ReadArrayObj r) {
+ ra = r;
+ }
+}
--- /dev/null
+public class ReadArrayWrap {
+ public global ReadArray ra;
+ public ReadArrayWrap() {
+ }
+ public ReadArrayWrap(ReadArray r) {
+ ra = r;
+ }
+}
--- /dev/null
+public class Simple extends Thread {
+ Counting mycount;
+ public Simple(Counting mycount) {
+ this.mycount = mycount;
+ }
+
+ public void run() {
+ for(int i = 0; i < 10000; i++) {
+ atomic {
+ mycount.increment();
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ Simple[] s;
+ Counting c;
+ int numthreads = 2;
+ int[] mid = new int[2];
+ mid[0] = (128<<24)|(195<<16)|(175<<8)|79; //dw-8
+ mid[1] = (128<<24)|(195<<16)|(175<<8)|73; //dw-5
+ atomic {
+ c = global new Counting();
+ s = global new Simple[numthreads];
+ for(int i = 0; i < 2; i++) {
+ s[i] = global new Simple(c);
+ }
+ }
+
+ Simple tmp;
+ for(int i = 0; i < 2; i++) {
+ atomic {
+ tmp = s[i];
+ }
+ tmp.start(mid[i]);
+ }
+
+ for(int i = 0; i < 2; i++) {
+ atomic {
+ tmp = s[i];
+ }
+ tmp.join();
+ }
+ //print count
+ int finalcount;
+ atomic {
+ finalcount = c.count;
+ }
+ System.printString("Count = "+finalcount+"\n");
+ }
+
+}
+
+class Counting {
+ global int count;
+ public Counting() {
+ this.count = 0;
+ }
+
+ public increment() {
+ count = count + 1;
+ }
+}
--- /dev/null
+/*************************************************************************
+ * Compilation: javac State.java
+ * Execution: java State N T
+ * Dependencies: StdDraw.java
+ *
+ * Create an N-by-N grid of sites.
+ *
+ * % java 50 2
+ *
+ * % java 50 2.1
+ *
+ * % java 50 2.2
+ *
+ *************************************************************************/
+
+public class State {
+ private int N; // N-by-N grid
+ private Cell[][] lattice; // N-by-N lattice of cells
+
+ // N-by-N grid, p = prob of up spin
+ public State(int N, double p) {
+ this.N = N;
+ this.lattice = new Cell[N][N];
+
+ // initialize at random
+ for (int i = 0; i < N; i++)
+ for (int j = 0; j < N; j++)
+ lattice[i][j] = new Cell(p);
+ }
+
+
+ // total magnetization
+ public double magnetization() {
+ double M = 0.0;
+ for (int i = 0; i < N; i++)
+ for (int j = 0; j < N; j++)
+ M += lattice[i][j].magnetization();
+ return M;
+ }
+
+ // total energy of site (i, j), using periodic boundary conditions
+ // assumes 0 <= i, j < N
+ private double energy(int i, int j) {
+ double E = 0.0;
+ E += lattice[(i+1)%N][j].magnetization();
+ E += lattice[i][(j+1)%N].magnetization();
+ E += lattice[(i-1+N)%N][j].magnetization();
+ E += lattice[i][(j-1+N)%N].magnetization();
+ E *= lattice[i][j].magnetization();
+ return -E;
+ }
+ // total energy, using periodic boundary conditions
+ public double energy() {
+ double E = 0.0;
+ for (int i = 0; i < N; i++)
+ for (int j = 0; j < N; j++)
+ E += energy(i, j);
+ return 0.5 * E; // divide by two to mitigate double-counting
+ }
+
+ // flip spin of cell i-j if energy decreases or Metropolis increase
+ public void metropolis(int i, int j, double kT) {
+ double deltaE = -2 * energy(i, j);
+ if ((deltaE <= 0) || (Math.random() <= Math.exp(-deltaE / kT)))
+ lattice[i][j].flip();
+ }
+
+ // one Metropolis phase - N^2 random steps
+ // kT = temperature (say between 1 and 4)
+ public void phase(double kT) {
+ for (int steps = 0; steps < N*N; steps++) {
+ int i = (int) (Math.random() * N);
+ int j = (int) (Math.random() * N);
+ metropolis(i, j, kT);
+ }
+ }
+
+ // plot Ising state
+ public void draw() {
+ /*
+ for (int i = 0; i < N; i++)
+ for (int j = 0; j < N; j++)
+ lattice[i][j].draw(i + 0.5, j + 0.5);
+
+ // draw grid lines
+ StdDraw.setPenColor(StdDraw.BLACK);
+ for (int i = 0; i < N; i++) {
+ StdDraw.line(i, 0, i, N);
+ StdDraw.line(0, i, N, i);
+ }
+ */
+ }
+
+ // string representation
+ public String toString() {
+ String NEWLINE = System.getProperty("line.separator");
+ String s = "";
+ for (int i = 0; i < N; i++) {
+ for (int j = 0; j < N; j++) {
+ s += lattice[i][j] + " ";
+ }
+ s += NEWLINE;
+ }
+ return s;
+ }
+
+
+ public static void main(String[] args) {
+ int N = Integer.parseInt(args[0]); // N-by-N lattice
+ double kT = Double.parseDouble(args[1]); // temperature
+ State state = new State(N, 1.0);
+
+ //StdDraw.setXscale(0, N);
+ //StdDraw.setYscale(0, N);
+
+ System.out.println("warming up");
+ for (int t = 0; t < 10000; t++) state.phase(kT);
+ System.out.println("done warming up");
+
+ double sumM = 0.0;
+ for (int t = 1; true; t++) {
+ state.phase(kT);
+ sumM += state.magnetization();
+ if (t % 10000 == 0) {
+ System.out.println("kT = " + kT + " (" + t + "): " + sumM / t / (N*N));
+ }
+ }
+ }
+
+}
+
--- /dev/null
+public class WriteArrayObjWrap {
+ public global WriteArrayObj wa;
+ public WriteArrayObjWrap() {
+ }
+ public WriteArrayObjWrap(WriteArrayObj wa) {
+ this.wa = wa;
+ }
+}
--- /dev/null
+public class WriteArrayWrap {
+ public global WriteArray wa;
+ public WriteArrayWrap() {
+ }
+ public WriteArrayWrap(WriteArray wa) {
+ this.wa = wa;
+ }
+}
--- /dev/null
+../runlog/MultiMCReadcommit1NP.bin_local_rao.txt 0.71
+../runlog/MultiMCWritecommit1NP.bin_local_wao.txt 1.72
+../runlog/OneMCReadcommit1NP.bin_local_rarray.txt 0.69
+../runlog/OneMCWritecommit1NP.bin_local_warray.txt 1.72
+===========
+
+../runlog/MultiMCReadcommit1NP.bin_local_rao.txt 0.67
+../runlog/MultiMCReadcommit5NP.bin_rao.txt 100.36
+../runlog/MultiMCWritecommit1NP.bin_local_wao.txt 1.7
+../runlog/MultiMCWritecommit5NP.bin_wao.txt 42.54
+../runlog/OneMCReadcommit1NP.bin_local_rarray.txt 0.67
+../runlog/OneMCReadcommit5NP.bin_rarray.txt 4.72
+../runlog/OneMCWritecommit1NP.bin_local_warray.txt 1.69
+../runlog/OneMCWritecommit5NP.bin_warray.txt 8.75
+===========
+
+../runlog/MultiMCReadcommit1NP.bin_local_rao.txt 0.67
+../runlog/MultiMCReadcommit2NP.bin_rao.txt 21.26
+../runlog/MultiMCReadcommit3NP.bin_rao.txt 28.62
+../runlog/MultiMCReadcommit4NP.bin_rao.txt 56.52
+../runlog/MultiMCReadcommit5NP.bin_rao.txt 94.85
+../runlog/MultiMCWritecommit1NP.bin_local_wao.txt 1.69
+../runlog/MultiMCWritecommit2NP.bin_wao.txt 8.21
+../runlog/MultiMCWritecommit3NP.bin_wao.txt 15.54
+../runlog/MultiMCWritecommit4NP.bin_wao.txt 27.45
+../runlog/MultiMCWritecommit5NP.bin_wao.txt 42.72
+../runlog/OneMCReadcommit1NP.bin_local_rarray.txt 0.66
+../runlog/OneMCReadcommit2NP.bin_rarray.txt 3.14
+../runlog/OneMCReadcommit3NP.bin_rarray.txt 3.6
+../runlog/OneMCReadcommit4NP.bin_rarray.txt 4.08
+../runlog/OneMCReadcommit5NP.bin_rarray.txt 4.79
+../runlog/OneMCWritecommit1NP.bin_local_warray.txt 1.7
+../runlog/OneMCWritecommit2NP.bin_warray.txt 3.84
+../runlog/OneMCWritecommit3NP.bin_warray.txt 5.34
+../runlog/OneMCWritecommit4NP.bin_warray.txt 7.03
+../runlog/OneMCWritecommit5NP.bin_warray.txt 8.72
+===========
+
+../runlog/MultiMCReadcommit1NP.bin_local.txt 0.04
+../runlog/MultiMCReadcommit2NP.bin.txt 0.04
+../runlog/MultiMCReadcommit3NP.bin.txt 0.04
+../runlog/MultiMCReadcommit4NP.bin.txt 0.05
+../runlog/MultiMCReadcommit5NP.bin.txt 0.06
+../runlog/MultiMCWritecommit1NP.bin_local.txt 0.03
+../runlog/MultiMCWritecommit2NP.bin.txt 0.03
+../runlog/MultiMCWritecommit3NP.bin.txt 0.04
+../runlog/MultiMCWritecommit4NP.bin.txt 0.05
+../runlog/MultiMCWritecommit5NP.bin.txt 0.04
+../runlog/OneMCReadcommit1NP.bin_local.txt 0.03
+../runlog/OneMCReadcommit2NP.bin.txt 0.03
+../runlog/OneMCReadcommit3NP.bin.txt 0.04
+../runlog/OneMCReadcommit4NP.bin.txt 0.04
+../runlog/OneMCReadcommit5NP.bin.txt 0.05
+../runlog/OneMCWritecommit1NP.bin_local.txt 0.03
+../runlog/OneMCWritecommit2NP.bin.txt 0.03
+../runlog/OneMCWritecommit3NP.bin.txt 0.04
+../runlog/OneMCWritecommit4NP.bin.txt 0.04
+../runlog/OneMCWritecommit5NP.bin.txt 0.04
+===========
+
--- /dev/null
+OneMCReadcommit:1:2:3:4:5:rarray
+MultiMCReadcommit:1:2:3:4:5:rao
+OneMCWritecommit:1:2:3:4:5:warray
+MultiMCWritecommit:1:2:3:4:5:wao
--- /dev/null
+128.195.175.84
+128.195.175.85
+128.195.175.86
+128.195.175.87
+128.195.175.88
--- /dev/null
+#!/bin/sh
+
+#set -x
+MACHINES2='dw-11.eecs.uci.edu'
+MACHINES3='dw-11.eecs.uci.edu dw-12.eecs.uci.edu'
+MACHINES4='dw-11.eecs.uci.edu dw-12.eecs.uci.edu dw-13.eecs.uci.edu'
+MACHINES5='dw-11.eecs.uci.edu dw-12.eecs.uci.edu dw-13.eecs.uci.edu dw-14.eecs.uci.edu'
+LOGDIR=/home/adash/research/Robust/src/Benchmarks/Prefetch/runlog
+TOPDIR=`pwd`
+
+function run {
+ i=0;
+ DIR=`pwd`
+ while [ $i -lt $1 ]; do
+ echo "$DIR" > ~/.tmpdir
+ echo "bin=$3" > ~/.tmpvars
+ if [ $2 -eq 2 ]; then
+ arg=$ARGS2
+ MACHINES=$MACHINES2
+ fi
+ if [ $2 -eq 3 ]; then
+ arg=$ARGS3
+ MACHINES=$MACHINES3
+ fi
+ if [ $2 -eq 4 ]; then
+ arg=$ARGS4
+ MACHINES=$MACHINES4
+ fi
+ if [ $2 -eq 5 ]; then
+ arg=$ARGS5
+ MACHINES=$MACHINES5
+ fi
+ chmod +x ~/.tmpvars
+ for machine in `echo $MACHINES`
+ do
+ ssh ${machine} 'cd `cat ~/.tmpdir`; source ~/.tmpvars; ./$bin' &
+ echo ""
+ done
+ sleep 2
+ /usr/bin/time -f "%e" ./$3 master $arg 2>> ${LOGDIR}/${3}.txt
+ echo "Terminating ... "
+ for machine in `echo $MACHINES`
+ do
+ ssh ${machine} 'source ~/.tmpvars; killall $bin'
+ done
+ sleep 2
+ i=`expr $i + 1`
+ done
+}
+
+function localrun {
+ i=0;
+ while [ $i -lt $1 ]; do
+ /usr/bin/time -f "%e" ./${NONPREFETCH} master $ARGS1 2>> ${LOGDIR}/${NONPREFETCH}_local.txt
+ sleep 4
+ i=`expr $i + 1`
+ done
+}
+
+function callrun {
+ NONPREFETCH=${BENCHMARK}1NP.bin
+ NONPREFETCH2=${BENCHMARK}2NP.bin
+ NONPREFETCH3=${BENCHMARK}3NP.bin
+ NONPREFETCH4=${BENCHMARK}4NP.bin
+ NONPREFETCH5=${BENCHMARK}5NP.bin
+
+ echo "---------- Running ${BENCHMARK} local non-prefetch on 1 machine ---------- "
+ localrun 1
+
+ echo "---------- Running ${BENCHMARK} two threads non-prefetch on 2 machines ---------- "
+ run 1 2 $NONPREFETCH2
+ echo "---------- Running ${BENCHMARK} three threads non-prefetch on 3 machines ---------- "
+ run 1 3 $NONPREFETCH3
+ echo "---------- Running ${BENCHMARK} four threads non-prefetch on 4 machines ---------- "
+ run 1 4 $NONPREFETCH4
+ echo "---------- Running ${BENCHMARK} five threads non-prefetch on 5 machines ---------- "
+ run 1 5 $NONPREFETCH5
+
+ cd $TOPDIR
+}
+
+benchmarks='rarray rao warray wao'
+
+echo "---------- Clean old files ---------- "
+rm ../runlog/*
+for b in `echo $benchmarks`
+do
+ bm=`grep $b bm.txt`
+ BENCHMARK=`echo $bm | cut -f1 -d":"`
+ ARGS1=`echo $bm | cut -f2 -d":"`
+ ARGS2=`echo $bm | cut -f3 -d":"`
+ ARGS3=`echo $bm | cut -f4 -d":"`
+ ARGS4=`echo $bm | cut -f5 -d":"`
+ ARGS5=`echo $bm | cut -f6 -d":"`
+ EXTENSION=`echo $bm | cut -f7 -d":"`
+ callrun
+done
+
+#----------Calulates the averages -----------
+for file in `ls ../runlog/*.txt`
+do
+ echo -n $file >> average.txt
+ cat $file | awk '{sum += $1} END {print " "sum/NR}' >> average.txt
+done
+echo "===========" >> average.txt
+echo "" >> average.txt
+
+echo "done"