Two small changes:
authorOrion Lawlor <olawlor@acm.org>
Mon, 29 Apr 2002 22:30:59 +0000 (22:30 +0000)
committerOrion Lawlor <olawlor@acm.org>
Mon, 29 Apr 2002 22:30:59 +0000 (22:30 +0000)
-Made ReadonlyGlobal pupper accessible from outside.
-Made TCharmDone work even from init()/finalize().

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

index b137ec3a9be36c45100c494f7a0e3b78d80af5c5..72c4389181ca1c86c2de65d07a63454526afbba8 100644 (file)
@@ -297,16 +297,12 @@ void TCharmReadonlys::add(TCpupReadonlyGlobal fn)
 {
        entries.push_back(fn);
 }
+
 //Pups all registered readonlys
-void TCharmReadonlys::pup(PUP::er &p) {
-       if (p.isUnpacking()) {
-               //HACK: Rather than sending this message only where its needed,
-               // we send it everywhere and just ignore it if it's not needed.
-               if (CkMyPe()==0) return; //Processor 0 is the source-- no unpacking needed
-               if (CkMyRank()!=0) return; //Some other processor will do the unpacking
-       }
+void TCharmReadonlys::pupAllReadonlys(PUP::er &p) {
        //Pup the globals for this node:
        int i,n=entries.length();
+       p.comment("TCharm Readonly global variables:");
        p(n);
        if (n!=entries.length())
                CkAbort("TCharmReadonly list length mismatch!\n");
@@ -314,6 +310,16 @@ void TCharmReadonlys::pup(PUP::er &p) {
                (entries[i])((pup_er)&p);
 }
 
+void TCharmReadonlys::pup(PUP::er &p) {
+       if (p.isUnpacking()) {
+               //HACK: Rather than sending this message only where its needed,
+               // we send it everywhere and just ignore it if it's not needed.
+               if (CkMyPe()==0) return; //Processor 0 is the source-- no unpacking needed
+               if (CkMyRank()!=0) return; //Some other processor will do the unpacking
+       }
+       pupAllReadonlys(p);
+}
+
 CDECL void TCharmReadonlyGlobals(TCpupReadonlyGlobal fn)
 {
        TCHARMAPI("TCharmReadonlyGlobals");
@@ -673,7 +679,8 @@ FDECL void FTN_NAME(TCHARM_BARRIER,tcharm_barrier)(void)
 CDECL void TCharmDone(void)
 {
        TCHARMAPI("TCharmDone");
-       TCharm::get()->done();
+       if (TCharm::getState()!=inDriver) CkExit();
+       else TCharm::get()->done();
 }
 FDECL void FTN_NAME(TCHARM_DONE,tcharm_done)(void)
 {
index d17ed79e2087f661a7953eb054ff5100517c9b19..ee4df9353017e27d0affdafba4e81e0a62cf445a 100644 (file)
@@ -23,7 +23,10 @@ class TCharmReadonlys {
        static CkVec<TCpupReadonlyGlobal> entries;
  public:
        static void add(TCpupReadonlyGlobal fn);
-       //Pups all registered readonlys
+       //Pups all registered readonlys 
+       static void pupAllReadonlys(PUP::er &p);
+
+       //Used by parameter marshalling:
        void pup(PUP::er &p);
 };
 PUPmarshall(TCharmReadonlys);