jacobi3d: semantic fixes for top and bottom planes
authorAbhinav S Bhatele <bhatele@illinois.edu>
Sun, 19 Dec 2010 20:23:49 +0000 (14:23 -0600)
committerAbhinav S Bhatele <bhatele@illinois.edu>
Sun, 19 Dec 2010 20:23:49 +0000 (14:23 -0600)
examples/bigsim/sdag/jacobi3d/jacobi3d.C
examples/charm++/jacobi3d-sdag/jacobi3d.C

index d75b7586d296e0f041f778c7956bf011f2304a0e..98d65ba277f43e9e946d41cd82a16e9cede8da29 100644 (file)
@@ -272,8 +272,10 @@ class Jacobi: public CBase_Jacobi {
     // Send ghost faces to the six neighbors
     void begin_iteration(void) {
       if (thisIndex.x == 0 && thisIndex.y == 0 && thisIndex.z == 0) {
     // Send ghost faces to the six neighbors
     void begin_iteration(void) {
       if (thisIndex.x == 0 && thisIndex.y == 0 && thisIndex.z == 0) {
-          CkPrintf("Start of iteration %d\n", iterations);
-          BgPrintf("BgPrint> Start of iteration at %f\n");
+        CkPrintf("Start of iteration %d\n", iterations);
+#if CMK_BLUEGENE_CHARM
+        BgPrintf("BgPrint> Start of iteration at %f\n");
+#endif
       }
       iterations++;
 
       }
       iterations++;
 
@@ -296,28 +298,28 @@ class Jacobi: public CBase_Jacobi {
        for(int k=0; k<blockDimZ; ++k) {
          leftMsg->gh[k*blockDimY+j] = temperature[index(1, j+1, k+1)];
          rightMsg->gh[k*blockDimY+j] = temperature[index(blockDimX, j+1, k+1)];
        for(int k=0; k<blockDimZ; ++k) {
          leftMsg->gh[k*blockDimY+j] = temperature[index(1, j+1, k+1)];
          rightMsg->gh[k*blockDimY+j] = temperature[index(blockDimX, j+1, k+1)];
-      }
+       }
 
       for(int i=0; i<blockDimX; ++i) 
        for(int k=0; k<blockDimZ; ++k) {
          topMsg->gh[k*blockDimX+i] = temperature[index(i+1, 1, k+1)];
          bottomMsg->gh[k*blockDimX+i] = temperature[index(i+1, blockDimY, k+1)];
 
       for(int i=0; i<blockDimX; ++i) 
        for(int k=0; k<blockDimZ; ++k) {
          topMsg->gh[k*blockDimX+i] = temperature[index(i+1, 1, k+1)];
          bottomMsg->gh[k*blockDimX+i] = temperature[index(i+1, blockDimY, k+1)];
-      }
+       }
 
       for(int i=0; i<blockDimX; ++i) 
        for(int j=0; j<blockDimY; ++j) {
          frontMsg->gh[j*blockDimX+i] = temperature[index(i+1, j+1, 1)];
          backMsg->gh[j*blockDimX+i] = temperature[index(i+1, j+1, blockDimZ)];
 
       for(int i=0; i<blockDimX; ++i) 
        for(int j=0; j<blockDimY; ++j) {
          frontMsg->gh[j*blockDimX+i] = temperature[index(i+1, j+1, 1)];
          backMsg->gh[j*blockDimX+i] = temperature[index(i+1, j+1, blockDimZ)];
-      }
+       }
 
       // Send my left face
       thisProxy(wrap_x(thisIndex.x-1), thisIndex.y, thisIndex.z).receiveGhosts(leftMsg);
       // Send my right face
       thisProxy(wrap_x(thisIndex.x+1), thisIndex.y, thisIndex.z).receiveGhosts(rightMsg);
 
       // Send my left face
       thisProxy(wrap_x(thisIndex.x-1), thisIndex.y, thisIndex.z).receiveGhosts(leftMsg);
       // Send my right face
       thisProxy(wrap_x(thisIndex.x+1), thisIndex.y, thisIndex.z).receiveGhosts(rightMsg);
-      // Send my top face
-      thisProxy(thisIndex.x, wrap_y(thisIndex.y-1), thisIndex.z).receiveGhosts(topMsg);
       // Send my bottom face
       // Send my bottom face
-      thisProxy(thisIndex.x, wrap_y(thisIndex.y+1), thisIndex.z).receiveGhosts(bottomMsg);
+      thisProxy(thisIndex.x, wrap_y(thisIndex.y-1), thisIndex.z).receiveGhosts(bottomMsg);
+      // Send my top face
+      thisProxy(thisIndex.x, wrap_y(thisIndex.y+1), thisIndex.z).receiveGhosts(topMsg);
       // Send my front face
       thisProxy(thisIndex.x, thisIndex.y, wrap_z(thisIndex.z-1)).receiveGhosts(frontMsg);
       // Send my back face
       // Send my front face
       thisProxy(thisIndex.x, thisIndex.y, wrap_z(thisIndex.z-1)).receiveGhosts(frontMsg);
       // Send my back face
@@ -333,37 +335,37 @@ class Jacobi: public CBase_Jacobi {
          for(int j=0; j<height; ++j) 
            for(int k=0; k<width; ++k) {
              temperature[index(0, j+1, k+1)] = gmsg->gh[k*height+j];
          for(int j=0; j<height; ++j) 
            for(int k=0; k<width; ++k) {
              temperature[index(0, j+1, k+1)] = gmsg->gh[k*height+j];
-         }
+           }
          break;
        case RIGHT:
          for(int j=0; j<height; ++j) 
            for(int k=0; k<width; ++k) {
              temperature[index(blockDimX+1, j+1, k+1)] = gmsg->gh[k*height+j];
          break;
        case RIGHT:
          for(int j=0; j<height; ++j) 
            for(int k=0; k<width; ++k) {
              temperature[index(blockDimX+1, j+1, k+1)] = gmsg->gh[k*height+j];
-         }
+           }
          break;
          break;
-       case TOP:
+       case BOTTOM:
          for(int i=0; i<height; ++i) 
            for(int k=0; k<width; ++k) {
              temperature[index(i+1, 0, k+1)] = gmsg->gh[k*height+i];
          for(int i=0; i<height; ++i) 
            for(int k=0; k<width; ++k) {
              temperature[index(i+1, 0, k+1)] = gmsg->gh[k*height+i];
-         }
+           }
          break;
          break;
-       case BOTTOM:
+       case TOP:
          for(int i=0; i<height; ++i) 
            for(int k=0; k<width; ++k) {
              temperature[index(i+1, blockDimY+1, k+1)] = gmsg->gh[k*height+i];
          for(int i=0; i<height; ++i) 
            for(int k=0; k<width; ++k) {
              temperature[index(i+1, blockDimY+1, k+1)] = gmsg->gh[k*height+i];
-         }
+           }
          break;
        case FRONT:
          for(int i=0; i<height; ++i) 
            for(int j=0; j<width; ++j) {
          break;
        case FRONT:
          for(int i=0; i<height; ++i) 
            for(int j=0; j<width; ++j) {
-             temperature[index(i+1, j+1, blockDimZ+1)] = gmsg->gh[j*height+i];
-         }
+             temperature[index(i+1, j+1, 0)] = gmsg->gh[j*height+i];
+           }
          break;
        case BACK:
          for(int i=0; i<height; ++i) 
            for(int j=0; j<width; ++j) {
          break;
        case BACK:
          for(int i=0; i<height; ++i) 
            for(int j=0; j<width; ++j) {
-             temperature[index(i+1, j+1, 0)] = gmsg->gh[j*height+i];
-         }
+             temperature[index(i+1, j+1, blockDimZ+1)] = gmsg->gh[j*height+i];
+           }
          break;
        default:
           CkAbort("ERROR\n");
          break;
        default:
           CkAbort("ERROR\n");
index 2a73a4800bc803c438fdc539b82443150e9f78d0..2f2666463e6a5dc6f388aa92c51d4c77719d746f 100644 (file)
@@ -238,12 +238,12 @@ class Jacobi: public CBase_Jacobi {
       // Send my right face
       thisProxy(wrap_x(thisIndex.x+1), thisIndex.y, thisIndex.z)
          .receiveGhosts(iterations, LEFT, blockDimY, blockDimZ, rightGhost);
       // Send my right face
       thisProxy(wrap_x(thisIndex.x+1), thisIndex.y, thisIndex.z)
          .receiveGhosts(iterations, LEFT, blockDimY, blockDimZ, rightGhost);
-      // Send my top face
-      thisProxy(thisIndex.x, wrap_y(thisIndex.y-1), thisIndex.z)
-         .receiveGhosts(iterations, BOTTOM, blockDimX, blockDimZ, topGhost);
       // Send my bottom face
       // Send my bottom face
-      thisProxy(thisIndex.x, wrap_y(thisIndex.y+1), thisIndex.z)
+      thisProxy(thisIndex.x, wrap_y(thisIndex.y-1), thisIndex.z)
          .receiveGhosts(iterations, TOP, blockDimX, blockDimZ, bottomGhost);
          .receiveGhosts(iterations, TOP, blockDimX, blockDimZ, bottomGhost);
+      // Send my top face
+      thisProxy(thisIndex.x, wrap_y(thisIndex.y+1), thisIndex.z)
+         .receiveGhosts(iterations, BOTTOM, blockDimX, blockDimZ, topGhost);
       // Send my front face
       thisProxy(thisIndex.x, thisIndex.y, wrap_z(thisIndex.z-1))
          .receiveGhosts(iterations, BACK, blockDimX, blockDimY, frontGhost);
       // Send my front face
       thisProxy(thisIndex.x, thisIndex.y, wrap_z(thisIndex.z-1))
          .receiveGhosts(iterations, BACK, blockDimX, blockDimY, frontGhost);
@@ -266,13 +266,13 @@ class Jacobi: public CBase_Jacobi {
              temperature[index(blockDimX+1, j+1, k+1)] = gh[k*height+j];
            }
          break;
              temperature[index(blockDimX+1, j+1, k+1)] = gh[k*height+j];
            }
          break;
-       case TOP:
+       case BOTTOM:
          for(int k=0; k<width; ++k)
            for(int i=0; i<height; ++i) {
              temperature[index(i+1, 0, k+1)] = gh[k*height+i];
            }
          break;
          for(int k=0; k<width; ++k)
            for(int i=0; i<height; ++i) {
              temperature[index(i+1, 0, k+1)] = gh[k*height+i];
            }
          break;
-       case BOTTOM:
+       case TOP:
          for(int k=0; k<width; ++k)
            for(int i=0; i<height; ++i) {
              temperature[index(i+1, blockDimY+1, k+1)] = gh[k*height+i];
          for(int k=0; k<width; ++k)
            for(int i=0; i<height; ++i) {
              temperature[index(i+1, blockDimY+1, k+1)] = gh[k*height+i];
@@ -281,13 +281,13 @@ class Jacobi: public CBase_Jacobi {
        case FRONT:
          for(int j=0; j<width; ++j)
            for(int i=0; i<height; ++i) {
        case FRONT:
          for(int j=0; j<width; ++j)
            for(int i=0; i<height; ++i) {
-             temperature[index(i+1, j+1, blockDimZ+1)] = gh[j*height+i];
+             temperature[index(i+1, j+1, 0)] = gh[j*height+i];
            }
          break;
        case BACK:
          for(int j=0; j<width; ++j)
            for(int i=0; i<height; ++i) {
            }
          break;
        case BACK:
          for(int j=0; j<width; ++j)
            for(int i=0; i<height; ++i) {
-             temperature[index(i+1, j+1, 0)] = gh[j*height+i];
+             temperature[index(i+1, j+1, blockDimZ+1)] = gh[j*height+i];
            }
          break;
        default:
            }
          break;
        default: