examples: run jacobi for a fixed iter count
authorNikhil Jain <nikhil@illinois.edu>
Mon, 7 Oct 2013 00:32:49 +0000 (19:32 -0500)
committerNikhil Jain <nikhil@illinois.edu>
Mon, 7 Oct 2013 00:32:49 +0000 (19:32 -0500)
examples/charm++/jacobi2d/jacobi2d.C

index 223586a81e501702437b33844aadc97d1eaa6de3..5ae795ecafd9c99db761e2480fe8e7bde8f89421 100644 (file)
@@ -42,6 +42,7 @@ public:
     int receive_count;
     CProxy_Jacobi array;
     int num_chares;
+    int count;
 
     Main(CkArgMsg* m) {
        mainProxy = thisProxy;
@@ -54,6 +55,7 @@ public:
        delete m;
        
        num_rows = num_cols;
+        count = 0;
 
        CkPrintf("Running Jacobi on %d processors with (%d,%d) elements\n",
                 CkNumPes(), num_rows, num_cols);
@@ -82,7 +84,8 @@ public:
 
        receive_count--;
        if (0 == receive_count) {
-           if (max_error < epsilon) {
+            count++;
+           if (max_error < epsilon || count == 100) {
                CkPrintf("All done\n");
                CkExit();
            } else {