Merge branch 'charm' of ejbcharmgit:charm into charm
authorEric Bohm <ebohm@illinois.edu>
Mon, 3 May 2010 20:29:06 +0000 (16:29 -0400)
committerEric Bohm <ebohm@illinois.edu>
Mon, 3 May 2010 20:29:06 +0000 (16:29 -0400)
src/ck-core/ckfutures.C
src/ck-cp/controlPoints.C
src/ck-cp/controlPoints.h

index 4811103eaf361f998f3a53f51739a8a03b033bee..567989dbdfc2f2e8fbb2722328bc7f15fb19fb10 100644 (file)
@@ -184,7 +184,7 @@ void *CkWaitFuture(CkFutureID handle)
   if (!(fut->ready)) {
     CthSetNext(self, fut->waiters);
     fut->waiters = self;
-    CthSuspend();
+    while (!(fut->ready)) CthSuspend();
   }
   fut = (fs->array)+handle;
   value = fut->value;
index 975d8370b96487837c4706502353244216444c9d..574d3ce5811c42674580d50e42c79979f740087a 100644 (file)
@@ -366,6 +366,12 @@ controlPointManager::controlPointManager() {
     haveControlPointChangeCallback = true;
   }
 
+
+/// A user can specify that the framework should advance the phases automatically. Useful for gather performance measurements without modifying a program.
+void controlPointManager::setFrameworkAdvancePhase(bool _frameworkShouldAdvancePhase){
+  frameworkShouldAdvancePhase = _frameworkShouldAdvancePhase;
+}
+
   /// Called periodically by the runtime to handle the control points
   /// Currently called on each PE
   void controlPointManager::processControlPoints(){
@@ -744,7 +750,7 @@ controlPointManager::controlPointManager() {
       prevPhase->idleTime.avg = r[1]/CkNumPes();
       prevPhase->idleTime.max = r[2];
       prevPhase->idleTime.print();
-      CkPrintf("Stored idle time min=%lf in prevPhase=%p\n", prevPhase->idleTime.min, prevPhase);
+      CkPrintf("Stored idle time min=%lf avg=%lf max=%lf in prevPhase=%p\n", prevPhase->idleTime.min, prevPhase->idleTime.avg, prevPhase->idleTime.max, prevPhase);
     } else {
       CkPrintf("There is no previous phase to store the idle time measurements\n");
     }
@@ -831,7 +837,7 @@ controlPointManager::controlPointManager() {
       
       prevPhase->memoryUsageMB = mem[0];
       
-      CkPrintf("Stored idle time min=%lf, mem=%lf in prevPhase=%p\n", (double)prevPhase->idleTime.min, (double)prevPhase->memoryUsageMB, prevPhase);
+      CkPrintf("Stored idle time min=%lf avg=%lf max=%lf  mem=%lf in prevPhase=%p\n", (double)prevPhase->idleTime.min, prevPhase->idleTime.avg, prevPhase->idleTime.max, (double)prevPhase->memoryUsageMB, prevPhase);
 
       double bytesPerInvoke2 = msgBytes[2] / msgBytes[0];
       double bytesPerInvoke3 = msgBytes[3] / msgBytes[1];
@@ -1130,6 +1136,14 @@ void registerCPChangeCallback(CkCallback cb, bool frameworkShouldAdvancePhase){
   controlPointManagerProxy.ckLocalBranch()->setCPCallback(cb, frameworkShouldAdvancePhase);
 }
 
+/// An interface callable by the application.
+void setFrameworkAdvancePhase(bool frameworkShouldAdvancePhase){
+  if(CkMyPe() == 0){
+    CkPrintf("Application has specified that framework should %sadvance phase\n", frameworkShouldAdvancePhase?"":"not ");
+    controlPointManagerProxy.ckLocalBranch()->setFrameworkAdvancePhase(frameworkShouldAdvancePhase);
+  }
+}
+
 /// An interface callable by the application.
 void registerControlPointTiming(double time){
   CkAssert(CkMyPe() == 0);
index 4ab96fe86bc02956f72d2d644849628527f3268b..83b0f81ba36584a3181559a9d5992934b348c7dd 100644 (file)
@@ -62,6 +62,7 @@
 
 
 void registerCPChangeCallback(CkCallback cb, bool frameworkShouldAdvancePhase);
+void setFrameworkAdvancePhase(bool frameworkShouldAdvancePhase);
 
 
 void registerControlPointTiming(double time);
@@ -753,6 +754,8 @@ public:
   /// User can register a callback that is called when application should advance to next phase
   void setCPCallback(CkCallback cb, bool _frameworkShouldAdvancePhase);
 
+  void setFrameworkAdvancePhase(bool _frameworkShouldAdvancePhase);
+
   /// Called periodically by the runtime to handle the control points
   /// Currently called on each PE
   void processControlPoints();