Patch Class Reference

#include <Patch.h>

Inheritance diagram for Patch:
HomePatch ProxyPatch

List of all members.

Public Member Functions

 Patch (PatchID pd)
int hasNewAtoms ()
virtual ~Patch ()
Box< Patch, CompAtom > * registerPositionPickup (Compute *cid)
void unregisterPositionPickup (Compute *cid, Box< Patch, CompAtom > **const box)
Box< Patch, CompAtom > * registerAvgPositionPickup (Compute *cid)
void unregisterAvgPositionPickup (Compute *cid, Box< Patch, CompAtom > **const box)
Box< Patch, CompAtom > * registerVelocityPickup (Compute *cid)
void unregisterVelocityPickup (Compute *cid, Box< Patch, CompAtom > **const box)
Box< Patch, Real > * registerIntRadPickup (Compute *cid)
void unregisterIntRadPickup (Compute *cid, Box< Patch, Real > **const box)
Box< Patch, GBReal > * registerPsiSumDeposit (Compute *cid)
void unregisterPsiSumDeposit (Compute *cid, Box< Patch, GBReal > **const box)
Box< Patch, Real > * registerBornRadPickup (Compute *cid)
void unregisterBornRadPickup (Compute *cid, Box< Patch, Real > **const box)
Box< Patch, GBReal > * registerDEdaSumDeposit (Compute *cid)
void unregisterDEdaSumDeposit (Compute *cid, Box< Patch, GBReal > **const box)
Box< Patch, Real > * registerDHdrPrefixPickup (Compute *cid)
void unregisterDHdrPrefixPickup (Compute *cid, Box< Patch, Real > **const box)
Box< Patch, int > * registerLcpoTypePickup (Compute *cid)
void unregisterLcpoTypePickup (Compute *cid, Box< Patch, int > **const box)
Box< Patch, Results > * registerForceDeposit (Compute *cid)
void unregisterForceDeposit (Compute *cid, Box< Patch, Results > **const box)
void positionsReady (int n=0)
void positionBoxClosed (void)
void forceBoxClosed (void)
void avgPositionBoxClosed (void)
void velocityBoxClosed (void)
void intRadBoxClosed (void)
void psiSumBoxClosed (void)
void bornRadBoxClosed (void)
void dEdaSumBoxClosed (void)
void dHdrPrefixBoxClosed (void)
void gbisP2Ready ()
void gbisP3Ready ()
void lcpoTypeBoxClosed (void)
int getNumAtoms ()
int getNumFixedAtoms ()
void setNumFixedAtoms (int numFixed)
PatchID getPatchID ()
int getNumComputes ()
CompAtomExtgetCompAtomExtInfo ()
CudaAtomgetCudaAtomList ()

Public Attributes

Latticelattice
Flags flags

Protected Member Functions

virtual void boxClosed (int)=0

Protected Attributes

const PatchID patchID
int numAtoms
int numFixedAtoms
CompAtomList p
CompAtomList p_avg
CompAtomList v
AtomMapperatomMapper
RealList intRad
GBRealList psiSum
GBRealList psiFin
RealList bornRad
RealList dHdrPrefix
GBRealList dEdaSum
IntList lcpoType
CompAtomExtList pExt
CompAtomavgPositionPtrBegin
CompAtomavgPositionPtrEnd
CompAtomvelocityPtrBegin
CompAtomvelocityPtrEnd
CudaAtomcudaAtomPtr
ForceList f [Results::maxNumForces]
Results results
int computesSortedByPriority
int firstHoldableCompute
OwnerBox< Patch, CompAtompositionBox
ComputePtrList positionComputeList
OwnerBox< Patch, CompAtomavgPositionBox
ComputePtrList avgPositionComputeList
OwnerBox< Patch, CompAtomvelocityBox
ComputePtrList velocityComputeList
OwnerBox< Patch, RealintRadBox
ComputePtrList intRadComputeList
OwnerBox< Patch, GBRealpsiSumBox
ComputePtrList psiSumComputeList
OwnerBox< Patch, RealbornRadBox
ComputePtrList bornRadComputeList
OwnerBox< Patch, GBRealdEdaSumBox
ComputePtrList dEdaSumComputeList
OwnerBox< Patch, RealdHdrPrefixBox
ComputePtrList dHdrPrefixComputeList
OwnerBox< Patch, int > lcpoTypeBox
ComputePtrList lcpoTypeComputeList
OwnerBox< Patch, ResultsforceBox
ComputePtrList forceComputeList
int boxesOpen
int _hasNewAtoms
int * child
int nChild

Detailed Description

Definition at line 35 of file Patch.h.


Constructor & Destructor Documentation

Patch::Patch ( PatchID  pd  ) 

Definition at line 45 of file Patch.C.

References atomMapper, child, cudaAtomPtr, SimParameters::lattice, lattice, nChild, ReductionMgr::Object(), Node::Object(), REDUCTIONS_BASIC, Node::simParameters, and ReductionMgr::willSubmit().

00045                        :
00046    lattice(flags.lattice),
00047    patchID(pd), numAtoms(0), numFixedAtoms(0),
00048    avgPositionPtrBegin(0), avgPositionPtrEnd(0),
00049    velocityPtrBegin(0), velocityPtrEnd(0),      // BEGIN LA, END LA
00050    positionBox(this,&Patch::positionBoxClosed,pd,0),
00051    avgPositionBox(this,&Patch::avgPositionBoxClosed,pd,3),
00052    velocityBox(this,&Patch::velocityBoxClosed,pd,4), // BEGIN LA, END LA
00053    psiSumBox(this,&Patch::psiSumBoxClosed,pd,5), // begin gbis
00054    intRadBox(this,&Patch::intRadBoxClosed,pd,6),
00055    bornRadBox(this,&Patch::bornRadBoxClosed,pd,7),
00056    dEdaSumBox(this,&Patch::dEdaSumBoxClosed,pd,8),
00057    dHdrPrefixBox(this,&Patch::dHdrPrefixBoxClosed,pd,9), //end gbis
00058    lcpoTypeBox(this,&Patch::lcpoTypeBoxClosed,pd,10),
00059    forceBox(this,&Patch::forceBoxClosed,pd,1),
00060    boxesOpen(0), _hasNewAtoms(0),
00061    computesSortedByPriority(0), firstHoldableCompute(0)
00062 
00063    // DMK - Atom Separation (water vs. non-water)
00064    #if NAMD_SeparateWaters != 0
00065      ,numWaterAtoms(-1)
00066    #endif
00067 {
00068   //CkPrintf("GBIS: PatchCreated\n");
00069 #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00070     positionPtrBegin = 0;
00071     positionPtrEnd = 0;
00072 #endif
00073 
00074         nChild = 0;
00075         child = NULL;
00076 #ifdef NODEAWARE_PROXY_SPANNINGTREE
00077   #ifdef USE_NODEPATCHMGR
00078   nodeChildren = NULL;
00079   numNodeChild = 0;
00080   #endif
00081 #endif
00082 
00083   lattice = Node::Object()->simParameters->lattice;
00084   atomMapper = new AtomMapper(pd);
00085 #ifndef NAMD_CUDA
00086   reduction = ReductionMgr::Object()->willSubmit(REDUCTIONS_BASIC);
00087 #endif
00088 
00089   // DMK
00090   #if defined(NAMD_MIC)
00091     cudaAtomPtr = NULL;
00092     #if MIC_SUBMIT_ATOMS_ON_ARRIVAL != 0
00093       pthread_mutex_init(&mic_atomData_mutex, NULL);
00094       mic_atomData = NULL;
00095       mic_atomData_seq = -1;
00096       mic_atomData_allocSize_host = 0;
00097       for (int i = 0; i < MIC_MAX_DEVICES_PER_NODE; i++) {
00098         mic_atomData_prev[i] = NULL;
00099         mic_atomData_deviceSeq[i] = -1;
00100         mic_atomData_devicePtr[i] = 0;
00101         mic_atomData_allocSize_device[i] = 0;
00102       }
00103     #endif
00104   #endif
00105 }

Patch::~Patch (  )  [virtual]

Definition at line 38 of file Patch.C.

References atomMapper.

00038               {
00039   delete atomMapper;
00040 #ifndef NAMD_CUDA
00041   delete reduction;
00042 #endif
00043 }


Member Function Documentation

void Patch::avgPositionBoxClosed ( void   ) 

Definition at line 358 of file Patch.C.

References avgPositionPtrBegin, and boxClosed().

00359 {
00360    avgPositionPtrBegin = 0;
00361    this->boxClosed(3);
00362 }

void Patch::bornRadBoxClosed ( void   ) 

Definition at line 383 of file Patch.C.

References boxClosed().

00383                                  {
00384    //bornRadPtr = 0;
00385    this->boxClosed(7);
00386 }

virtual void Patch::boxClosed ( int   )  [protected, pure virtual]
void Patch::dEdaSumBoxClosed ( void   ) 

Definition at line 387 of file Patch.C.

References boxClosed().

00387                                  {
00388    //dEdaSumPtr = 0;
00389    this->boxClosed(8);
00390 }

void Patch::dHdrPrefixBoxClosed ( void   ) 

Definition at line 391 of file Patch.C.

References boxClosed().

00391                                     {
00392    //dHdrPrefixPtr = 0;
00393    this->boxClosed(9);
00394 }

void Patch::forceBoxClosed ( void   ) 

Definition at line 253 of file Patch.C.

References ResizeArray< Elem >::begin(), boxClosed(), DebugM, Flags::doFullElectrostatics, Flags::doVirial, f, Results::f, flags, SubmitReduction::item(), j, lattice, Results::maxNumForces, Results::nbond, numAtoms, Node::Object(), PatchMap::Object(), p, patchID, ResizeArray< Elem >::resize(), results, Results::slow, SubmitReduction::submit(), Lattice::unscale(), virial_xx, virial_xy, virial_xz, virial_yy, virial_yz, virial_zz, Vector::x, Vector::y, and Vector::z.

00254 {
00255    DebugM(4, "patchID("<<patchID<<") forceBoxClosed! call\n");
00256 
00257 #ifndef NAMD_CUDA
00258    // calculate direct nonbonded virial from segregated forces and aggregate forces
00259    const Vector center = lattice.unscale( PatchMap::Object()->center(patchID) );
00260 #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00261    const CompAtom * const __restrict pd = positionPtrBegin;
00262 #else
00263    const CompAtom * const __restrict pd = p.begin();
00264 #endif
00265    const int n = numAtoms;
00266    int roff = 0;
00267 
00268 #ifdef NAMD_AVXTILES
00269    // If "Tiles" algorithm is active, perform same reduction and virial calc
00270    // in BigReal precision, but add in forces stored in tiles data structures
00271    // if they were touched on this patch.
00272    if (Node::Object()->simParameters->useAVXTiles) {
00273      double virialHold[6], virialSlowHold[6];
00274      tiles.nativeForceVirialUpdate(flags.doFullElectrostatics, flags.doVirial,
00275                                    pd, center, results.f[Results::nbond], 
00276                                    results.f[Results::slow],
00277                                    results.f[Results::nbond_virial],
00278                                    results.f[Results::slow_virial],
00279                                    virialHold, virialSlowHold);
00280      f[Results::nbond_virial].resize(0);
00281      f[Results::slow_virial].resize(0);
00282      reduction->item(roff + REDUCTION_VIRIAL_NBOND_XX) += virialHold[0];
00283      reduction->item(roff + REDUCTION_VIRIAL_NBOND_XY) += virialHold[1];
00284      reduction->item(roff + REDUCTION_VIRIAL_NBOND_XZ) += virialHold[2];
00285      reduction->item(roff + REDUCTION_VIRIAL_NBOND_YX) += virialHold[1];
00286      reduction->item(roff + REDUCTION_VIRIAL_NBOND_YY) += virialHold[3];
00287      reduction->item(roff + REDUCTION_VIRIAL_NBOND_YZ) += virialHold[4];
00288      reduction->item(roff + REDUCTION_VIRIAL_NBOND_ZX) += virialHold[2];
00289      reduction->item(roff + REDUCTION_VIRIAL_NBOND_ZY) += virialHold[4];
00290      reduction->item(roff + REDUCTION_VIRIAL_NBOND_ZZ) += virialHold[5];
00291      roff += REDUCTION_VIRIAL_SLOW_XX - REDUCTION_VIRIAL_NBOND_XX;
00292      reduction->item(roff + REDUCTION_VIRIAL_NBOND_XX) += virialSlowHold[0];
00293      reduction->item(roff + REDUCTION_VIRIAL_NBOND_XY) += virialSlowHold[1];
00294      reduction->item(roff + REDUCTION_VIRIAL_NBOND_XZ) += virialSlowHold[2];
00295      reduction->item(roff + REDUCTION_VIRIAL_NBOND_YX) += virialSlowHold[1];
00296      reduction->item(roff + REDUCTION_VIRIAL_NBOND_YY) += virialSlowHold[3];
00297      reduction->item(roff + REDUCTION_VIRIAL_NBOND_YZ) += virialSlowHold[4];
00298      reduction->item(roff + REDUCTION_VIRIAL_NBOND_ZX) += virialSlowHold[2];
00299      reduction->item(roff + REDUCTION_VIRIAL_NBOND_ZY) += virialSlowHold[4];
00300      reduction->item(roff + REDUCTION_VIRIAL_NBOND_ZZ) += virialSlowHold[5];
00301      reduction->submit();
00302      for (int j = 0; j < Results::maxNumForces; ++j ) results.f[j] = 0;
00303      this->boxClosed(1);
00304      return;
00305    }
00306 #endif
00307 
00308    for ( int j1 = Results::nbond; j1 <= Results::slow; ++j1, roff += REDUCTION_VIRIAL_SLOW_XX - REDUCTION_VIRIAL_NBOND_XX ) {
00309       int j2 = j1 + ( Results::nbond_virial - Results::nbond );
00310       Force * __restrict f1 = results.f[j1];
00311       Force * __restrict f2 = results.f[j2];
00312       BigReal virial_xx = 0.;
00313       BigReal virial_xy = 0.;
00314       BigReal virial_xz = 0.;
00315       BigReal virial_yy = 0.;
00316       BigReal virial_yz = 0.;
00317       BigReal virial_zz = 0.;
00318 #pragma omp simd reduction(+:virial_xx,virial_xy,virial_xz,virial_yy,virial_yz,virial_zz)
00319 #pragma ivdep
00320       for ( int i=0; i<n; ++i ) {
00321         BigReal p_x = pd[i].position.x - center.x;
00322         BigReal p_y = pd[i].position.y - center.y;
00323         BigReal p_z = pd[i].position.z - center.z;
00324         BigReal f_x = f2[i].x;
00325         BigReal f_y = f2[i].y;
00326         BigReal f_z = f2[i].z;
00327         virial_xx += f_x * p_x;
00328         virial_xy += f_x * p_y;
00329         virial_xz += f_x * p_z;
00330         virial_yy += f_y * p_y;
00331         virial_yz += f_y * p_z;
00332         virial_zz += f_z * p_z;
00333         f1[i].x += f_x;
00334         f1[i].y += f_y;
00335         f1[i].z += f_z;
00336       }
00337       f[j2].resize(0);
00338       reduction->item(roff + REDUCTION_VIRIAL_NBOND_XX) += virial_xx;
00339       reduction->item(roff + REDUCTION_VIRIAL_NBOND_XY) += virial_xy;
00340       reduction->item(roff + REDUCTION_VIRIAL_NBOND_XZ) += virial_xz;
00341       reduction->item(roff + REDUCTION_VIRIAL_NBOND_YX) += virial_xy;
00342       reduction->item(roff + REDUCTION_VIRIAL_NBOND_YY) += virial_yy;
00343       reduction->item(roff + REDUCTION_VIRIAL_NBOND_YZ) += virial_yz;
00344       reduction->item(roff + REDUCTION_VIRIAL_NBOND_ZX) += virial_xz;
00345       reduction->item(roff + REDUCTION_VIRIAL_NBOND_ZY) += virial_yz;
00346       reduction->item(roff + REDUCTION_VIRIAL_NBOND_ZZ) += virial_zz;
00347    }
00348    reduction->submit();
00349 #endif
00350 
00351    for (int j = 0; j < Results::maxNumForces; ++j )
00352    {
00353      results.f[j] = 0;
00354    }
00355    this->boxClosed(1);
00356 }

void Patch::gbisP2Ready (  ) 

Reimplemented in HomePatch.

Definition at line 569 of file Patch.C.

References ResizeArrayPrimIter< T >::begin(), computeNonbondedCUDA2Type, computeNonbondedCUDAType, computeNonbondedPairType, computeNonbondedSelfType, ResizeArrayPrimIter< T >::end(), flags, patchID, positionComputeList, and Flags::sequence.

Referenced by ProxyPatch::receiveData().

00569                         {
00570  ComputePtrListIter cid(positionComputeList);
00571 
00572   int seq = flags.sequence;
00573   for(cid = cid.begin(); cid != cid.end(); cid++) {
00574     if ( (*cid)->type() == computeNonbondedSelfType ||
00575          (*cid)->type() == computeNonbondedPairType ||
00576          (*cid)->type() == computeNonbondedCUDAType
00577 #ifdef NAMD_CUDA
00578          || (*cid)->type() == computeNonbondedCUDA2Type
00579 #endif
00580          ) {
00581       (*cid)->gbisP2PatchReady(patchID,seq);
00582     }
00583   }
00584 }

void Patch::gbisP3Ready (  ) 

Reimplemented in HomePatch.

Definition at line 586 of file Patch.C.

References ResizeArrayPrimIter< T >::begin(), computeNonbondedCUDA2Type, computeNonbondedCUDAType, computeNonbondedPairType, computeNonbondedSelfType, ResizeArrayPrimIter< T >::end(), flags, patchID, positionComputeList, and Flags::sequence.

Referenced by ProxyPatch::receiveData().

00586                         {
00587 
00588   ComputePtrListIter cid(positionComputeList);
00589 
00590   int seq = flags.sequence;
00591   for(cid = cid.begin(); cid != cid.end(); cid++) {
00592     if ( (*cid)->type() == computeNonbondedSelfType ||
00593          (*cid)->type() == computeNonbondedPairType ||
00594          (*cid)->type() == computeNonbondedCUDAType
00595 #ifdef NAMD_CUDA
00596          || (*cid)->type() == computeNonbondedCUDA2Type
00597 #endif
00598          ) {
00599       (*cid)->gbisP3PatchReady(patchID,seq);
00600     }
00601   }
00602 }

CompAtomExt* Patch::getCompAtomExtInfo (  )  [inline]
CudaAtom* Patch::getCudaAtomList (  )  [inline]

Definition at line 124 of file Patch.h.

References cudaAtomPtr.

Referenced by ComputeNonbondedCUDA::doWork().

00124 { return cudaAtomPtr; }

int Patch::getNumAtoms (  )  [inline]
int Patch::getNumComputes (  )  [inline]

Definition at line 115 of file Patch.h.

References positionComputeList, and ResizeArray< Elem >::size().

00115 { return positionComputeList.size(); }

int Patch::getNumFixedAtoms (  )  [inline]

Definition at line 112 of file Patch.h.

References numFixedAtoms.

00112 { return numFixedAtoms; }  // not updated

PatchID Patch::getPatchID (  )  [inline]
int Patch::hasNewAtoms (  )  [inline]

Definition at line 40 of file Patch.h.

References _hasNewAtoms.

00040 { return _hasNewAtoms; }

void Patch::intRadBoxClosed ( void   ) 

Definition at line 379 of file Patch.C.

References boxClosed().

00379                                 {
00380    //dHdrPrefixPtr = 0;
00381    this->boxClosed(6);
00382 }

void Patch::lcpoTypeBoxClosed ( void   ) 

Definition at line 398 of file Patch.C.

References boxClosed().

00398                                   {
00399    this->boxClosed(10);
00400 }

void Patch::positionBoxClosed ( void   ) 

Definition at line 247 of file Patch.C.

References boxClosed().

00248 {
00249    //positionPtrBegin = 0;
00250    this->boxClosed(0);
00251 }

void Patch::positionsReady ( int  n = 0  ) 

Reimplemented in HomePatch.

Definition at line 402 of file Patch.C.

References _hasNewAtoms, atomMapper, avgPositionBox, avgPositionPtrBegin, ResizeArray< Elem >::begin(), bornRad, bornRadBox, boxesOpen, computesSortedByPriority, DebugM, dEdaSum, dEdaSumBox, dHdrPrefix, dHdrPrefixBox, Flags::doFullElectrostatics, Flags::doGBIS, Flags::doLCPO, Flags::doLoweAndersen, Flags::doMolly, ResizeArray< Elem >::end(), endi(), Results::f, f, firstHoldableCompute, flags, forceBox, getCompAtomExtInfo(), iINFO(), intRad, intRadBox, iout, j, lattice, lcpoType, lcpoTypeBox, Results::maxNumForces, PatchMap::node(), numAtoms, Sync::Object(), PatchMap::Object(), Node::Object(), OwnerBox< Owner, Data >::open(), p, patchID, pExt, PME_PRIORITY, CompAtom::position, positionBox, positionComputeList, psiFin, psiSum, psiSumBox, AtomMapper::registerIDsCompAtomExt(), ResizeArray< Elem >::resize(), results, Flags::sequence, ResizeArray< Elem >::setall(), Node::simParameters, ResizeArray< Elem >::size(), sort, Lattice::unscale(), SimParameters::useAVXTiles, CompAtom::vdwType, velocityBox, velocityPtrBegin, Vector::x, Vector::y, and Vector::z.

Referenced by ProxyPatch::receiveAll(), and ProxyPatch::receiveData().

00403 {
00404    DebugM(4,"Patch::positionsReady() - patchID(" << patchID <<")"<<std::endl );
00405 
00406    if ( doneMigration ){
00407 // #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00408 //       AtomMap::Object()->registerIDs(patchID,positionPtrBegin,positionPtrEnd);       
00409 // #else
00410        atomMapper->registerIDsCompAtomExt(pExt.begin(),pExt.end());
00411 // #endif
00412 
00413      #ifdef NAMD_AVXTILES
00414      if (Node::Object()->simParameters->useAVXTiles) {
00415        #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00416        const CompAtom * const pd = positionPtrBegin;
00417        #else
00418        const CompAtom * const pd = p.begin();
00419        #endif
00420        tiles.atomUpdate(pd, getCompAtomExtInfo());
00421      }
00422      #endif
00423    }
00424 
00425 #ifdef NAMD_KNL
00426   #if defined(NAMD_AVXTILES)
00427   if (!Node::Object()->simParameters->useAVXTiles)
00428   #endif
00429    {
00430      const Vector center = lattice.unscale( PatchMap::Object()->center(patchID) );
00431      const int n = numAtoms;
00432      pFlt.resize(n);
00433      CompAtomFlt * const pf = pFlt.begin();
00434 #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00435      const CompAtom * const pd = positionPtrBegin;
00436 #else
00437      const CompAtom * const pd = p.begin();
00438 #endif
00439      for ( int i=0; i<n; ++i ) {
00440        // need to subtract center in double precision, then assign to float
00441        pf[i].position.x = pd[i].position.x - center.x;
00442        pf[i].position.y = pd[i].position.y - center.y;
00443        pf[i].position.z = pd[i].position.z - center.z;
00444        pf[i].vdwType = pd[i].vdwType;
00445      }
00446    }
00447 #endif
00448    boxesOpen = 2;
00449    if ( flags.doMolly ) boxesOpen++;
00450    // BEGIN LA
00451    if (flags.doLoweAndersen) {
00452        DebugM(4, "Patch::positionsReady, flags.doMolly = " << flags.doMolly << "\n");
00453        boxesOpen++;
00454    }
00455    // END LA
00456    _hasNewAtoms = (doneMigration != 0);
00457 
00458 #if CMK_BLUEGENEL
00459    CmiNetworkProgressAfter (0);
00460 #endif
00461 
00462    // Give all position pickup boxes access to positions
00463    //positionPtrBegin = p.begin();
00464 #ifdef REMOVE_PROXYDATAMSG_EXTRACOPY
00465    positionBox.open(positionPtrBegin);
00466 #else
00467    positionBox.open(p.begin());
00468 #endif
00469    if ( flags.doMolly ) {
00470      //avgPositionPtrBegin = p_avg.begin();
00471      avgPositionBox.open(avgPositionPtrBegin);
00472    }
00473    
00474    // BEGIN LA
00475    if (flags.doLoweAndersen) {
00476        velocityBox.open(velocityPtrBegin);
00477    }
00478    // END LA
00479    // begin gbis
00480     if (flags.doGBIS) {
00481       boxesOpen += 5;
00482       //intRad should already be taken care of
00483       intRadBox.open(intRad.begin());
00484       psiSum.resize(numAtoms);//resize array
00485       psiSum.setall(0);
00486       psiSumBox.open(psiSum.begin());
00487       psiFin.resize(numAtoms);//has no box
00488       psiFin.setall(0);
00489       bornRad.resize(numAtoms);
00490       bornRad.setall(0);
00491       bornRadBox.open(bornRad.begin());
00492       dEdaSum.resize(numAtoms);//resize array
00493       dEdaSum.setall(0);
00494       dEdaSumBox.open(dEdaSum.begin());
00495       dHdrPrefix.resize(numAtoms);
00496       dHdrPrefix.setall(0);
00497       dHdrPrefixBox.open(dHdrPrefix.begin());
00498     }
00499    // end gbis
00500 
00501   //LCPO
00502   if (flags.doLCPO) {
00503     boxesOpen++;
00504     lcpoTypeBox.open(lcpoType.begin());
00505   }
00506 
00507 #if CMK_BLUEGENEL
00508    CmiNetworkProgressAfter (0);
00509 #endif
00510    
00511    // Give all force deposit boxes access to forces
00512    Force *forcePtr;
00513    for ( int j = 0; j < Results::maxNumForces; ++j )
00514     {
00515       f[j].resize(numAtoms);
00516       forcePtr = f[j].begin();
00517       memset (forcePtr, 0, sizeof (Force) * numAtoms);
00518       results.f[j] = forcePtr;
00519     }
00520    forceBox.open(&results);
00521 
00522    #ifdef NAMD_AVXTILES
00523    // Zero data in arrays in "Tiles" data structures if they have been touched
00524    if (Node::Object()->simParameters->useAVXTiles)
00525      tiles.zeroForces(flags.doFullElectrostatics);
00526    #endif
00527    
00528 
00529    if ( ! computesSortedByPriority ) {
00530      if (positionComputeList.size() == 0 && PatchMap::Object()->node(patchID) != CkMyPe()) {
00531        iout << iINFO << "PATCH_COUNT: Patch " << patchID 
00532             << " on PE " << CkMyPe() <<" home patch " 
00533             << PatchMap::Object()->node(patchID)
00534             << " does not have any computes\n" 
00535             << endi;
00536      }
00537 
00538      cptr_sortop_priority so;
00539      std::sort(positionComputeList.begin(), positionComputeList.end(), so);
00540      computesSortedByPriority = 1;
00541      int i;
00542      for ( i=0; i<positionComputeList.size(); ++i ) {
00543        if ( positionComputeList[i]->priority() > PME_PRIORITY ) break;
00544      }
00545      firstHoldableCompute = i;
00546    }
00547 
00548    int seq = flags.sequence;
00549 
00550    // Iterate over compute objects that need to be informed we are ready
00551    Compute **cid = positionComputeList.begin();
00552    for ( int i=0; i < firstHoldableCompute; ++i, ++cid ) {
00553      (*cid)->patchReady(patchID,doneMigration,seq);
00554    }
00555    Compute **cend = positionComputeList.end();
00556 
00557    // gzheng
00558    if (Sync::Object()->holdComputes(patchID, cid, cend, doneMigration, seq)) {
00559      return;
00560    }
00561 
00562    for( ; cid != cend; cid++ ) {
00563      (*cid)->patchReady(patchID,doneMigration,seq);
00564    }
00565 }

void Patch::psiSumBoxClosed ( void   ) 

Definition at line 376 of file Patch.C.

References boxClosed().

00376                                 {
00377   this->boxClosed(5);
00378 }

Box< Patch, CompAtom > * Patch::registerAvgPositionPickup ( Compute cid  ) 

Definition at line 134 of file Patch.C.

References avgPositionBox, OwnerBox< Owner, Data >::checkOut(), and Compute::cid.

Referenced by ComputePme::initialize(), ComputeNonbondedSelf::initialize(), ComputeNonbondedPair::initialize(), PatchElem::PatchElem(), and TuplePatchElem::TuplePatchElem().

00135 {
00136    //DebugM(4, "registerAvgPositionPickup("<<patchID<<") from " << cid->cid << "\n");
00137    return avgPositionBox.checkOut(cid->cid);
00138 }

Box< Patch, Real > * Patch::registerBornRadPickup ( Compute cid  ) 
Box< Patch, GBReal > * Patch::registerDEdaSumDeposit ( Compute cid  ) 

Definition at line 204 of file Patch.C.

References SortedArray< Elem >::add(), OwnerBox< Owner, Data >::checkOut(), Compute::cid, DebugM, dEdaSumBox, dEdaSumComputeList, and ResizeArray< Elem >::size().

Referenced by ComputeNonbondedSelf::initialize(), ComputeNonbondedPair::initialize(), and ComputeNonbondedCUDA::registerPatches().

00204                                                              {
00205   if (dEdaSumComputeList.add(cid) < 0) {
00206     DebugM(7, "registerDEdaSumDeposit() failed for cid " << cid->cid << std::endl);
00207     DebugM(7, "  size of dEdaSumCompueList " << dEdaSumComputeList.size() << std::endl);
00208      return NULL;
00209   }
00210   return dEdaSumBox.checkOut(cid->cid);
00211 }

Box< Patch, Real > * Patch::registerDHdrPrefixPickup ( Compute cid  ) 
Box< Patch, Results > * Patch::registerForceDeposit ( Compute cid  ) 

Definition at line 228 of file Patch.C.

References SortedArray< Elem >::add(), OwnerBox< Owner, Data >::checkOut(), Compute::cid, DebugM, forceBox, forceComputeList, and ResizeArray< Elem >::size().

Referenced by ComputePme::initialize(), ComputePatchPair::initialize(), ComputePatch::initialize(), ComputeLCPO::initialize(), ComputeHomePatch::initialize(), PatchElem::PatchElem(), ComputeNonbondedCUDA::registerPatches(), and TuplePatchElem::TuplePatchElem().

00229 {
00230    if (forceComputeList.add(cid) < 0)
00231    {
00232      DebugM(7, "registerForceDeposit() failed for cid " << cid->cid << std::endl);
00233      DebugM(7, "  size of forceCompueList " << forceComputeList.size() << std::endl);
00234      return NULL;
00235    }
00236    return forceBox.checkOut(cid->cid);
00237 }

Box< Patch, Real > * Patch::registerIntRadPickup ( Compute cid  ) 
Box< Patch, int > * Patch::registerLcpoTypePickup ( Compute cid  ) 

Definition at line 188 of file Patch.C.

References OwnerBox< Owner, Data >::checkOut(), Compute::cid, and lcpoTypeBox.

Referenced by ComputeLCPO::initialize().

00188                                                           {
00189   return lcpoTypeBox.checkOut(cid->cid);
00190 }

Box< Patch, CompAtom > * Patch::registerPositionPickup ( Compute cid  ) 

Definition at line 107 of file Patch.C.

References SortedArray< Elem >::add(), OwnerBox< Owner, Data >::checkOut(), Compute::cid, computesSortedByPriority, DebugM, positionBox, positionComputeList, and SortedArray< Elem >::sort().

Referenced by ComputePme::initialize(), ComputePatchPair::initialize(), ComputePatch::initialize(), ComputeLCPO::initialize(), ComputeHomePatch::initialize(), PatchElem::PatchElem(), ComputeNonbondedCUDA::registerPatches(), and TuplePatchElem::TuplePatchElem().

00108 {
00109    if ( computesSortedByPriority ) {
00110      positionComputeList.sort();
00111      computesSortedByPriority = 0;
00112    }
00113    //DebugM(4, "registerPositionPickupa("<<patchID<<") from " << cid->cid << "\n");
00114    if (positionComputeList.add(cid) < 0)
00115    {
00116      DebugM(7, "registerPositionPickup() failed for cid " << cid->cid << std::endl);
00117      return NULL;
00118    }
00119    return positionBox.checkOut(cid->cid);
00120 }

Box< Patch, GBReal > * Patch::registerPsiSumDeposit ( Compute cid  ) 

Definition at line 164 of file Patch.C.

References SortedArray< Elem >::add(), OwnerBox< Owner, Data >::checkOut(), Compute::cid, DebugM, psiSumBox, psiSumComputeList, and ResizeArray< Elem >::size().

Referenced by ComputeNonbondedSelf::initialize(), ComputeNonbondedPair::initialize(), and ComputeNonbondedCUDA::registerPatches().

00164                                                             {
00165 
00166   if (psiSumComputeList.add(cid) < 0) {
00167     DebugM(7, "registerPsiSumDeposit() failed for cid " << cid->cid << std::endl);
00168     DebugM(7, "  size of psiSumCompueList " << psiSumComputeList.size() << std::endl);
00169      return NULL;
00170   }
00171   return psiSumBox.checkOut(cid->cid);
00172 }

Box< Patch, CompAtom > * Patch::registerVelocityPickup ( Compute cid  ) 

Definition at line 148 of file Patch.C.

References OwnerBox< Owner, Data >::checkOut(), Compute::cid, and velocityBox.

Referenced by ComputeNonbondedSelf::initialize(), and ComputeNonbondedPair::initialize().

00149 {
00150    //DebugM(4, "registerVelocityPickup("<<patchID<<") from " << cid->cid << "\n");
00151    return velocityBox.checkOut(cid->cid);
00152 }

void Patch::setNumFixedAtoms ( int  numFixed  )  [inline]

Definition at line 113 of file Patch.h.

References numFixedAtoms.

Referenced by PatchMgr::setHomePatchFixedAtomNum().

00113 { numFixedAtoms=numFixed; }  // not updated

void Patch::unregisterAvgPositionPickup ( Compute cid,
Box< Patch, CompAtom > **const   box 
)

Definition at line 140 of file Patch.C.

References avgPositionBox, OwnerBox< Owner, Data >::checkIn(), Compute::cid, and DebugM.

Referenced by ComputeNonbondedPair::~ComputeNonbondedPair(), ComputeNonbondedSelf::~ComputeNonbondedSelf(), and ComputePmeCUDA::~ComputePmeCUDA().

00141 {
00142    DebugM(4, "UnregisterAvgPositionPickup from " << cid->cid << "\n");
00143    avgPositionBox.checkIn(*box);
00144    *box = 0;
00145 }

void Patch::unregisterBornRadPickup ( Compute cid,
Box< Patch, Real > **const   box 
)

Definition at line 199 of file Patch.C.

References bornRadBox, and OwnerBox< Owner, Data >::checkIn().

Referenced by ComputeNonbondedPair::~ComputeNonbondedPair(), and ComputeNonbondedSelf::~ComputeNonbondedSelf().

00199                                                                             {
00200   bornRadBox.checkIn(*box);
00201   *box = 0;
00202 }

void Patch::unregisterDEdaSumDeposit ( Compute cid,
Box< Patch, GBReal > **const   box 
)
void Patch::unregisterDHdrPrefixPickup ( Compute cid,
Box< Patch, Real > **const   box 
)

Definition at line 222 of file Patch.C.

References OwnerBox< Owner, Data >::checkIn(), and dHdrPrefixBox.

Referenced by ComputeNonbondedPair::~ComputeNonbondedPair(), and ComputeNonbondedSelf::~ComputeNonbondedSelf().

00222                                                                                {
00223   dHdrPrefixBox.checkIn(*box);
00224   *box = 0;
00225 }

void Patch::unregisterForceDeposit ( Compute cid,
Box< Patch, Results > **const   box 
)

Definition at line 239 of file Patch.C.

References OwnerBox< Owner, Data >::checkIn(), DebugM, SortedArray< Elem >::del(), forceBox, and forceComputeList.

Referenced by ComputeHomePatch::~ComputeHomePatch(), ComputeLCPO::~ComputeLCPO(), ComputePatch::~ComputePatch(), ComputePatchPair::~ComputePatchPair(), and ComputePmeCUDA::~ComputePmeCUDA().

00240 {
00241    DebugM(4, "unregisterForceDeposit() computeID("<<cid<<")"<<std::endl);
00242    forceComputeList.del(cid);
00243    forceBox.checkIn(*box);
00244    *box = 0;
00245 }

void Patch::unregisterIntRadPickup ( Compute cid,
Box< Patch, Real > **const   box 
)

Definition at line 182 of file Patch.C.

References OwnerBox< Owner, Data >::checkIn(), and intRadBox.

Referenced by ComputeNonbondedPair::~ComputeNonbondedPair(), and ComputeNonbondedSelf::~ComputeNonbondedSelf().

00182                                                                            {
00183   intRadBox.checkIn(*box);
00184   *box = 0;
00185 }

void Patch::unregisterLcpoTypePickup ( Compute cid,
Box< Patch, int > **const   box 
)

Definition at line 191 of file Patch.C.

References OwnerBox< Owner, Data >::checkIn(), and lcpoTypeBox.

Referenced by ComputeLCPO::~ComputeLCPO().

00191                                                                             {
00192   lcpoTypeBox.checkIn(*box);
00193   *box = 0;
00194 }

void Patch::unregisterPositionPickup ( Compute cid,
Box< Patch, CompAtom > **const   box 
)
void Patch::unregisterPsiSumDeposit ( Compute cid,
Box< Patch, GBReal > **const   box 
)
void Patch::unregisterVelocityPickup ( Compute cid,
Box< Patch, CompAtom > **const   box 
)

Definition at line 154 of file Patch.C.

References OwnerBox< Owner, Data >::checkIn(), Compute::cid, DebugM, and velocityBox.

Referenced by ComputeNonbondedPair::~ComputeNonbondedPair(), and ComputeNonbondedSelf::~ComputeNonbondedSelf().

00155 {
00156    DebugM(4, "UnregisterVelocityPickup from " << cid->cid << "\n");
00157    velocityBox.checkIn(*box);
00158    *box = 0;
00159 }

void Patch::velocityBoxClosed ( void   ) 

Definition at line 365 of file Patch.C.

References boxClosed(), DebugM, patchID, and velocityPtrBegin.

00366 {
00367    DebugM(4, "patchID("<<patchID<<") velocityBoxClosed! call\n");
00368    velocityPtrBegin = 0;
00369    this->boxClosed(4);  // ?? Don't know about number
00370 }


Member Data Documentation

int Patch::_hasNewAtoms [protected]

Definition at line 245 of file Patch.h.

Referenced by hasNewAtoms(), and positionsReady().

Definition at line 215 of file Patch.h.

Referenced by positionsReady(), registerAvgPositionPickup(), and unregisterAvgPositionPickup().

Definition at line 216 of file Patch.h.

RealList Patch::bornRad [protected]

Definition at line 227 of file Patch.h.

Referenced by positionsReady(), registerBornRadPickup(), and unregisterBornRadPickup().

Definition at line 228 of file Patch.h.

int Patch::boxesOpen [protected]
int* Patch::child [protected]

Definition at line 210 of file Patch.h.

Referenced by positionsReady(), registerPositionPickup(), and unregisterPositionPickup().

Definition at line 160 of file Patch.h.

Referenced by ProxyPatch::boxClosed(), HomePatch::gbisComputeAfterP2(), and positionsReady().

Definition at line 230 of file Patch.h.

Referenced by registerDEdaSumDeposit(), and unregisterDEdaSumDeposit().

Definition at line 231 of file Patch.h.

Referenced by positionsReady(), registerDHdrPrefixPickup(), and unregisterDHdrPrefixPickup().

Definition at line 232 of file Patch.h.

ForceList Patch::f[Results::maxNumForces] [protected]
int Patch::firstHoldableCompute [protected]

Definition at line 211 of file Patch.h.

Referenced by positionsReady().

Definition at line 127 of file Patch.h.

Referenced by Sequencer::addForceToMomentum(), Sequencer::addForceToMomentum3(), Sequencer::addVelocityToPosition(), ProxyPatch::boxClosed(), HomePatch::boxClosed(), TholeElem::computeForce(), ExclElem::computeForce(), ImproperElem::computeForce(), DihedralElem::computeForce(), CrosstermElem::computeForce(), BondElem::computeForce(), AnisoElem::computeForce(), AngleElem::computeForce(), ComputeGridForce::do_calc(), ComputeStir::doForce(), ComputeRestraints::doForce(), ComputeNonbondedSelf::doForce(), ComputeNonbondedPair::doForce(), ComputeLCPO::doForce(), ComputeGridForce::doForce(), ComputeEField::doForce(), HomePatch::doGroupSizeCheck(), HomePatch::doPairlistCheck(), ComputePme::doWork(), ComputePatch::doWork(), ComputeNonbondedCUDA::doWork(), forceBoxClosed(), HomePatch::gbisComputeAfterP1(), HomePatch::gbisComputeAfterP2(), gbisP2Ready(), HomePatch::gbisP2Ready(), gbisP3Ready(), HomePatch::gbisP3Ready(), Sequencer::integrate(), Sequencer::langevinVelocitiesBBK1(), Sequencer::langevinVelocitiesBBK2(), Sequencer::maximumMove(), Sequencer::minimize(), Sequencer::multigratorPressure(), Sequencer::newtonianVelocities(), ComputePme::noWork(), ComputeNonbondedSelf::noWork(), positionsReady(), HomePatch::positionsReady(), Sequencer::rattle1(), ProxyPatch::receiveAll(), ProxyPatch::receiveData(), HomePatch::receiveResult(), Sequencer::runComputeObjects(), Sequencer::submitCollections(), Sequencer::submitHalfstep(), Sequencer::submitMinimizeReductions(), Sequencer::submitReductions(), and ComputePme::ungridForces().

Definition at line 240 of file Patch.h.

Referenced by registerForceDeposit(), and unregisterForceDeposit().

RealList Patch::intRad [protected]

Definition at line 223 of file Patch.h.

Referenced by positionsReady(), registerIntRadPickup(), and unregisterIntRadPickup().

Definition at line 224 of file Patch.h.

IntList Patch::lcpoType [protected]
OwnerBox<Patch,int> Patch::lcpoTypeBox [protected]

Definition at line 236 of file Patch.h.

Referenced by positionsReady(), registerLcpoTypePickup(), and unregisterLcpoTypePickup().

Definition at line 237 of file Patch.h.

int Patch::nChild [protected]

Definition at line 263 of file Patch.h.

Referenced by ProxyPatch::getSpanningTreeNChild(), Patch(), and ProxyPatch::ProxyPatch().

int Patch::numAtoms [protected]

Definition at line 144 of file Patch.h.

Referenced by Sequencer::addForceToMomentum(), Sequencer::addForceToMomentum3(), Sequencer::addMovDragToPosition(), Sequencer::addRotDragToPosition(), Sequencer::addVelocityToPosition(), Sequencer::berendsenPressure(), ProxyPatch::boxClosed(), HomePatch::boxClosed(), Sequencer::calcFixVirial(), Sequencer::calcKineticEnergy(), Sequencer::correctMomentum(), forceBoxClosed(), getNumAtoms(), Sequencer::langevinPiston(), Sequencer::langevinVelocities(), Sequencer::langevinVelocitiesBBK1(), Sequencer::langevinVelocitiesBBK2(), Sequencer::maximumMove(), Sequencer::minimizationQuenchVelocity(), Sequencer::minimizeMoveDownhill(), Sequencer::multigratorPressure(), Sequencer::multigratorTemperature(), Sequencer::newMinimizeDirection(), Sequencer::newMinimizePosition(), positionsReady(), HomePatch::positionsReady(), ProxyPatch::ProxyPatch(), HomePatch::qmSwapAtoms(), Sequencer::quenchVelocities(), Sequencer::rattle1(), Sequencer::reassignVelocities(), ProxyPatch::receiveAll(), ProxyPatch::receiveData(), Sequencer::reinitVelocities(), Sequencer::reloadCharges(), Sequencer::rescaleaccelMD(), Sequencer::rescaleSoluteCharges(), Sequencer::rescaleVelocities(), Sequencer::rescaleVelocitiesByFactor(), HomePatch::saveForce(), ComputeGlobal::saveTotalForces(), Sequencer::scalePositionsVelocities(), Sequencer::scaleVelocities(), Sequencer::stochRescaleVelocities(), Sequencer::submitHalfstep(), Sequencer::submitMinimizeReductions(), Sequencer::submitMomentum(), Sequencer::submitReductions(), and Sequencer::tcoupleVelocities().

int Patch::numFixedAtoms [protected]

Definition at line 145 of file Patch.h.

Referenced by getNumFixedAtoms(), and setNumFixedAtoms().

CompAtomList Patch::p [protected]
const PatchID Patch::patchID [protected]

Definition at line 213 of file Patch.h.

Referenced by positionsReady(), registerPositionPickup(), and unregisterPositionPickup().

Definition at line 156 of file Patch.h.

Referenced by ProxyPatch::boxClosed(), HomePatch::gbisComputeAfterP1(), and positionsReady().

Definition at line 226 of file Patch.h.

Referenced by registerPsiSumDeposit(), and unregisterPsiSumDeposit().

Results Patch::results [protected]

Definition at line 208 of file Patch.h.

Referenced by forceBoxClosed(), and positionsReady().

CompAtomList Patch::v [protected]

Definition at line 149 of file Patch.h.

Referenced by HomePatch::positionsReady().

Definition at line 218 of file Patch.h.

Referenced by positionsReady(), registerVelocityPickup(), and unregisterVelocityPickup().

Definition at line 219 of file Patch.h.


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

Generated on 21 Sep 2020 for NAMD by  doxygen 1.6.1