Fixed a bug in commlib which was cauing it to hang if a strategy was used to send...
authorAbhishek Gupta <gupta59@illinois.edu>
Fri, 29 Oct 2010 23:42:41 +0000 (18:42 -0500)
committerAbhishek Gupta <gupta59@illinois.edu>
Fri, 29 Oct 2010 23:42:41 +0000 (18:42 -0500)
src/ck-com/ComlibManager.C
tests/charm++/commtest/broadcast/broadcast.C
tests/charm++/commtest/broadcast/broadcast.ci

index 0848f460b0fb2ef89971ddadc6b95fcdd7aacd6c..d09d92e2d4a25fb1513fd5cd97a621fcb8d22d7e 100644 (file)
@@ -196,7 +196,7 @@ bool ComlibManager::shouldBufferMessagesNow(int instid){
 void ComlibManager::sendBufferedMessagesAllStrategies(){
   int nstrats = converseManager->getNumStrats();
   for(int i=0;i<nstrats;i++){
-    sendBufferedMessages(i);
+    sendBufferedMessages(i+1);
   }
 }
 
index 19a8d883fe6174f3470961f86b8149633ba70bd1..b4863e2fda65578135ab9acd66183eae537cd485 100644 (file)
@@ -34,24 +34,22 @@ public:
        else numEl = 100;
 
 
-   // comm_debug = 1;
     delete m;
 
     mainProxy = thishandle;
        
     broadcastProxy = CProxy_Broadcast::ckNew();
     
-   // ComlibAssociateProxy(stratBroadcast, broadcastProxy                              );
-       
    // create broadcast strategy using the hypercube topology
-    BroadcastStrategy *strategy = new BroadcastStrategy(USE_TREE);
-  //  PipeBroadcastStrategy *strategy = new PipeBroadcastStrategy(broadcastProxy,USE_TREE);
+    BroadcastStrategy *strategy = new BroadcastStrategy(USE_HYPERCUBE);
+  // PipeBroadcastStrategy *strategy = new PipeBroadcastStrategy(broadcastProxy,USE_TREE);
     stratBroadcast = ComlibRegister(strategy);
 
 //     CkPrintf("Main: Sleeping %d \n", CkNumPes());
 //     usleep(50*1000*1000);
-//     broadcastProxy.TestBroadcast();
-       broadcastProxy.IntermediateCall();
+       broadcastProxy.TestBroadcast();
+//     broadcastProxy.IntermediateCall();
+//     thisProxy.Intermediate1();
        CkPrintf("Main: Started %d \n", CkNumPes());
   }
 
@@ -62,7 +60,23 @@ public:
        broadcastProxy.TestBroadcast();
        }
   }
-  
+   void Intermediate1(){
+    
+       CProxy_Broadcast commBroadcastProxy = broadcastProxy;
+
+       sleep(300);
+       ComlibAssociateProxy(stratBroadcast, commBroadcastProxy);
+    CkPrintf("Associated proxy to commlib  \n");
+
+       char msg[] = "|This is a short broadcast message|";
+    broadcastMessage* b = new(strlen(msg)+1,0) broadcastMessage;
+       
+    memcpy(b->msg, msg, strlen(msg)+1);
+    b->length = strlen(msg);
+
+       commBroadcastProxy.receive(b);
+  }
 
   void exit() {
     nDone++;
@@ -80,27 +94,22 @@ public:
 
   Broadcast() {
 
-//     usleep(50*1000*1000);
     CkPrintf("element %d \n", CkMyPe());
     localProxy = thisProxy;
-//   ComlibAssociateProxy(stratBroadcast, localProxy);
   }
 
   Broadcast(CkMigrateMessage *m) {}
     
   void TestBroadcast() {
 
-  
 //     usleep(50*1000*1000);
          if (CkMyPe() == 0) {
          ComlibAssociateProxy(stratBroadcast, localProxy);
-   //   CkPrintf("Registered element %d of %d \n", CkMyPe(), CkNumPes());
       char msg[] = "|This is a short broadcast message|";
       broadcastMessage* b = new(strlen(msg)+1,0) broadcastMessage;
        
       memcpy(b->msg, msg, strlen(msg)+1);
       b->length = strlen(msg);
-//     usleep(50*1000*1000);
       localProxy.receive(b);
     }
        
@@ -108,9 +117,8 @@ public:
 
   void receive(broadcastMessage* m) {
 
-   // CkPrintf("Received using commlib %d of %d \n", CkMyPe(), CkNumPes());
     CkPrintf("Message: %s arrived at element %d\n", m->msg, CkMyPe());
-   // assert(strcmp(m->msg,"|This is a short broadcast message|") == 0);
+    assert(strcmp(m->msg,"|This is a short broadcast message|") == 0);
     mainProxy.exit();
   
   }
index 2cccfccfa16056bac485a030844dddd7c643c1bf..b5c9b42a65e72d9a8c8926f0c48eda59d49ab7f2 100644 (file)
@@ -12,6 +12,7 @@ mainmodule broadcast {
   mainchare Main {
     entry Main(CkArgMsg *m);
     entry void Intermediate(void);
+    entry void Intermediate1(void);
     entry void exit();         
   };