BiGraph bg;
int upperlimit;
int lowerlimit;
- //Barrier barr;
- String hostname;
public Em3d() {
}
- public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, int numDegree, int threadindex, String name) {
+ public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, int numDegree, int threadindex) {
this.bg = bg;
this.lowerlimit = lowerlimit;
this.upperlimit = upperlimit;
this.numIter = numIter;
- this.hostname = name;
this.numDegree = numDegree;
this.threadindex=threadindex;
}
Barrier barr;
int degree;
Random random;
+ String hname;
- barr = new Barrier(hostname);
+ barr = new Barrier("128.195.175.79");
atomic {
iteration = numIter;
degree = numDegree;
long start0 = System.currentTimeMillis();
int numThreads = em.numThreads;
int[] mid = new int[4];
- String[] hostname;
- atomic {
- hostname = global new String[4];
- hostname[0] = global new String("128.195.175.79");
- hostname[1] = global new String("128.195.175.73");
- hostname[2] = global new String("128.195.175.78");
- hostname[3] = global new String("128.195.175.69");
- }
mid[0] = (128<<24)|(195<<16)|(175<<8)|79;//dw-1
mid[1] = (128<<24)|(195<<16)|(175<<8)|73;//dw-2
mid[2] = (128<<24)|(195<<16)|(175<<8)|78;
mybarr = global new BarrierServer(numThreads);
graph = BiGraph.create(em.numNodes, em.numDegree, numThreads);
}
+ mybarr.start(mid[0]);
+
Em3dWrap[] em3d=new Em3dWrap[numThreads];
int increment = em.numNodes/numThreads;
for(int i=0;i<numThreads;i++) {
Em3d tmp;
if ((i+1)==numThreads)
- tmp = global new Em3d(graph, base, em.numNodes, em.numIter, em.numDegree, i, hostname[0]);
+ tmp = global new Em3d(graph, base, em.numNodes, em.numIter, em.numDegree, i);
else
- tmp = global new Em3d(graph, base, base+increment, em.numIter, em.numDegree, i, hostname[0]);
+ tmp = global new Em3d(graph, base, base+increment, em.numIter, em.numDegree, i);
em3d[i]=new Em3dWrap(tmp);
base+=increment;
}
}
- //TODO check if correct
- mybarr.start(mid[0]);
+ boolean waitfordone=true;
+ while(waitfordone) {
+ atomic {
+ if (mybarr.done)
+ waitfordone=false;
+ }
+ }
+
+ //System.printString("Starting Barrier run\n");
for(int i = 0; i<numThreads; i++) {
em3d[i].em3d.start(mid[i]);
}
-
- mybarr.join();
for(int i = 0; i<numThreads; i++) {
em3d[i].em3d.join();
}