Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Sync Class Reference

#include <Sync.h>

Inheritance diagram for Sync:

BOCclass List of all members.

Public Member Functions

 Sync (void)
 ~Sync (void)
void openSync ()
int holdComputes (PatchID pid, ComputeIDListIter cid, int doneMigration)
void PatchReady (void)

Static Public Member Functions

SyncObject ()

Constructor & Destructor Documentation

Sync::Sync void   ) 
 

Definition at line 41 of file Sync.C.

References iERROR(), iFILE, iout, and iPE().

00041           : INCREASE(600), step(0), counter(0), homeReady(0)
00042 {
00043     if (CpvAccess(Sync_instance) == NULL) {
00044         CpvAccess(Sync_instance) = this;
00045     } else {
00046         iout << iFILE << iERROR << iPE
00047           << "Sync instanced twice on same processor!" << endi;
00048         CkExit();
00049     }
00050     capacity = INCREASE;
00051     clist = new _clist[capacity];
00052     cnum = 0;
00053     nPatcheReady = 0;
00054     numPatches = -1;
00055 }

Sync::~Sync void   ) 
 

Definition at line 57 of file Sync.C.

00058 {
00059   delete [] clist;
00060 }


Member Function Documentation

int Sync::holdComputes PatchID  pid,
ComputeIDListIter  cid,
int  doneMigration
 

Definition at line 88 of file Sync.C.

References PatchMap::cid(), ComputeIDListIter, Patch::flags, PatchMap::Object(), PatchMap::patch(), and Flags::sequence.

Referenced by Patch::positionsReady().

00089 {
00090   if (!useProxySync) {
00091     // only hold when homepatches are not ready
00092     PatchMap *patchMap = PatchMap::Object();
00093     if (homeReady) {
00094       triggerCompute();
00095       return 0;
00096     }
00097   }
00098 
00099   int slot = 0;
00100   for (; slot < cnum; slot++)
00101      if (clist[slot].pid == -1) break;
00102   if (slot == cnum) {
00103     cnum++;
00104     // table is full, expand the list
00105     if (cnum == capacity) {
00106       capacity += INCREASE;
00107       struct _clist *tmp = new _clist[capacity];
00108       memcpy(tmp, clist, cnum*sizeof(_clist));
00109       delete [] clist;
00110       clist = tmp;
00111       CmiPrintf("[%d] Info:: Sync buffer overflow and expanded!\n", CmiMyPe());
00112     }
00113   }
00114 
00115   clist[slot].cid = cid;
00116   clist[slot].pid = pid;
00117   clist[slot].doneMigration  = doneMigration;
00118   clist[slot].step = PatchMap::Object()->patch(pid)->flags.sequence;
00119 
00120 //  CkPrintf("REG[%d]: patch:%d step:%d-%d slot:%d\n", CkMyPe(), pid, patchMap->patch(pid)->flags.sequence, step, slot);
00121 
00122   if (clist[slot].step == step) {
00123       nPatcheReady++;
00124       triggerCompute();
00125   }
00126   return 1;
00127 }

Sync* Sync::Object void   )  [inline, static]
 

Definition at line 52 of file Sync.h.

Referenced by Patch::positionsReady(), HomePatch::positionsReady(), and Node::startup().

00052 { return CpvAccess(Sync_instance); }

void Sync::openSync  ) 
 

Definition at line 62 of file Sync.C.

References PatchMap::numHomePatches(), ProxyMgr::numProxies(), PatchMap::Object(), ProxyMgr::Object(), proxySendSpanning, useProxySync, and useSync.

Referenced by Node::startup().

00063 {
00064   if (useSync) {
00065     // if use proxy spanning tree, proxy sync is forced
00066     if (!useProxySync && (proxySendSpanning || proxyRecvSpanning)) {
00067 #if !CMK_IMMEDIATE_MSG
00068       // Dont need proxy sync when immediate messges are turned on
00069       // If on BG/P, useProxySync should not be turned on for better performance
00070       #if !CMK_BLUEGENEP
00071       // CmiPrintf("[%d] useProxySync is turned on. \n", CmiMyPe());
00072       useProxySync = 1;
00073       #endif
00074 #endif
00075     }
00076     // no proxies on this node, no need to use proxy sync.
00077     if (useProxySync && ProxyMgr::Object()->numProxies() == 0) {
00078       // CmiPrintf("[%d] useProxySync is turned off because no proxy. \n", CmiMyPe());
00079       useProxySync = 0;
00080     }
00081     // if no proxy sync and no home patch, then disable home patch sync as well
00082     if (!useProxySync && PatchMap::Object()->numHomePatches() == 0) useSync = 0;
00083   }
00084   // CmiPrintf("[%d] useSync: %d, useProxySync: %d\n", CmiMyPe(), useSync, useProxySync);
00085 }    

void Sync::PatchReady void   ) 
 

Definition at line 130 of file Sync.C.

Referenced by HomePatch::positionsReady().

00131 {
00132   counter ++;
00133   triggerCompute();
00134 }


The documentation for this class was generated from the following files:
Generated on Sun Jul 6 04:07:48 2008 for NAMD by  doxygen 1.3.9.1