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 (CkpvAccess(Sync_instance) == NULL) {
00044         CkpvAccess(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 92 of file Sync.C.

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

Referenced by Patch::positionsReady().

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

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 CkpvAccess(Sync_instance); }

void Sync::openSync  ) 
 

Definition at line 62 of file Sync.C.

References iINFO(), iout, 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 (CkMyPe() == 0)
00070       CmiPrintf("[%d] useProxySync is turned on. \n", CkMyPe());
00071       // Dont need proxy sync when immediate messges are turned on
00072       // If on BG/P, useProxySync should not be turned on for better performance
00073       #if !CMK_BLUEGENEP
00074       // CmiPrintf("[%d] useProxySync is turned on. \n", CkMyPe());
00075       useProxySync = 1;
00076       #endif
00077 #endif
00078     }
00079     // no proxies on this node, no need to use proxy sync.
00080     if (useProxySync && ProxyMgr::Object()->numProxies() == 0) {
00081       // CmiPrintf("[%d] useProxySync is turned off because no proxy. \n", CkMyPe());
00082       useProxySync = 0;
00083     }
00084     // if no proxy sync and no home patch, then disable home patch sync as well
00085     if (!useProxySync && PatchMap::Object()->numHomePatches() == 0) useSync = 0;
00086   }
00087   if(CkMyPe() == 0)
00088     iout << iINFO << "useSync: " << useSync << " useProxySync: " << useProxySync << "\n" << endi;
00089 }    

void Sync::PatchReady void   ) 
 

Definition at line 134 of file Sync.C.

Referenced by HomePatch::positionsReady().

00135 {
00136   counter ++;
00137   triggerCompute();
00138 }


The documentation for this class was generated from the following files:
Generated on Thu Nov 5 04:07:28 2009 for NAMD by  doxygen 1.3.9.1