lda = ldaa + 1;
a = global new double[ldaa][lda];
+ //System.printString("row_ldaa = "+ldaa + "column_lda= "+lda+ "\n");
b = global new double [ldaa];
x = global new double [ldaa];
ipvt = global new int [ldaa];
numthreads = lub.nthreads;
}
+ int[] mid = new int[4];
+ 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
+
/* spawn threads */
LinpackRunner[] thobjects;
- TournamentBarrier br;
+ BarrierServer mybarr;
atomic {
thobjects = global new LinpackRunner[numthreads];
- br = global new TournamentBarrier(numthreads);
+ mybarr = global new BarrierServer(numthreads);
}
+ mybarr.start(mid[0]);
//JGFInstrumentor.startTimer("Section2:LUFact:Kernel", instr.timers);
-
LinpackRunner tmp;
- int mid = (128<<24)|(195<<16)|(175<<8)|73;
- for(int i=1;i<numthreads;i++) {
+
+ boolean waitfordone=true;
+ while(waitfordone) {
atomic {
- thobjects[i] = global new LinpackRunner(i,lub.a,lub.lda,lub.n,lub.ipvt,br,lub.nthreads);
+ //System.printString("HERE #1\n");
+ if (mybarr.done)
+ waitfordone=false;
+ }
+ }
+
+ for(int i=0;i<numthreads;i++) {
+ atomic {
+ thobjects[i] = global new LinpackRunner(i,lub.a,lub.lda,lub.n,lub.ipvt,lub.nthreads);
tmp = thobjects[i];
}
- tmp.start(mid);
+ tmp.start(mid[i]);
}
+ /*
atomic {
- thobjects[0] = global new LinpackRunner(0,lub.a,lub.lda,lub.n,lub.ipvt,br,lub.nthreads);
+ thobjects[0] = global new LinpackRunner(0,lub.a,lub.lda,lub.n,lub.ipvt,lub.nthreads);
tmp = thobjects[0];
}
- tmp.start(mid);
+ tmp.start(mid[0]);
tmp.join();
-
- for(int i=1;i<numthreads;i++) {
+*/
+ for(int i=0;i<numthreads;i++) {
atomic {
tmp = thobjects[i];
}
}
atomic {
+ //System.printString("HERE #2\n");
lub.dgesl(lub.a,lub.lda,lub.n,lub.ipvt,lub.b,0);
}
+
//JGFInstrumentor.stopTimer("Section2:LUFact:Kernel", instr.timers);
}
if (lresidn > lref) {
//System.printString("Validation failed");
- System.printString("Computed Norm Res = " + (long) residn * 1000000);
- System.printString("Reference Norm Res = " + (long) ref[size] * 1000000);
+ //System.printString("Computed Norm Res = " + (long) residn * 1000000);
+ //System.printString("Reference Norm Res = " + (long) ref[size] * 1000000);
return 1;
} else {
return 0;
}
}
}
- /*
- public static void JGFvalidate(JGFLUFactBench lub) {
- int i;
- double eps,residn;
- double[] ref;
-
- ref = new double[3];
- ref[0] = 6.0;
- ref[1] = 12.0;
- ref[2] = 20.0;
-
- atomic {
- for (i = 0; i < lub.n; i++) {
- lub.x[i] = lub.b[i];
- }
- lub.norma = lub.matgen(lub.a,lub.lda,lub.n,lub.b);
- for (i = 0; i < lub.n; i++) {
- lub.b[i] = -(lub.b[i]);
- }
-
- lub.dmxpy(lub.n,lub.b,lub.n,lub.lda,lub.x,lub.a);
- lub.resid = 0.0;
- lub.normx = 0.0;
- for (i = 0; i < lub.n; i++) {
-//resid = (resid > abs(b[i])) ? resid : abs(b[i]);
-//normx = (normx > abs(x[i])) ? normx : abs(x[i]);
-if (lub.resid <= abs(lub.b[i])) lub.resid = lub.abs(lub.b[i]);
-if (lub.normx <= abs(lub.x[i])) lub.normx = lub.abs(lub.x[i]);
-}
-eps = lub.epslon((double)1.0);
-residn = lub.resid/( lub.n*lub.norma*lub.normx*eps );
-}
-
-if (residn > ref[size]) {
-System.printString("Validation failed");
-System.printString("Computed Norm Res = " + (long) residn);
-System.printString("Reference Norm Res = " + (long) ref[size]);
-}
-}
-*/
-
}