Added TCHARM_Yeild, to voluentarily temporarily give up the
authorOrion Lawlor <olawlor@acm.org>
Wed, 25 Sep 2002 18:27:20 +0000 (18:27 +0000)
committerOrion Lawlor <olawlor@acm.org>
Wed, 25 Sep 2002 18:27:20 +0000 (18:27 +0000)
processor.  Also added CkBacktrace to trace calls.

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

index 09b1071bbd2cbc7a9c38f8f8ab97af063a6dac8a..2c80db4346aabb396845eafe4a087fad6028f97e 100644 (file)
@@ -85,8 +85,10 @@ void TCHARM_Api_trace(const char *routineName,const char *libraryName)
        TCharm *tc=CtvAccess(_curTCharm);
        char where[100];
        if (tc==NULL) sprintf(where,"[serial context on %d]",CkMyPe());
-       else sprintf(where,"[vp %d, p %d]",tc->getElement(),CkMyPe());
+       else sprintf(where,"[%p> vp %d, p %d]",(void *)tc,tc->getElement(),CkMyPe());
        CmiPrintf("%s Called routine %s\n",where,routineName);
+       CmiPrintStackTrace(1);
+       CmiPrintf("\n");
 }
 
 static void startTCharmThread(TCharmInitMsg *msg)
@@ -664,6 +666,7 @@ static void checkAddress(void *data)
            CkAbort("The UserData you register must be allocated on the stack!\n");
 }
 
+/* Old "register"-based userdata: */
 CDECL int TCHARM_Register(void *data,TCHARM_Pup_fn pfn)
 { 
        TCHARMAPI("TCHARM_Register");
@@ -687,6 +690,7 @@ CDECL void *TCHARM_Get_userdata(int id)
 FDECL void *FTN_NAME(TCHARM_GET_USERDATA,tcharm_get_userdata)(int *id)
 { return TCHARM_Get_userdata(*id); }
 
+/* New hardcoded-ID userdata: */
 CDECL void TCHARM_Set_global(int globalID,void *new_value,TCHARM_Pup_global_fn pup_or_NULL)
 {
        TCHARMAPI("TCHARM_Set_global");
@@ -719,6 +723,16 @@ FDECL void FTN_NAME(TCHARM_MIGRATE,tcharm_migrate)(void)
        TCharm::get()->migrate();
 }
 
+CDECL void TCHARM_Yield(void)
+{
+       TCHARMAPI("TCHARM_Yield");
+       TCharm::get()->schedule();
+}
+FDECL void FTN_NAME(TCHARM_YIELD,tcharm_yield)(void)
+{
+       TCHARM_Yield();
+}
+
 CDECL void TCHARM_Barrier(void)
 {
        TCHARMAPI("TCHARM_Barrier");
index b7969b814cc295f6737dd4b42051f73010d2a50f..81363bc2e5aa8a96673413f4de3e4f575d05c3c9 100644 (file)
@@ -48,6 +48,7 @@ int TCHARM_Num_elements(void);
 void TCHARM_Barrier(void);
 void TCHARM_Migrate(void);
 void TCHARM_Done(void);
+void TCHARM_Yield(void);
 
 /* Set/get thread-private ("thread global") data. */
 typedef void (*TCHARM_Pup_fn)(pup_er p,void *data);
index d27b7c88cb6b40655afa4976470ab486b9a62d31..fc332f43d57dc58e10cb0b50eebb9b6dcb505315 100644 (file)
@@ -10,6 +10,7 @@
 
        external TCHARM_Register
        external TCHARM_Migrate
+       external TCHARM_Yield
        external TCHARM_Done
 
        external TCHARM_Readonly_globals