Updates: more correct refine loop. Still need some fixing.
authorYan Shi <yanshi@uiuc.edu>
Mon, 10 Apr 2006 18:39:37 +0000 (18:39 +0000)
committerYan Shi <yanshi@uiuc.edu>
Mon, 10 Apr 2006 18:39:37 +0000 (18:39 +0000)
examples/ampi/Cjacobi3D/Makefile
examples/ampi/Cjacobi3D/jacobi-get.C

index f17d00c7ca6aa4c25f99ff97b064d489ca99ed72..3491c2e2a013ac08ced37662ff6c40101602029c 100644 (file)
@@ -1,4 +1,6 @@
+CHARMBASE=../../../
 CHARMC=../../../bin/charmc $(OPTS)
+TOKENS=6
 
 ampi: jacobi jacobi.iso jacobi-get
 
@@ -16,6 +18,10 @@ jacobi-get: jacobi-get.C
        $(CHARMC) -c jacobi-get.C
        $(CHARMC) -o jacobi-get jacobi-get.o -language ampi -module EveryLB -lm
 
+jacobi-get-tokens:
+       cd $(CHARMBASE)/tmp; touch machine.c; touch ckfutures.C; make AMPI OPTS="-DIGET_FLOWCONTROL=1 -DIGET_TOKENNUM=$(TOKENS)"; cd -; 
+       make jacobi-get;
+
 test: ampi
        ./charmrun +p3 jacobi 2 2 2 +vp8 +balancer RotateLB +LBDebug
        -./charmrun +p3 jacobi.iso 2 2 2 +vp8 +balancer RotateLB +LBDebug
index cbecf997b2b671b01fcf4f0a259ff0dcbb86fc6a..b904f30e19277584a3dbdb4ffe849727f1ca6625 100644 (file)
@@ -200,7 +200,199 @@ int main(int ac, char** av)
             if (error > maxerr) maxerr = error;
           }
 // Add boundary
-    
+//   : k=0 case 
+      k=0;
+      for(i=1; i<DIMZ-1; i++)
+         for(j=1; j<DIMY-1; j++) {
+             tval = (cp->t[k][j][i] + cp->t[k][j][i+1] +
+                   cp->t[k][j][i-1] + cp->t[k][j+1][i]+ 
+                   cp->t[k][j-1][i] + cp->t[k+1][j][i] + (cp->sbzp)[j*DIMZ+i])/6.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+         }
+//   : k=DIMZ-1 case
+      k=DIMZ-1;
+      for(i=1; i<DIMZ-1; i++)
+         for(j=1; j<DIMY-1; j++) {
+             tval = (cp->t[k][j][i] + cp->t[k][j][i+1] +
+                   cp->t[k][j][i-1] + cp->t[k][j+1][i]+ 
+                   cp->t[k][j-1][i] + cp->t[k-1][j][i] +
+(cp->sbzm)[j*DIMZ+i])/7.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+         }
+//   : j=0 case
+      j=0;
+      for(i=1; i<DIMZ-1; i++)
+         for(k=1; k<DIMX-1; k++) {
+            tval = (cp->t[k][j][i] + cp->t[k][j][i+1] +
+                 cp->t[k][j][i-1] + cp->t[k][j+1][i]+ 
+                 (cp->sbyp)[k*DIMZ+i] + cp->t[k+1][j][i] + cp->t[k-1][j][i])/7.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+         }
+//   : j=DIMY-1 case
+      j=DIMY-1;
+      for(i=1; i<DIMZ-1; i++)
+         for(k=1; k<DIMX-1; k++) {
+            tval = (cp->t[k][j][i] + cp->t[k][j][i+1] +
+                 cp->t[k][j][i-1] + (cp->sbym)[k*DIMZ+i]+ 
+                 cp->t[k][j-1][i] + cp->t[k+1][j][i] + cp->t[k-1][j][i])/7.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+         }
+//   : i=0 case
+      i=0;
+      for(j=1; j<DIMY-1; j++)
+         for(k=1; k<DIMX-1; k++) {
+            tval = (cp->t[k][j][i] + cp->t[k][j][i+1] +
+                 (cp->sbzp)[k*DIMY+j] + cp->t[k][j+1][i]+ 
+                 cp->t[k][j-1][i] + cp->t[k+1][j][i] + cp->t[k-1][j][i])/7.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+         }
+//   : i=DIMZ-1 case
+      i=DIMZ-1;
+      for(j=1; j<DIMY-1; j++)
+         for(k=1; k<DIMX-1; k++) {
+            tval = (cp->t[k][j][i] +  cp->sbzm[k*DIMY+j] +
+                 cp->t[k][j][i-1] + cp->t[k][j+1][i]+ 
+                 cp->t[k][j-1][i] + cp->t[k+1][j][i] + cp->t[k-1][j][i])/7.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+         }
+// corner lines case
+//  :i=0, j=0 or DIMY-1 
+      i=0; j=0;  
+      for(k=1; k<DIMX-1; k++) {
+         tval = (cp->t[k][j][i] +  cp->t[k][j][i+1] +
+                 cp->sbzp[k*DIMY+j] + cp->t[k][j+1][i]+ 
+                 cp->sbyp[k*DIMZ+i] + cp->t[k+1][j][i] + cp->t[k-1][j][i])/7.0;
+         error = fabs(tval-cp->t[k][j][i]);
+         cp->t[k][j][i] = tval;
+         if (error > maxerr) maxerr = error;                 
+      }
+      i=0; j=DIMY-1;  
+      for(k=1; k<DIMX-1; k++) {
+         tval = (cp->t[k][j][i] +  cp->t[k][j][i+1] +
+                 cp->sbzp[k*DIMY+j] + cp->sbym[k*DIMZ+i] + 
+                 cp->t[k][j-1][i] + cp->t[k+1][j][i] + cp->t[k-1][j][i])/7.0;
+         error = fabs(tval-cp->t[k][j][i]);
+         cp->t[k][j][i] = tval;
+         if (error > maxerr) maxerr = error;                 
+      }
+//  :i=DIMZ-1, j=0 or DIMY-1 
+      i=DIMZ-1; j=0;  
+      for(k=1; k<DIMX-1; k++) {
+         tval = (cp->t[k][j][i] +  cp->t[k][j][i-1] +
+                 cp->sbzm[k*DIMY+j] + cp->t[k][j+1][i]+ 
+                 cp->sbyp[k*DIMZ+i] + cp->t[k+1][j][i] + cp->t[k-1][j][i])/7.0;
+         error = fabs(tval-cp->t[k][j][i]);
+         cp->t[k][j][i] = tval;
+         if (error > maxerr) maxerr = error;                 
+      }
+      i=DIMZ-1; j=DIMY-1;  
+      for(k=1; k<DIMX-1; k++) {
+         tval = (cp->t[k][j][i] +  cp->t[k][j][i-1] +
+                 cp->sbzm[k*DIMY+j] + cp->sbym[k*DIMZ+i] + 
+                 cp->t[k][j-1][i] + cp->t[k+1][j][i] + cp->t[k-1][j][i])/7.0;
+         error = fabs(tval-cp->t[k][j][i]);
+         cp->t[k][j][i] = tval;
+         if (error > maxerr) maxerr = error;                 
+      }
+//  :i=0, k=0 or DIMX-1
+      i=0; k=0;
+      for(j=1; j<DIMY-1; j++) {
+            tval = (cp->t[k][j][i] + cp->sbzp[k*DIMY+j] +
+                 cp->t[k][j][i+1] + cp->t[k][j+1][i]+ 
+                 cp->t[k][j-1][i] + cp->sbxp[k*DIMX+j] +
+cp->t[k+1][j][i])/7.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+      }
+      i=0; k=DIMX-1;
+      for(j=1; j<DIMY-1; j++) {
+            tval = (cp->t[k][j][i] + cp->sbzp[k*DIMY+j] +
+                 cp->t[k][j][i+1] + cp->t[k][j+1][i]+ 
+                 cp->t[k][j-1][i] + cp->sbxm[k*DIMY+j] + cp->t[k-1][j][i])/7.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+      }
+//  :i=DIMZ-1, k=0 or DIMX-1
+      i=DIMZ-1; k=0;
+      for(j=1; j<DIMY-1; j++) {
+            tval = (cp->t[k][j][i] + cp->sbzm[k*DIMY+j] +
+                 cp->t[k][j][i-1] + cp->t[k][j+1][i]+ 
+                 cp->t[k][j-1][i] + cp->sbxp[k*DIMY+j] + cp->t[k+1][j][i])/7.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+      }
+      i=DIMZ-1; k=DIMX-1;
+      for(j=1; j<DIMY-1; j++) {
+            tval = (cp->t[k][j][i] + cp->sbzm[k*DIMY+j] +
+                 cp->t[k][j][i-1] + cp->t[k][j+1][i]+ 
+                 cp->t[k][j-1][i] + cp->sbxm[k*DIMY+j] + cp->t[k-1][j][i])/7.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+      }
+
+//  :j=0 k=0 or DIMX-1, 
+      j=0; k=0;            
+      for(i=1; i<DIMZ-1; i++){
+             tval = (cp->t[k][j][i] + cp->t[k][j][i+1] +
+                 cp->t[k][j][i-1] + cp->t[k][j+1][i]+ 
+                 cp->sbyp[k*DIMZ+i] + cp->t[k+1][j][i] +
+cp->sbxp[j*DIMZ+i])/7.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+         }
+      j=0; k=DIMY-1;       
+      for(i=1; i<DIMZ-1; i++){
+             tval = (cp->t[k][j][i] + cp->t[k][j][i+1] +
+                 cp->t[k][j][i-1] + cp->t[k][j+1][i]+ 
+                 cp->sbyp[k*DIMZ+i] + cp->t[k-1][j][i] +
+cp->sbxm[j*DIMZ+i])/7.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+         }
+
+//  :j=DIMY-1, k=0 or DIMX-1 
+      j=DIMY-1; k=0;       
+      for(i=1; i<DIMZ-1; i++){
+             tval = (cp->t[k][j][i] + cp->t[k][j][i+1] +
+                 cp->t[k][j][i-1] + cp->t[k][j-1][i]+ 
+                 cp->sbym[k*DIMZ+i] + cp->t[k+1][j][i] +
+cp->sbxp[j*DIMZ+i])/7.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+         }
+      j=DIMY-1; k=DIMY-1;          
+      for(i=1; i<DIMZ-1; i++){
+             tval = (cp->t[k][j][i] + cp->t[k][j][i+1] +
+                 cp->t[k][j][i-1] + cp->t[k][j-1][i]+ 
+                 cp->sbym[k*DIMZ+i] + cp->t[k-1][j][i] +
+cp->sbxm[j*DIMZ+i])/7.0;
+            error = fabs(tval-cp->t[k][j][i]);
+            cp->t[k][j][i] = tval;
+            if (error > maxerr) maxerr = error;                      
+         }
+
+// corner points case
+
+
     }
 
     MPI_IGet_Free(&reqxp, &stsxp, win);