added threaded array
authorGengbin Zheng <gzheng@illinois.edu>
Fri, 26 May 2006 17:00:40 +0000 (17:00 +0000)
committerGengbin Zheng <gzheng@illinois.edu>
Fri, 26 May 2006 17:00:40 +0000 (17:00 +0000)
tests/charm++/pingpong/pingpong.C
tests/charm++/pingpong/pingpong.ci

index a0c96ac9e6b04890edf8dd3c195f1be1de47cea2..0884adbdc7c93eeeacdbb74dde31d52f836d1d73 100644 (file)
@@ -174,7 +174,10 @@ public:
         end_time = CkWallTimer();
         CkPrintf("Roundtrip time for 1D Arrays is %lf us\n",
                  1.0e6*(end_time-start_time)/NITER);
-        mainProxy.maindone();
+        //mainProxy.maindone();
+        niter=0;
+        start_time = CkWallTimer();
+        (*pp)[0].trecv(msg);
       } else {
         (*pp)[1].recv(msg);
       }
@@ -182,6 +185,22 @@ public:
       (*pp)[0].recv(msg);
     }
   }
+  void trecv(PingMsg *msg)
+  {
+    if(thisIndex==0) {
+      niter++;
+      if(niter==NITER) {
+        end_time = CkWallTimer();
+        CkPrintf("Roundtrip time for 1D threaded Arrays is %lf us\n",
+                 1.0e6*(end_time-start_time)/NITER);
+        mainProxy.maindone();
+      } else {
+        (*pp)[1].trecv(msg);
+      }
+    } else {
+      (*pp)[0].trecv(msg);
+    }
+  }
 };
 
 class Ping2 : public ArrayElement2D
index 94080851e87e723eb2c859af6822d0a04f24ad1f..fd56e0f669c39b5521fe2a6c7b559b7274e7dbc7 100644 (file)
@@ -10,6 +10,7 @@ mainmodule pingpong {
     entry Ping1();
     entry void start(void);
     entry void recv(PingMsg *);
+    entry [threaded] void trecv(PingMsg *);
   };           
   array [2D] Ping2 {
     entry Ping2();