ProxyPatch Class Reference

#include <ProxyPatch.h>

Inheritance diagram for ProxyPatch:
Patch

List of all members.

Public Member Functions

 ProxyPatch (PatchID pd)
virtual ~ProxyPatch (void)
void receiveData (ProxyDataMsg *)
void receiveAll (ProxyDataMsg *)
void receiveData (ProxyGBISP2DataMsg *)
void receiveData (ProxyGBISP3DataMsg *)
void setSpanningTree (int, int *, int)
int getSpanningTreeParent ()
int getSpanningTreeChild (int *)
const int * getSpanningTreeChildPtr ()
int getSpanningTreeNChild (void)
ProxyCombinedResultMsgdepositCombinedResultMsg (ProxyCombinedResultMsg *)
ProxyCombinedResultMsgdepositCombinedResultRawMsg (ProxyCombinedResultRawMsg *)

Protected Member Functions

virtual void boxClosed (int)

Detailed Description

Definition at line 19 of file ProxyPatch.h.


Constructor & Destructor Documentation

ProxyPatch::ProxyPatch ( PatchID  pd  ) 

Definition at line 26 of file ProxyPatch.C.

References Patch::child, DebugM, Patch::nChild, Patch::numAtoms, PatchMap::Object(), ProxyMgr::Object(), Patch::patchID, proxySpanDim, and ProxyMgr::registerProxy().

00026                                  : 
00027   Patch(pd), proxyMsgBufferStatus(PROXYMSGNOTBUFFERED), 
00028   curProxyMsg(NULL), prevProxyMsg(NULL)
00029 {
00030   DebugM(4, "ProxyPatch(" << pd << ") at " << this << "\n");
00031   ProxyMgr::Object()->registerProxy(patchID);
00032   numAtoms = -1;
00033   parent = -1;
00034 
00035 #ifndef NODEAWARE_PROXY_SPANNINGTREE
00036   nChild = 0;
00037   child = new int[proxySpanDim];
00038 #endif
00039 
00040 #if CMK_PERSISTENT_COMM && USE_PERSISTENT_TREE
00041   localphs = 0;
00042 #ifdef REMOVE_PROXYRESULTMSG_EXTRACOPY
00043   int msgstart = sizeof(envelope)+sizeof(ProxyResultVarsizeMsg);
00044 #else
00045   int msgstart = sizeof(envelope)+sizeof(ProxyResultMsg);
00046 #endif
00047   localphs = CmiCreatePersistent(PatchMap::Object()->node(patchID), 30000, msgstart);
00048   ntreephs = 0;
00049 #ifdef NODEAWARE_PROXY_SPANNINGTREE
00050   treephs = NULL;
00051 #else
00052   treephs = new PersistentHandle[proxySpanDim];
00053 #endif
00054 #endif
00055 
00056   // DMK - Atom Separation (water vs. non-water)
00057   #if NAMD_SeparateWaters != 0
00058     numWaterAtoms = -1;
00059   #endif
00060   
00061   #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
00062     depositLock = CmiCreateLock();
00063   #endif
00064 }

ProxyPatch::~ProxyPatch ( void   )  [virtual]

Definition at line 66 of file ProxyPatch.C.

References Patch::atomMapper, ResizeArray< Elem >::begin(), Patch::child, DebugM, ResizeArray< Elem >::end(), Patch::lcpoType, ProxyMgr::Object(), Patch::p, Patch::patchID, Patch::pExt, ResizeArray< Elem >::resize(), AtomMapper::unregisterIDsCompAtomExt(), and ProxyMgr::unregisterProxy().

00067 {
00068   DebugM(4, "ProxyPatch(" << patchID << ") deleted at " << this << "\n");
00069   ProxyMgr::Object()->unregisterProxy(patchID);
00070 
00071   // ProxyPatch may be freed because of load balancing if the compute object
00072   // it corresponds to no longer exist on this specific processor.
00073   CmiAssert(prevProxyMsg!=NULL);
00074   if(prevProxyMsg!=NULL) {
00075 // #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00076 //       AtomMap::Object()->unregisterIDs(patchID,positionPtrBegin, positionPtrEnd);
00077 // #else
00078       atomMapper->unregisterIDsCompAtomExt(pExt.begin(),pExt.end());
00079 // #endif      
00080 #if ! CMK_PERSISTENT_COMM || ! USE_PERSISTENT_TREE
00081       delete prevProxyMsg;
00082 #endif
00083       prevProxyMsg = NULL;
00084   }
00085 
00086 
00087 #ifdef NODEAWARE_PROXY_SPANNINGTREE
00088   #ifdef USE_NODEPATCHMGR
00089   delete [] nodeChildren;  
00090   #endif
00091 #endif
00092   delete [] child;
00093 
00094   p.resize(0);
00095   pExt.resize(0);
00096 
00097   lcpoType.resize(0);
00098 
00099 #if CMK_PERSISTENT_COMM && USE_PERSISTENT_TREE
00100   CmiDestoryPersistent(localphs);
00101   localphs = 0;
00102   for (int i=0; i<ntreephs; i++)  CmiDestoryPersistent(treephs[i]);
00103   delete [] treephs;
00104 #endif
00105 }


Member Function Documentation

void ProxyPatch::boxClosed ( int  box  )  [protected, virtual]

Implements Patch.

Definition at line 107 of file ProxyPatch.C.

References Patch::boxesOpen, DebugM, Patch::dEdaSum, ProxyGBISP2ResultMsg::dEdaSum, ProxyGBISP2ResultMsg::dEdaSumLen, Flags::doFullElectrostatics, Flags::doNonbonded, Patch::flags, GB1_PROXY_RESULTS_PRIORITY, GB2_PROXY_RESULTS_PRIORITY, Patch::numAtoms, ProxyMgr::Object(), ProxyGBISP2ResultMsg::origPe, ProxyGBISP1ResultMsg::origPe, ProxyGBISP2ResultMsg::patch, ProxyGBISP1ResultMsg::patch, PATCH_PRIORITY, Patch::patchID, PRIORITY_SIZE, PROXYALLMSGBUFFERED, PROXYDATAMSGBUFFERED, Patch::psiSum, ProxyGBISP1ResultMsg::psiSum, ProxyGBISP1ResultMsg::psiSumLen, receiveAll(), receiveData(), ProxyMgr::sendResult(), Flags::sequence, and SET_PRIORITY.

00107                                   {
00108   ProxyGBISP1ResultMsg *msg1;
00109   ProxyGBISP2ResultMsg *msg2;
00110  
00111   if (box == 1) { // force Box
00112     // Note: delay the deletion of proxyDataMsg (of the 
00113     // current step) until the next step. This is done 
00114     // for the sake of atom migration (ProxyDataMsg) 
00115     // as the ProxyPatch has to  unregister the atoms 
00116     // of the previous step in the AtomMap data structure 
00117     // also denotes end of gbis phase 3
00118     sendResults();
00119   } else if ( box == 5) {//end phase 1
00120     //this msg should only have nonzero atoms if flags.doNonbonded
00121     int msgAtoms = (flags.doNonbonded) ? numAtoms : 0;
00122     msg1 = new (msgAtoms,PRIORITY_SIZE) ProxyGBISP1ResultMsg;
00123     for (int i = 0; i < msgAtoms; i++) {
00124       msg1->psiSum[i] = psiSum[i];
00125     }
00126     msg1->patch = patchID;
00127     msg1->psiSumLen = msgAtoms;
00128     msg1->origPe = CkMyPe();
00129     SET_PRIORITY(msg1,flags.sequence,GB1_PROXY_RESULTS_PRIORITY + PATCH_PRIORITY(patchID));
00130     ProxyMgr::Object()->sendResult(msg1);
00131   } else if ( box == 8) {//end phase 2
00132     //this msg should only have nonzero atoms if flags.doFullElectrostatics
00133     int msgAtoms = (flags.doFullElectrostatics) ? numAtoms : 0;
00134     msg2 = new (msgAtoms,PRIORITY_SIZE) ProxyGBISP2ResultMsg;
00135     for (int i = 0; i < msgAtoms; i++) {
00136       msg2->dEdaSum[i] = dEdaSum[i];
00137     }
00138     msg2->patch = patchID;
00139     msg2->dEdaSumLen = msgAtoms;
00140     msg2->origPe = CkMyPe();
00141     SET_PRIORITY(msg2,flags.sequence,GB2_PROXY_RESULTS_PRIORITY + PATCH_PRIORITY(patchID));
00142     ProxyMgr::Object()->sendResult(msg2);
00143   } else if (box == 9) {
00144     //nothing
00145   } else if (box == 10) {
00146     // LCPO do nothing
00147   }
00148 
00149 
00150   if ( ! --boxesOpen ) {
00151     DebugM(2,patchID << ": " << "Checking message buffer.\n");    
00152     
00153     if(proxyMsgBufferStatus == PROXYALLMSGBUFFERED) {
00154           CmiAssert(curProxyMsg != NULL);
00155           DebugM(3,"Patch " << patchID << " processing buffered proxy ALL data.\n");
00156           receiveAll(curProxyMsg);          
00157     }else if(proxyMsgBufferStatus == PROXYDATAMSGBUFFERED) {
00158           CmiAssert(curProxyMsg != NULL);
00159           DebugM(3,"Patch " << patchID << " processing buffered proxy data.\n");
00160           receiveData(curProxyMsg);
00161     }
00162   } else {
00163        DebugM(3,"ProxyPatch " << patchID << ": " << boxesOpen << " boxes left to close.\n");
00164   }
00165 }

ProxyCombinedResultMsg * ProxyPatch::depositCombinedResultMsg ( ProxyCombinedResultMsg msg  ) 

Definition at line 476 of file ProxyPatch.C.

References ResizeArray< Elem >::add(), ResizeArray< Elem >::begin(), ResizeArray< Elem >::end(), ProxyCombinedResultMsg::forceList, ProxyCombinedResultMsg::nodes, Vector::x, Vector::y, and Vector::z.

Referenced by ProxyMgr::sendResults().

00476                                                                                         {
00477 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
00478   CmiLock(depositLock);
00479 #endif
00480   nWait++;
00481   if (nWait == 1) msgCBuffer = msg;
00482   else {
00483     NodeIDList::iterator n_i, n_e;
00484     n_i = msg->nodes.begin();
00485     n_e = msg->nodes.end();
00486     for (; n_i!=n_e; ++n_i) msgCBuffer->nodes.add(*n_i);
00487     for ( int k = 0; k < Results::maxNumForces; ++k )
00488     {
00489     register ForceList::iterator r_i;
00490     r_i = msgCBuffer->forceList[k]->begin();
00491     register ForceList::iterator f_i, f_e;
00492     f_i = msg->forceList[k]->begin();
00493     f_e = msg->forceList[k]->end();
00494     //    for ( ; f_i != f_e; ++f_i, ++r_i ) *r_i += *f_i;
00495 
00496     int nf = f_e - f_i;
00497 #ifdef ARCH_POWERPC
00498 #pragma disjoint (*f_i, *r_i)
00499 #pragma unroll(4)
00500 #endif
00501     for (int count = 0; count < nf; count++) {
00502       r_i[count].x += f_i[count].x;      
00503       r_i[count].y += f_i[count].y;      
00504       r_i[count].z += f_i[count].z;
00505     }
00506 
00507     }
00508     delete msg;
00509   }
00510 //CkPrintf("[%d:%d] wait: %d of %d (%d %d %d)\n", CkMyPe(), patchID, nWait, nChild+1, parent, child[0],child[1]);
00511   if (nWait == nChild + 1) {
00512     nWait = 0;
00513 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
00514     CmiUnlock(depositLock);
00515 #endif
00516     
00517     return msgCBuffer;
00518   }
00519 
00520 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
00521   CmiUnlock(depositLock);
00522 #endif
00523 
00524   return NULL;
00525 }

ProxyCombinedResultMsg * ProxyPatch::depositCombinedResultRawMsg ( ProxyCombinedResultRawMsg msg  ) 

Definition at line 540 of file ProxyPatch.C.

References ResizeArray< Elem >::add(), ResizeArray< Elem >::begin(), ProxyCombinedResultRawMsg::flLen, ProxyCombinedResultRawMsg::forceArr, ProxyCombinedResultMsg::forceList, ProxyCombinedResultMsg::fromRaw(), ProxyCombinedResultRawMsg::isForceNonZero, ProxyCombinedResultRawMsg::nodes, ProxyCombinedResultMsg::nodes, ProxyCombinedResultRawMsg::nodeSize, Vector::x, Vector::y, and Vector::z.

Referenced by NodeProxyMgr::recvImmediateResults(), and ProxyMgr::recvImmediateResults().

00540                                                                                               {
00541 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
00542   CmiLock(depositLock);
00543 #endif
00544   nWait++;
00545   if (nWait == 1) msgCBuffer = ProxyCombinedResultMsg::fromRaw(msg);
00546   else {
00547     for (int i=0; i<msg->nodeSize; i++) msgCBuffer->nodes.add(msg->nodes[i]);
00548 
00549     register char* isNonZero = msg->isForceNonZero;
00550         register Force* f_i = msg->forceArr;
00551         for ( int k = 0; k < Results::maxNumForces; ++k )
00552     {
00553                 register ForceList::iterator r_i;
00554                 r_i = msgCBuffer->forceList[k]->begin();
00555         int nf = msg->flLen[k];
00556 
00557 #ifdef ARCH_POWERPC
00558 #pragma disjoint (*f_i, *r_i)
00559 #endif
00560                 for (int count = 0; count < nf; count++) {
00561                         if(*isNonZero){
00562                                 r_i[count].x += f_i->x;
00563                                 r_i[count].y += f_i->y;
00564                                 r_i[count].z += f_i->z;
00565                                 f_i++;
00566                         }
00567                         isNonZero++;
00568                 }
00569     }
00570     delete msg;
00571   }
00572 //CkPrintf("[%d:%d] wait: %d of %d (%d %d %d)\n", CkMyPe(), patchID, nWait, nChild+1, parent, child[0],child[1]);
00573   if (nWait == nChild + 1) {
00574     nWait = 0;
00575 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
00576     CmiUnlock(depositLock);
00577 #endif
00578 
00579     return msgCBuffer;
00580   }
00581 
00582 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
00583   CmiUnlock(depositLock);
00584 #endif
00585 
00586   return NULL;
00587 }

int ProxyPatch::getSpanningTreeChild ( int *  c  ) 

Definition at line 471 of file ProxyPatch.C.

References Patch::child.

00471                                            { 
00472   for (int i=0; i<nChild; i++) c[i] = child[i];
00473   return nChild;
00474 }

const int* ProxyPatch::getSpanningTreeChildPtr (  )  [inline]

Definition at line 35 of file ProxyPatch.h.

References Patch::child.

Referenced by ProxyMgr::recvImmediateProxyAll(), and ProxyMgr::recvImmediateProxyData().

00035 { return child; }

int ProxyPatch::getSpanningTreeNChild ( void   )  [inline]

Definition at line 36 of file ProxyPatch.h.

References Patch::nChild.

Referenced by ProxyMgr::recvImmediateProxyAll(), and ProxyMgr::recvImmediateProxyData().

00036 { return nChild; }

int ProxyPatch::getSpanningTreeParent (  )  [inline]

Definition at line 33 of file ProxyPatch.h.

Referenced by NodeProxyMgr::recvImmediateResults(), ProxyMgr::recvImmediateResults(), and ProxyMgr::sendResults().

00033 { return parent; }

void ProxyPatch::receiveAll ( ProxyDataMsg msg  ) 

Definition at line 245 of file ProxyPatch.C.

References Patch::atomMapper, ProxyDataMsg::avgPlLen, ProxyDataMsg::avgPositionList, Patch::avgPositionPtrBegin, Patch::avgPositionPtrEnd, ResizeArray< Elem >::begin(), Patch::boxesOpen, ProxyDataMsg::cudaAtomList, Patch::cudaAtomPtr, DebugM, Flags::doGBIS, Flags::doLCPO, ResizeArray< Elem >::end(), ProxyDataMsg::flags, Patch::flags, Patch::intRad, ProxyDataMsg::intRadList, Patch::lcpoType, ProxyDataMsg::lcpoTypeList, NAMD_bug(), Patch::numAtoms, Node::Object(), Patch::p, Patch::patchID, Patch::pExt, ProxyDataMsg::plExtLen, ProxyDataMsg::plLen, ProxyDataMsg::positionExtList, ProxyDataMsg::positionList, Patch::positionsReady(), PROXYALLMSGBUFFERED, ResizeArray< Elem >::resize(), Node::simParameters, AtomMapper::unregisterIDsCompAtomExt(), SimParameters::useAVXTiles, ProxyDataMsg::velocityList, Patch::velocityPtrBegin, Patch::velocityPtrEnd, and ProxyDataMsg::vlLen.

Referenced by boxClosed(), and ProxyMgr::recvProxyAll().

00246 {
00247   DebugM(3, "receiveAll(" << patchID << ")\n");
00248 
00249   if ( boxesOpen )
00250   {
00251     proxyMsgBufferStatus = PROXYALLMSGBUFFERED;    
00252     curProxyMsg = msg;
00253     return;
00254   }  
00255 
00256   //The prevProxyMsg has to be deleted after this if-statement because
00257   // positionPtrBegin points to the space inside the prevProxyMsg
00258   if(prevProxyMsg!=NULL) {
00259 // #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00260 //       AtomMap::Object()->unregisterIDs(patchID,positionPtrBegin,positionPtrEnd);
00261 // #else
00262       atomMapper->unregisterIDsCompAtomExt(pExt.begin(), pExt.end());
00263 // #endif
00264   }
00265   //Now delete the ProxyDataMsg of the previous step
00266 #if ! CMK_PERSISTENT_COMM || ! USE_PERSISTENT_TREE
00267   delete prevProxyMsg;
00268 #endif
00269   curProxyMsg = msg;
00270   prevProxyMsg = curProxyMsg;
00271 
00272   flags = msg->flags;
00273 
00274 #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00275   if ( ((int64)msg->positionList) % 32 ) { // not aligned
00276     p.resize(msg->plLen);
00277     positionPtrBegin = p.begin();
00278     memcpy(positionPtrBegin, msg->positionList, sizeof(CompAtom)*(msg->plLen));
00279   } else { // aligned
00280     positionPtrBegin = msg->positionList;
00281   }
00282   positionPtrEnd = positionPtrBegin + msg->plLen;
00283   if ( ((int64)positionPtrBegin) % 32 ) NAMD_bug("ProxyPatch::receiveAll positionPtrBegin not 32-byte aligned");
00284 #else
00285   p.resize(msg->plLen);
00286   memcpy(p.begin(), msg->positionList, sizeof(CompAtom)*(msg->plLen));
00287 #endif
00288 
00289 // DMK
00290 #if defined(NAMD_CUDA) || defined(NAMD_MIC)
00291   cudaAtomPtr = msg->cudaAtomList;
00292 #endif
00293 
00294 #if defined(NAMD_AVXTILES)
00295   if (Node::Object()->simParameters->useAVXTiles) {
00296     cudaAtomPtr = msg->cudaAtomList;
00297     tiles.realloc(msg->plLen, cudaAtomPtr);
00298   }
00299 #endif
00300   numAtoms = msg->plLen;
00301   //numAtoms = p.size();
00302   
00303   avgPositionPtrBegin = msg->avgPositionList;
00304   avgPositionPtrEnd = msg->avgPositionList + msg->avgPlLen;
00305   
00306   // BEGIN LA
00307   velocityPtrBegin = msg->velocityList;
00308   velocityPtrEnd = msg->velocityList + msg->vlLen;
00309   // END LA
00310 
00311   if (flags.doGBIS) {
00312     intRad.resize(numAtoms*2);
00313     for (int i = 0; i < numAtoms*2;i++) {
00314       intRad[i] = msg->intRadList[i];
00315     }
00316   }
00317 
00318   if (flags.doLCPO) {
00319     lcpoType.resize(numAtoms);
00320     for (int i = 0; i < numAtoms; i++) {
00321       lcpoType[i] = msg->lcpoTypeList[i];
00322     }
00323   }
00324 
00325   //We cannot reuse the CompAtomExt list inside the msg because
00326   //the information is needed at every step. In the current implementation
00327   //scheme, the ProxyDataMsg msg will be deleted for every step.
00328   //In order to keep this information, we have to do the extra copy. But
00329   //this overhead is amortized among the steps that atoms don't migrate
00330   // --Chao Mei
00331   pExt.resize(msg->plExtLen);
00332   memcpy(pExt.begin(), msg->positionExtList, sizeof(CompAtomExt)*(msg->plExtLen));
00333 
00334   // DMK - Atom Separation (water vs. non-water)
00335   #if NAMD_SeparateWaters != 0
00336     numWaterAtoms = msg->numWaterAtoms;
00337   #endif
00338 
00339   positionsReady(1);
00340 }

void ProxyPatch::receiveData ( ProxyGBISP3DataMsg msg  ) 

Definition at line 534 of file ProxyPatch.C.

References ResizeArray< Elem >::begin(), ProxyGBISP3DataMsg::dHdrPrefix, Patch::dHdrPrefix, ProxyGBISP3DataMsg::dHdrPrefixLen, and Patch::gbisP3Ready().

00534                                                     {
00535   memcpy(dHdrPrefix.begin(), msg->dHdrPrefix, sizeof(Real)*msg->dHdrPrefixLen);
00536   delete msg;
00537   Patch::gbisP3Ready();
00538 }

void ProxyPatch::receiveData ( ProxyGBISP2DataMsg msg  ) 

Definition at line 528 of file ProxyPatch.C.

References ResizeArray< Elem >::begin(), ProxyGBISP2DataMsg::bornRad, Patch::bornRad, Patch::gbisP2Ready(), and Patch::numAtoms.

00528                                                     {
00529   memcpy(bornRad.begin(), msg->bornRad, sizeof(Real)*numAtoms);
00530   delete msg;
00531   Patch::gbisP2Ready();
00532 }

void ProxyPatch::receiveData ( ProxyDataMsg msg  ) 

Definition at line 168 of file ProxyPatch.C.

References ProxyDataMsg::avgPlLen, ProxyDataMsg::avgPositionList, Patch::avgPositionPtrBegin, Patch::avgPositionPtrEnd, ResizeArray< Elem >::begin(), Patch::boxesOpen, ProxyDataMsg::cudaAtomList, Patch::cudaAtomPtr, DebugM, ProxyDataMsg::flags, Patch::flags, NAMD_bug(), Patch::numAtoms, Node::Object(), Patch::p, Patch::patchID, Patch::pExt, ProxyDataMsg::plExtLen, ProxyDataMsg::plLen, ProxyDataMsg::positionExtList, ProxyDataMsg::positionList, Patch::positionsReady(), PROXYDATAMSGBUFFERED, ResizeArray< Elem >::resize(), Node::simParameters, SimParameters::useAVXTiles, ProxyDataMsg::velocityList, Patch::velocityPtrBegin, Patch::velocityPtrEnd, and ProxyDataMsg::vlLen.

Referenced by boxClosed(), ProxyMgr::recvData(), and ProxyMgr::recvProxyData().

00169 {
00170   DebugM(3, "receiveData(" << patchID << ")\n");
00171 
00172   //delete the ProxyDataMsg of the previous step
00173   delete prevProxyMsg;
00174   prevProxyMsg = NULL;
00175 
00176   if ( boxesOpen )
00177   {
00178       proxyMsgBufferStatus = PROXYDATAMSGBUFFERED;
00179     // store message in queue (only need one element, though)
00180     curProxyMsg = msg;
00181     return;
00182   }
00183 
00184   //Reuse position arrays inside proxyDataMsg --Chao Mei
00185   curProxyMsg = msg;
00186   prevProxyMsg = curProxyMsg;
00187   flags = msg->flags;
00188 
00189 #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00190   if ( ((int64)msg->positionList) % 32 ) { // not aligned
00191     p.resize(msg->plLen);
00192     positionPtrBegin = p.begin();
00193     memcpy(positionPtrBegin, msg->positionList, sizeof(CompAtom)*(msg->plLen));
00194   } else { // aligned
00195     positionPtrBegin = msg->positionList;
00196   }
00197   positionPtrEnd = positionPtrBegin + msg->plLen;
00198   if ( ((int64)positionPtrBegin) % 32 ) NAMD_bug("ProxyPatch::receiveData positionPtrBegin not 32-byte aligned");
00199 #else
00200   p.resize(msg->plLen);
00201   memcpy(p.begin(), msg->positionList, sizeof(CompAtom)*(msg->plLen));
00202 #endif
00203 
00204 // DMK
00205 #if defined(NAMD_CUDA) || defined(NAMD_MIC)
00206   cudaAtomPtr = msg->cudaAtomList;
00207 #endif
00208   
00209 #if defined(NAMD_AVXTILES)
00210   if (Node::Object()->simParameters->useAVXTiles) {
00211     cudaAtomPtr = msg->cudaAtomList;
00212     tiles.realloc(msg->plLen, cudaAtomPtr);
00213   }
00214 #endif
00215   avgPositionPtrBegin = msg->avgPositionList;
00216   avgPositionPtrEnd = msg->avgPositionList + msg->avgPlLen;
00217   
00218   // BEGIN LA
00219   velocityPtrBegin = msg->velocityList;
00220   velocityPtrEnd = msg->velocityList + msg->vlLen;
00221   // END LA
00222 
00223   if ( numAtoms == -1 ) { // for new proxies since receiveAtoms is not called
00224       //numAtoms = p.size();
00225       numAtoms = msg->plLen;
00226 
00227       //Retrieve the CompAtomExt list
00228       CmiAssert(msg->plExtLen!=0);
00229       pExt.resize(msg->plExtLen);
00230       memcpy(pExt.begin(), msg->positionExtList, sizeof(CompAtomExt)*(msg->plExtLen));
00231 
00232 
00233     // DMK - Atom Separation (water vs. non-water)
00234     #if NAMD_SeparateWaters != 0
00235       numWaterAtoms = msg->numWaterAtoms;
00236     #endif
00237 
00238     positionsReady(1);
00239   } else {
00240     positionsReady(0);
00241   }
00242 }

void ProxyPatch::setSpanningTree ( int  p,
int *  c,
int  n 
)

Definition at line 455 of file ProxyPatch.C.

References Patch::child.

Referenced by ProxyMgr::recvNodeAwareSpanningTree(), ProxyMgr::recvNodeAwareSTParent(), and ProxyMgr::recvSpanningTree().

00455                                                      { 
00456 #if CMK_PERSISTENT_COMM && USE_PERSISTENT_TREE
00457   if (ntreephs!=0) {
00458       for (int i=0; i<ntreephs; i++)  CmiDestoryPersistent(treephs[i]);
00459   }
00460   for (int i=0; i<n; i++) {
00461        treephs[i] = CmiCreatePersistent(c[i], 27000, sizeof(envelope)+sizeof(ProxyDataMsg));
00462   }
00463   ntreephs = n;
00464 #endif
00465   parent=p; nChild = n; nWait = 0;
00466   for (int i=0; i<n; i++) child[i] = c[i];
00467 //CkPrintf("setSpanningTree: [%d:%d] %d %d:%d %d\n", CkMyPe(), patchID, parent, nChild, child[0], child[1]);
00468 }


The documentation for this class was generated from the following files:

Generated on 21 Sep 2020 for NAMD by  doxygen 1.6.1