public static void JGFapplication(JGFMolDynBench mold) {
// Create new arrays
+ BarrierServer mybarr;
+ int[] mid = new int[4];
+ mid[0] = (128<<24)|(195<<16)|(175<<8)|79;
+ mid[1] = (128<<24)|(195<<16)|(175<<8)|80;
+ mid[2] = (128<<24)|(195<<16)|(175<<8)|78;
+ mid[3] = (128<<24)|(195<<16)|(175<<8)|73;
+
atomic {
mold.epot = global new double [mold.nthreads];
mold.vir = global new double [mold.nthreads];
atomic {
partsize = mold.PARTSIZE;
numthreads = mold.nthreads;
+ mybarr = global new BarrierServer(numthreads);
}
+ mybarr.start(mid[0]);
double sh_force [][];
double sh_force2 [][][];
// spawn threads
mdRunner[] thobjects;
- Barrier br;
atomic {
thobjects = global new mdRunner[numthreads];
- br= global new Barrier(numthreads);
}
-
- int[] mid = new int[4];
- mid[0] = (128<<24)|(195<<16)|(175<<8)|73;
- mid[1] = (128<<24)|(195<<16)|(175<<8)|69;
- mid[2] = (128<<24)|(195<<16)|(175<<8)|79;
- mid[3] = (128<<24)|(195<<16)|(175<<8)|78;
mdRunner tmp;
+ boolean waitfordone=true;
+ while(waitfordone) {
+ atomic{
+ if(mybarr.done)
+ waitfordone=false;
+ }
+ }
+
for(int i=1;i<numthreads;i++) {
atomic {
- thobjects[i] = global new mdRunner(i,mold.mm,sh_force,sh_force2,br,mold.nthreads,mold);
+ thobjects[i] = global new mdRunner(i,mold.mm,sh_force,sh_force2,mold.nthreads,mold);
tmp = thobjects[i];
}
tmp.start(mid[i]);
}
atomic {
- thobjects[0] = global new mdRunner(0,mold.mm,sh_force,sh_force2,br,mold.nthreads,mold);
+ thobjects[0] = global new mdRunner(0,mold.mm,sh_force,sh_force2,mold.nthreads,mold);
tmp = thobjects[0];
}
tmp.start(mid[0]);
int istop;
int iprint;
- Barrier br;
random randnum;
JGFMolDynBench mymd;
int nthreads;
particle[] one;
- public mdRunner(int id, int mm, double [][] sh_force, double [][][] sh_force2,Barrier br,
+ public mdRunner(int id, int mm, double [][] sh_force, double [][][] sh_force2,
int nthreads, JGFMolDynBench mymd) {
this.id=id;
this.mm=mm;
this.sh_force=sh_force;
this.sh_force2=sh_force2;
- this.br=br;
this.nthreads = nthreads;
this.mymd = mymd;
count = 0.0;
int tmpmdsize;
double tmpden;
int movemx=50;
- Barrier tmpbr;
+ Barrier barr;
+ barr = new Barrier("128.195.175.79");
atomic {
- tmpbr=br;
mdsize = mymd.PARTSIZE;
one = global new particle[mdsize];
l = mymd.LENGTH;
/* Synchronise threads and start timer before MD simulation */
- Barrier.enterBarrier(tmpbr);
- System.clearPrefetchCache();
+ Barrier.enterBarrier(barr);
/* MD simulation */
}
/* Barrier */
- Barrier.enterBarrier(tmpbr);
- System.clearPrefetchCache();
+ Barrier.enterBarrier(barr);
atomic {
/* Barrier */
- Barrier.enterBarrier(tmpbr);
- System.clearPrefetchCache();
+ Barrier.enterBarrier(barr);
atomic {
/* compute forces */
}
/* Barrier */
- Barrier.enterBarrier(tmpbr);
- System.clearPrefetchCache();
+ Barrier.enterBarrier(barr);
/* update force arrays */
atomic {
}
/* Barrier */
- Barrier.enterBarrier(tmpbr);
- System.clearPrefetchCache();
+ Barrier.enterBarrier(barr);
atomic {
if(id == 0) {
/* Barrier */
- Barrier.enterBarrier(tmpbr);
- System.clearPrefetchCache();
+ Barrier.enterBarrier(barr);
atomic {
/*scale forces, update velocities */
rp = (count / tmpmdsize) * 100.0;
}
}
- Barrier.enterBarrier(tmpbr);
- System.clearPrefetchCache();
+ Barrier.enterBarrier(barr);
}
- Barrier.enterBarrier(tmpbr);
- System.clearPrefetchCache();
+ Barrier.enterBarrier(barr);
//if (id == 0) JGFInstrumentor.stopTimer("Section3:MolDyn:Run", instr.timers);
}
SRC=${MAINCLASS}.java \
JGFInstrumentor.java \
JGFTimer.java \
-JGFMolDynBench.java \
-Barrier.java
-FLAGS=-dsm -prefetch -excprefetch particle.force -excprefetch particle.domove -excprefetch particle.mkekin -excprefetch TournamentBarrier.DoBarrier -excprefetch JGFMolDynBench.JGFvalidate -excprefetch JGFMolDynBench.JGFapplication -optimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS} -trueprob 0.8
-FLAGS2=-dsm -optimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS}NP
+JGFMolDynBench.java
+FLAGS=-dsm -dsmcaching -prefetch -excprefetch particle.force -excprefetch particle.domove -excprefetch particle.mkekin -excprefetch TournamentBarrier.DoBarrier -excprefetch JGFMolDynBench.JGFvalidate -excprefetch JGFMolDynBench.JGFapplication -optimize -mainclass ${MAINCLASS} -o ${MAINCLASS} -trueprob 0.8
+FLAGS2=-dsm -optimize -mainclass ${MAINCLASS} -o ${MAINCLASS}NP
default:
- ../../../../buildscript ${FLAGS2} ${SRC}
- ../../../../buildscript ${FLAGS} ${SRC}
+ ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC}
+ ../../../../buildscript ${FLAGS} -o ${MAINCLASS}P ${SRC}
+ cp ${MAINCLASS}NP.bin ${MAINCLASS}1NP.bin
+ cp ${MAINCLASS}P.bin ${MAINCLASS}1.bin
+ cp ${MAINCLASS}NP.bin ${MAINCLASS}2NP.bin
+ cp ${MAINCLASS}P.bin ${MAINCLASS}2.bin
+ cp ${MAINCLASS}NP.bin ${MAINCLASS}3NP.bin
+ cp ${MAINCLASS}P.bin ${MAINCLASS}3.bin
+ cp ${MAINCLASS}NP.bin ${MAINCLASS}4NP.bin
+ cp ${MAINCLASS}P.bin ${MAINCLASS}4.bin
clean:
rm -rf tmpbuilddirectory/