From: jzhou Date: Wed, 12 Nov 2008 03:34:14 +0000 (+0000) Subject: changes X-Git-Tag: buildscript^7~38 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=62a82c22e0717626781868e49aaada3e4d0b1247;p=IRC.git changes --- diff --git a/Robust/src/Benchmarks/Scheduling/PSFluidAnimate/Grid.java b/Robust/src/Benchmarks/Scheduling/PSFluidAnimate/Grid.java index ddc47e16..acd73a7d 100644 --- a/Robust/src/Benchmarks/Scheduling/PSFluidAnimate/Grid.java +++ b/Robust/src/Benchmarks/Scheduling/PSFluidAnimate/Grid.java @@ -250,6 +250,12 @@ public class Grid { cell = this.m_cells[ix][iy][iz]; } np = cell.m_numPars; + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_p[np].m_x = cell2.m_p[j].m_x; cell.m_p[np].m_y = cell2.m_p[j].m_y; cell.m_p[np].m_z = cell2.m_p[j].m_z; diff --git a/Robust/src/Benchmarks/Scheduling/PSFluidAnimate/PSFADemo.java b/Robust/src/Benchmarks/Scheduling/PSFluidAnimate/PSFADemo.java index 8e87d64a..fdc07bc5 100644 --- a/Robust/src/Benchmarks/Scheduling/PSFluidAnimate/PSFADemo.java +++ b/Robust/src/Benchmarks/Scheduling/PSFluidAnimate/PSFADemo.java @@ -88,6 +88,12 @@ public class PSFADemo { Cell toadd = (Cell)(g.m_neighCells.get(key)); int toaddnp = toadd.m_numPars; for(int j = 0; j < toaddnp; ++j) { + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_p[np].m_x = toadd.m_p[j].m_x; cell.m_p[np].m_y = toadd.m_p[j].m_y; cell.m_p[np].m_z = toadd.m_p[j].m_z; @@ -120,6 +126,12 @@ public class PSFADemo { Cell toadd = g.m_cells[ix][iy][iz]; int toaddnp = toadd.m_numPars; for(int j = 0; j < toaddnp; ++j) { + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_p[np].m_x = toadd.m_p[j].m_x; cell.m_p[np].m_y = toadd.m_p[j].m_y; cell.m_p[np].m_z = toadd.m_p[j].m_z; @@ -159,6 +171,12 @@ public class PSFADemo { Cell toadd = g.m_cells[ix][iy][iz]; int toaddnp = toadd.m_numPars; for(int j = 0; j < toaddnp; ++j) { + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_p[np].m_x = toadd.m_p[j].m_x; cell.m_p[np].m_y = toadd.m_p[j].m_y; cell.m_p[np].m_z = toadd.m_p[j].m_z; @@ -200,6 +218,12 @@ public class PSFADemo { cell.m_numPars = 0; int np = 0; for(int j = 0; j < toflushnp; ++j) { + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_p[np].m_x = toflush.m_p[j].m_x; cell.m_p[np].m_y = toflush.m_p[j].m_y; cell.m_p[np].m_z = toflush.m_p[j].m_z; @@ -234,6 +258,12 @@ public class PSFADemo { cell.m_numPars = 0; int np = 0; for(int j = 0; j < toflushnp; ++j) { + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_p[np].m_x = toflush.m_p[j].m_x; cell.m_p[np].m_y = toflush.m_p[j].m_y; cell.m_p[np].m_z = toflush.m_p[j].m_z; @@ -274,6 +304,12 @@ public class PSFADemo { cell.m_numPars = 0; int np = 0; for(int j = 0; j < toflushnp; ++j) { + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_p[np].m_x = toflush.m_p[j].m_x; cell.m_p[np].m_y = toflush.m_p[j].m_y; cell.m_p[np].m_z = toflush.m_p[j].m_z; @@ -318,7 +354,6 @@ public class PSFADemo { visited.put(key, key); } } - // border cells of g for(int iz = 0; iz < g.m_ez - g.m_sz;) { for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) { @@ -343,7 +378,6 @@ public class PSFADemo { iz++; } } - for(int ix = 0; ix < g.m_ex - g.m_sx;) { for(int iy = 0; iy < g.m_ey - g.m_sy; iy++) { for(int iz = 0; iz < g.m_ez - g.m_sz; iz++) { @@ -512,6 +546,12 @@ public class PSFADemo { int np = cell.m_numPars; Cell toadd = (Cell)(g.m_neighCells.get(key)); for(int j = 0; j < np; ++j) { + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_v[j].m_x += toadd.m_v[j].m_x - cell.m_a[j].m_x; cell.m_v[j].m_y += toadd.m_v[j].m_y - cell.m_a[j].m_y; cell.m_v[j].m_z += toadd.m_v[j].m_z - cell.m_a[j].m_z; @@ -531,6 +571,12 @@ public class PSFADemo { int np = cell.m_numPars; Cell toadd = g.m_cells[ix][iy][iz]; for(int j = 0; j < np; ++j) { + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_v[j].m_x = toadd.m_v[j].m_x - cell.m_a[j].m_x; cell.m_v[j].m_y = toadd.m_v[j].m_y - @@ -560,6 +606,12 @@ public class PSFADemo { int np = cell.m_numPars; Cell toadd = g.m_cells[ix][iy][iz]; for(int j = 0; j < np; ++j) { + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_v[j].m_x = toadd.m_v[j].m_x - cell.m_a[j].m_x; cell.m_v[j].m_y = toadd.m_v[j].m_y - @@ -584,6 +636,12 @@ public class PSFADemo { Cell cell = (Cell)it_values.next(); int np = cell.m_numPars; for(int j = 0; j < np; ++j) { + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_a[j].m_x += cell.m_v[j].m_x; cell.m_a[j].m_y += cell.m_v[j].m_y; cell.m_a[j].m_z += cell.m_v[j].m_z; @@ -603,6 +661,12 @@ public class PSFADemo { Cell cell = (Cell)(g.m_neighCells.get(key)); int np = cell.m_numPars; for(int j = 0; j < np; ++j) { + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_a[j].m_x = toflush.m_a[j].m_x; cell.m_a[j].m_y = toflush.m_a[j].m_y; cell.m_a[j].m_z = toflush.m_a[j].m_z; @@ -623,6 +687,12 @@ public class PSFADemo { Cell cell = g.m_cells[ix][iy][iz]; int np = cell.m_numPars; for(int j = 0; j < np; ++j) { + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_a[j].m_x = toflush.m_a[j].m_x; cell.m_a[j].m_y = toflush.m_a[j].m_y; cell.m_a[j].m_z = toflush.m_a[j].m_z; @@ -649,6 +719,12 @@ public class PSFADemo { Cell cell = g.m_cells[ix][iy][iz]; int np = cell.m_numPars; for(int j = 0; j < np; ++j) { + if(cell.m_p[np] == null) { + cell.m_p[np] = new Vec3(); + cell.m_hv[np] = new Vec3(); + cell.m_v[np] = new Vec3(); + cell.m_a[np] = new Vec3(); + } cell.m_a[j].m_x = toflush.m_a[j].m_x; cell.m_a[j].m_y = toflush.m_a[j].m_y; cell.m_a[j].m_z = toflush.m_a[j].m_z; diff --git a/Robust/src/Benchmarks/Scheduling/PSFluidAnimate/PSFluidAnimateBench.java b/Robust/src/Benchmarks/Scheduling/PSFluidAnimate/PSFluidAnimateBench.java index 2ea3abaf..7b8b56c0 100644 --- a/Robust/src/Benchmarks/Scheduling/PSFluidAnimate/PSFluidAnimateBench.java +++ b/Robust/src/Benchmarks/Scheduling/PSFluidAnimate/PSFluidAnimateBench.java @@ -4,30 +4,10 @@ task t1(StartupObject s{initialstate}) { //System.printString("task t1\n"); int threadnum = 16; - int lsb = 0; - int framenum = 1; + int framenum = 4; - int weight=0; - int mask= 1; - int count=0; - lsb=-1; - int x = threadnum; - while(x > 0) { - int temp; - temp=(x&mask); - if((x&mask) == 1) { - weight++; - if(lsb == -1) { - lsb = count; - } - } - x >>= 1; - count++; - } - - int XDIVS = 1<<(lsb/2); // number of partitions in X - int ZDIVS = 1<<(lsb/2); // number of partitions in Z - if(XDIVS*ZDIVS != threadnum) XDIVS*=2; + int XDIVS = 4;// number of partitions in X + int ZDIVS = 4;// number of partitions in Z int NUM_GRIDS = XDIVS * ZDIVS; // initialize the simulation @@ -74,90 +54,53 @@ task t1(StartupObject s{initialstate}) { PSFADemo demo = new PSFADemo(NUM_GRIDS, numCells, numParticles, nx, ny, nz, viscosityCoeff, new Vec3(delta.m_x, delta.m_y, delta.m_z)){tosum}; - + + float px, py, pz, hvx, hvy, hvz, vx, vy, vz; + long seed = 12345678; + Random r = new Random(seed); + int maxint = (1<<31) - 1; + float dx = (float)0.005; + float dy = (float)0.005; + float dz = (float)0.005; + px = domainMin.m_x; + py = domainMin.m_y; + pz = domainMin.m_z; + hvx = (float)0.2; + hvy = (float)0.5; + hvz = (float)0.3; + vx = (float)0.2; + vy = (float)0.5; + vz = (float)0.3; + //int p = 0; + int xn = 0; + int yn = 0; + int zn = 0; Cell[][][] cells = new Cell[nx][ny][nz]; + int p=0; for(int i = 0; i < nx; i++) { for(int j = 0; j < ny; j++) { for(int k = 0; k < nz; k++) { int index = (k*ny + j)*nx + i; cells[i][j][k] = new Cell(index); + if (p 0.0108902)); - do { - py = (float)((((float)r.nextInt()) / maxint) * 0.079975 - 0.08); - } while((py < -0.08255) || (py > -0.0000257124)); - do { - pz = (float)((((float)r.nextInt()) / maxint) * 0.12 - 0.06); - } while((pz < -0.0656068) || (pz > 0.06557)); - do { - hvx = (float)((((float)r.nextInt()) / maxint) * 0.71 - 0.44); - } while((hvx < -0.442022) || (hvx > 0.277284)); - do { - hvy = (float)((((float)r.nextInt()) / maxint) * 0.84 - 0.33); - } while((hvy < -0.336931) || (hvy > 0.513108)); - do { - hvz = (float)((((float)r.nextInt()) / maxint) * 0.63 - 0.32); - } while((hvz < -0.320125) || (hvz > 0.315038)); - do { - vx = (float)((((float)r.nextInt()) / maxint) * 0.69 - 0.41); - } while((vx < -0.41846) || (vx > 0.280465)); - do { - vy = (float)((((float)r.nextInt()) / maxint) * 0.87 - 0.36); - } while((vy < -0.36748) || (vy > 0.515511)); - do { - vz = (float)((((float)r.nextInt()) / maxint) * 0.64 - 0.32); - } while((vz < -0.321845) || (vz > 0.32013)); - - int ci = (int)((px - domainMin.m_x) / delta.m_x); - int cj = (int)((py - domainMin.m_y) / delta.m_y); - int ck = (int)((pz - domainMin.m_z) / delta.m_z); - if(ci < 0) { - ci = 0; - } else if(ci > (nx-1)) { - ci = nx-1; - } - if(cj < 0) { - cj = 0; - } else if(cj > (ny-1)) { - cj = ny-1; - } - if(ck < 0) { - ck = 0; - } else if(ck > (nz-1)) { - ck = nz-1; - } - - Cell cell = cells[ci][cj][ck]; - int np = cell.m_numPars; - if(np < 16) { - cell.m_p[np].m_x = px; - cell.m_p[np].m_y = py; - cell.m_p[np].m_z = pz; - cell.m_hv[np].m_x = hvx; - cell.m_hv[np].m_y = hvy; - cell.m_hv[np].m_z = hvz; - cell.m_v[np].m_x = vx; - cell.m_v[np].m_y = vy; - cell.m_v[np].m_z = vz; - ++cell.m_numPars; - i++; - } - - } - - int gi = 0; int sx, sz, ex, ez; ex = 0; @@ -174,6 +117,7 @@ task t1(StartupObject s{initialstate}) { new Vec3(delta.m_x, delta.m_y, delta.m_z), densityCoeff, pressureCoeff, viscosityCoeff, nx, ny, nz, framenum){rebuild}; + // initialize the cells grid.initCells(cells); grid.initNeighCells(cells, demo); } diff --git a/Robust/src/IR/Flat/BuildCodeMultiCore.java b/Robust/src/IR/Flat/BuildCodeMultiCore.java index 11699e3b..0a4eb663 100644 --- a/Robust/src/IR/Flat/BuildCodeMultiCore.java +++ b/Robust/src/IR/Flat/BuildCodeMultiCore.java @@ -1611,7 +1611,9 @@ public class BuildCodeMultiCore extends BuildCode { } } // generate codes for profiling, recording how many new objects are created - if((fn.getType().getClassDesc() != null) && (fn.getType().getClassDesc().hasFlags())) { + if(!fn.getType().isArray() && + (fn.getType().getClassDesc() != null) + && (fn.getType().getClassDesc().hasFlags())) { output.println("#ifdef RAWPROFILE"); output.println("addNewObjInfo(\"" + fn.getType().getClassDesc().getSymbol() + "\");"); output.println("#endif"); diff --git a/Robust/src/Makefile.raw.io b/Robust/src/Makefile.raw.io index 93f86f00..d402f10d 100644 --- a/Robust/src/Makefile.raw.io +++ b/Robust/src/Makefile.raw.io @@ -12,7 +12,7 @@ DEFS += -D$(shell uname -s) -D__raw__ TOPDIR=/home/jzhou/starsearch include $(TOPDIR)/Makefile.include -RGCCFLAGS += -O0 +RGCCFLAGS += -O2 RGCCFLAGS += ${RAWRGCCFLAGS} USE_SLGCC=1 diff --git a/Robust/src/Runtime/Queue.c b/Robust/src/Runtime/Queue.c index b00a7d78..33bfcc70 100644 --- a/Robust/src/Runtime/Queue.c +++ b/Robust/src/Runtime/Queue.c @@ -75,7 +75,7 @@ struct QueueItem * getTail(struct Queue * queue) { return queue->tail; } -struct QueueItem * getNext(struct QueueItem * qi) { +struct QueueItem * getNextQueueItem(struct QueueItem * qi) { return qi->next; } diff --git a/Robust/src/Runtime/Queue.h b/Robust/src/Runtime/Queue.h index 01253409..3f368f9a 100644 --- a/Robust/src/Runtime/Queue.h +++ b/Robust/src/Runtime/Queue.h @@ -25,6 +25,6 @@ struct QueueItem * addNewItem_I(struct Queue * queue, void * ptr); struct QueueItem * findItem(struct Queue * queue, void * ptr); void removeItem(struct Queue * queue, struct QueueItem * item); struct QueueItem * getTail(struct Queue * queue); - +struct QueueItem * getNextQueueItem(struct QueueItem * qi); #endif diff --git a/Robust/src/Runtime/multicoretask.c b/Robust/src/Runtime/multicoretask.c index 37bb8f82..aef2a45a 100644 --- a/Robust/src/Runtime/multicoretask.c +++ b/Robust/src/Runtime/multicoretask.c @@ -117,7 +117,7 @@ void releasewritelock(void* ptr); // profiling mode of RAW version #ifdef RAWPROFILE -#define TASKINFOLENGTH 300 +#define TASKINFOLENGTH 10000 //#define INTERRUPTINFOLENGTH 500 bool stall; @@ -1534,7 +1534,7 @@ void transferObject(struct transObjInfo * transObj) { #ifdef RAWDEBUG raw_test_pass_reg(msgsize); #endif - gdn_send(obj); + gdn_send((int)obj); #ifdef RAWDEBUG raw_test_pass_reg(obj); #endif @@ -2157,7 +2157,7 @@ msg: if(prev == NULL) { qitem = getTail(&objqueue); } else { - qitem = getNext(prev); + qitem = getNextQueueItem(prev); } } addNewItem_I(&objqueue, (void *)transObj); @@ -2606,7 +2606,7 @@ bool getreadlock(void * ptr) { #ifdef RAWDEBUG raw_test_pass(0); #endif - gdn_send(ptr); + gdn_send((int)ptr); #ifdef RAWDEBUG raw_test_pass_reg(ptr); #endif @@ -2773,7 +2773,7 @@ void releasereadlock(void * ptr) { #ifdef RAWDEBUG raw_test_pass(0); #endif - gdn_send(ptr); + gdn_send((int)ptr); #ifdef RAWDEBUG raw_test_pass_reg(ptr); raw_test_pass(0xffff); @@ -2908,7 +2908,7 @@ bool getreadlock_I(void * ptr) { #ifdef RAWDEBUG raw_test_pass(0); #endif - gdn_send(ptr); + gdn_send((int)ptr); #ifdef RAWDEBUG raw_test_pass_reg(ptr); #endif @@ -2961,7 +2961,7 @@ void releasereadlock_I(void * ptr) { #ifdef RAWDEBUG raw_test_pass(0); #endif - gdn_send(ptr); + gdn_send((int)ptr); #ifdef RAWDEBUG raw_test_pass_reg(ptr); raw_test_pass(0xffff); @@ -3084,7 +3084,7 @@ bool getwritelock(void * ptr) { #ifdef RAWDEBUG raw_test_pass(1); #endif - gdn_send(ptr); + gdn_send((int)ptr); #ifdef RAWDEBUG raw_test_pass_reg(ptr); #endif @@ -3266,7 +3266,7 @@ void releasewritelock(void * ptr) { #ifdef RAWDEBUG raw_test_pass(1); #endif - gdn_send(ptr); + gdn_send((int)ptr); #ifdef RAWDEBUG raw_test_pass_reg(ptr); raw_test_pass(0xffff); @@ -4074,7 +4074,7 @@ execute: #endif if(tmpparam->numlocks == 0) { numlocks = 1; - locks = tmpparam; + locks = (int*)tmpparam; } else { numlocks = tmpparam->numlocks; locks = tmpparam->locks; @@ -4090,7 +4090,7 @@ execute: struct ___Object___ * tmpparam = (struct ___Object___ *)taskpointerarray[i+OFFSET]; if(tmpparam->numlocks == 0) { numlocks = 1; - locks = tmpparam; + locks = (int*)tmpparam; } else { numlocks = tmpparam->numlocks; locks = tmpparam->locks;