added threaded array
[charm.git] / tests / charm++ / pingpong / pingpong.C
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