Fixed a bug where argv +mapping is extractly only once on each
authorEsteban Pauli <etpauli2@uiuc.edu>
Mon, 21 Feb 2005 22:08:39 +0000 (22:08 +0000)
committerEsteban Pauli <etpauli2@uiuc.edu>
Mon, 21 Feb 2005 22:08:39 +0000 (22:08 +0000)
node, instead we should do it on each processor.

src/libs/ck-libs/tcharm/tcharm.C

index 5b14d14149e782daa963e5750957ad74aadc8251..6afb221159a62087ec5ed3782d26b1f2d6434c4c 100644 (file)
@@ -55,6 +55,8 @@ static TCharmTraceLibList tcharm_tracelibs;
 static int tcharm_nomig=0, tcharm_nothreads=0;
 static int tcharm_stacksize=1*1024*1024; /*Default stack size is 1MB*/
 static int tcharm_initted=0;
+CkpvDeclare(int, mapCreated);
+static CkGroupID mapID;
 
 void TCharm::nodeInit(void)
 {
@@ -67,6 +69,9 @@ void TCharm::procInit(void)
   tcharm_initted=1;
   CtgInit();
 
+  CkpvInitialize(int, mapCreated);
+  CkpvAccess(mapCreated) = 0;
+
   // called on every pe to eat these arguments
   char **argv=CkGetArgv();
   tcharm_nomig=CmiGetArgFlagDesc(argv,"+tcharm_nomig","Disable migration support (debugging)");
@@ -566,15 +571,13 @@ FDECL void FTN_NAME(TCHARM_CREATE_DATA,tcharm_create_data)
                  void *threadData,int *threadDataLen)
 { TCHARM_Create_data(*nThreads,threadFn,threadData,*threadDataLen); }
 
-static int mapCreated=0;
-static CkGroupID mapID;
 CkGroupID CkCreatePropMap(void);
 
 static CProxy_TCharm TCHARM_Build_threads(TCharmInitMsg *msg)
 {
   char** argv = CkGetArgv();
   CkArrayOptions opts(msg->numElements);
-  if (!mapCreated) {
+  if (CkpvAccess(mapCreated)==0) {
     char* mapping;
     if (0!=CmiGetArgString(argv, "+mapping", &mapping)){
       if(0==strcmp(mapping,"BLOCK_MAP")){
@@ -588,7 +591,7 @@ static CProxy_TCharm TCHARM_Build_threads(TCharmInitMsg *msg)
     } else {
       mapID=CkCreatePropMap();
     }
-    mapCreated=1;
+    CkpvAccess(mapCreated)=1;
   }
   opts.setMap(mapID);
   int nElem=msg->numElements; //<- save it because msg will be deleted.