12 #if !defined(WIN32) || defined(__CYGWIN__)    26 #define MIN_DEBUG_LEVEL 3    42 Sync::Sync(): INCREASE(600), step(0), counter(0), homeReady(0)
    44     if (CkpvAccess(Sync_instance) == NULL) {
    45         CkpvAccess(Sync_instance) = 
this;
    47         NAMD_bug(
"Sync instanced twice on same processor!");
    50     clist = 
new _clist[capacity];
    66   while ( 2 * reportPe < CkNumPes() ) reportPe *= 2;
    70   if ( CmiNumNodes() < 2 ) useSync = 0;
    71   if ( CmiNumPhysicalNodes() < 2 ) useSync = 0;
    72 #if defined(NAMD_CUDA) || defined(NAMD_HIP) || defined(NAMD_MIC)    81       #if ! (CMK_BLUEGENEQ || CMK_BLUEGENEP)    86 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)    88     if (CkMyNodeSize() > 2) useProxySync = 0;
    98   if(CkMyPe() == reportPe)
    99     iout << 
iINFO << 
"useSync: " << useSync << 
" useProxySync: " << useProxySync << 
"\n" << 
endi;
   105   if (!useSync) 
return 0;
   106   if (step < 0) step = seq;
   110     if (homeReady && seq == step) {
   119   for (; slot < cnum; slot++)
   120      if (clist[slot].pid == -1) 
break;
   124     if (cnum == capacity) {
   125       capacity += INCREASE;
   126       struct _clist *tmp = 
new _clist[capacity];
   127       memcpy(tmp, clist, cnum*
sizeof(_clist));
   134   clist[slot].cbegin = cbegin;
   135   clist[slot].cend = cend;
   136   clist[slot].pid = pid;
   137   clist[slot].doneMigration  = doneMigration;
   138   clist[slot].step = seq;
   142   if (clist[slot].step == step) {
   158 void Sync::releaseComputes()
   164   for (
int i= 0; i<cnum; i++) {
   165     int &pid = clist[i].pid;
   166     if (pid == -1) 
continue;
   167     if (clist[i].step != step) {
   174     Compute **cend = clist[i].cend;
   175     for(
Compute **cid = clist[i].cbegin; cid != cend; cid++) {
   176       (*cid)->patchReady(pid,clist[i].doneMigration,step);
   183 void Sync::triggerCompute()
   188   if (numPatches == -1) 
   194   if (homeReady == 0 && counter >= numHomePatches) {
   197     if (!useProxySync)  releaseComputes();
   200   if (homeReady && nPatcheReady == numPatches)
   204     if (useProxySync) releaseComputes();
   210     for (
int i= 0; i<cnum; i++) {
   211       if (clist[i].pid != -1 && clist[i].step == step) ++nPatcheReady;
   214     if ( numHomePatches ) {
   215       counter -= numHomePatches;
   217       if (counter >= numHomePatches) triggerCompute();
   226 void *frightenCompilerIntoInstantiatingHack(
void) {
   227   return new ArrayElementT<int>;
   232 #include "Sync.def.h" std::ostream & iINFO(std::ostream &s)
 
static ProxyMgr * Object()
 
static PatchMap * Object()
 
std::ostream & endi(std::ostream &s)
 
static int eventReleaseComputes
 
void NAMD_bug(const char *err_msg)
 
static int eventHoldComputes
 
int holdComputes(PatchID pid, Compute **cbegin, Compute **cend, int doneMigration, int seq)