ComputePmeCUDA Class Reference

#include <ComputePmeCUDA.h>

Inheritance diagram for ComputePmeCUDA:

Compute List of all members.

Public Member Functions

 ComputePmeCUDA (ComputeID c, PatchIDList &pids)
 ComputePmeCUDA (ComputeID c, PatchID pid)
virtual ~ComputePmeCUDA ()
void initialize ()
void atomUpdate ()
int noWork ()
void doWork ()
bool storePmeForceMsg (PmeForceMsg *msg)

Classes

struct  PatchRecord

Detailed Description

Definition at line 17 of file ComputePmeCUDA.h.


Constructor & Destructor Documentation

ComputePmeCUDA::ComputePmeCUDA ( ComputeID  c,
PatchIDList pids 
)

Definition at line 19 of file ComputePmeCUDA.C.

References Compute::getNumPatches(), Compute::setNumPatches(), and ResizeArray< Elem >::size().

00019                                                              : Compute(c) {
00020   setNumPatches(pids.size());
00021   patches.resize(getNumPatches());
00022   for (int i=0;i < getNumPatches();i++) {
00023     patches[i].patchID = pids[i];
00024   }
00025 }

ComputePmeCUDA::ComputePmeCUDA ( ComputeID  c,
PatchID  pid 
)

Definition at line 30 of file ComputePmeCUDA.C.

References Compute::getNumPatches(), and Compute::setNumPatches().

00030                                                        : Compute(c) {
00031         setNumPatches(1);
00032   patches.resize(getNumPatches());
00033   patches[0].patchID = pid;
00034 }

ComputePmeCUDA::~ComputePmeCUDA (  )  [virtual]

Definition at line 39 of file ComputePmeCUDA.C.

References Compute::getNumPatches(), PatchMap::Object(), PatchMap::patch(), Patch::unregisterAvgPositionPickup(), Patch::unregisterForceDeposit(), and Patch::unregisterPositionPickup().

00039                                 {
00040   for (int i=0;i < getNumPatches();i++) {
00041         if (patches[i].positionBox != NULL) {
00042                 PatchMap::Object()->patch(patches[i].patchID)->unregisterPositionPickup(this, &patches[i].positionBox);
00043     }
00044     if (patches[i].avgPositionBox != NULL) {
00045         PatchMap::Object()->patch(patches[i].patchID)->unregisterAvgPositionPickup(this, &patches[i].avgPositionBox);
00046     }
00047     if (patches[i].forceBox != NULL) {
00048         PatchMap::Object()->patch(patches[i].patchID)->unregisterForceDeposit(this, &patches[i].forceBox);
00049     }
00050   }
00051   CmiDestroyLock(lock);
00052 }


Member Function Documentation

void ComputePmeCUDA::atomUpdate (  )  [virtual]

Reimplemented from Compute.

Definition at line 94 of file ComputePmeCUDA.C.

00094                                 {
00095   atomsChanged = true;
00096 }

void ComputePmeCUDA::doWork (  )  [virtual]

Reimplemented from Compute.

Definition at line 136 of file ComputePmeCUDA.C.

00136                             {
00137   if (sendAtomsDone) {
00138     // Second part of computation: receive forces from ComputePmeCUDAMgr
00139     // basePriority = PME_OFFLOAD_PRIORITY;
00140     sendAtomsDone = false;
00141     recvForces();
00142   } else {
00143     // First part of computation: send atoms to ComputePmeCUDAMgr
00144     sendAtomsDone = true;
00145     // basePriority = COMPUTE_HOME_PRIORITY + PATCH_PRIORITY(patchID);
00146     sendAtoms();
00147   }
00148 }

void ComputePmeCUDA::initialize (  )  [virtual]

Reimplemented from Compute.

Definition at line 57 of file ComputePmeCUDA.C.

References Compute::getNumPatches(), ComputePmeCUDAMgr::getPmeGrid(), NAMD_bug(), PatchMap::Object(), Node::Object(), Node::simParameters, and simParams.

00057                                 {
00058   lock = CmiCreateLock();
00059 
00060   // Sanity Check
00061   SimParameters *simParams = Node::Object()->simParameters;
00062   if (simParams->alchFepOn) NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, alchFepOn not yet implemented");
00063   if (simParams->alchThermIntOn) NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, alchThermIntOn not yet implemented");
00064   if (simParams->lesOn) NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, lesOn not yet implemented");
00065   if (simParams->pairInteractionOn) NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, pairInteractionOn not yet implemented");
00066 
00067   sendAtomsDone = false;
00068   selfEnergyDone = false;
00069   // basePriority = PME_PRIORITY;
00070   patchCounter = getNumPatches();
00071 
00072   // Get proxy to ComputePmeCUDAMgr
00073   computePmeCUDAMgrProxy = CkpvAccess(BOCclass_group).computePmeCUDAMgr;
00074   mgr = computePmeCUDAMgrProxy.ckLocalBranch();
00075   if (mgr == NULL)
00076     NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, unable to locate local branch of BOC entry computePmeCUDAMgr");
00077   pmeGrid = mgr->getPmeGrid();
00078 
00079   for (int i=0;i < getNumPatches();i++) {
00080     if (patches[i].positionBox != NULL || patches[i].avgPositionBox != NULL
00081       || patches[i].forceBox != NULL || patches[i].patch != NULL)
00082       NAMD_bug("ComputePmeCUDA::initialize() called twice or boxes not set to NULL");
00083     if (!(patches[i].patch = PatchMap::Object()->patch(patches[i].patchID))) {
00084       NAMD_bug("ComputePmeCUDA::initialize() patch not found");
00085     }
00086     patches[i].positionBox = patches[i].patch->registerPositionPickup(this);
00087     patches[i].forceBox = patches[i].patch->registerForceDeposit(this);
00088         patches[i].avgPositionBox = patches[i].patch->registerAvgPositionPickup(this);
00089   }
00090 
00091   setupActivePencils();
00092 }

int ComputePmeCUDA::noWork (  )  [virtual]

Reimplemented from Compute.

Definition at line 122 of file ComputePmeCUDA.C.

References Compute::getNumPatches().

00122                            {
00123 
00124   if (patches[0].patch->flags.doFullElectrostatics) return 0;
00125 
00126   for (int i=0;i < getNumPatches();i++) {
00127     patches[i].positionBox->skip();
00128     patches[i].forceBox->skip();
00129     // We only need to call skip() once
00130     if (patches[i].patchID == 0) computePmeCUDAMgrProxy[patches[i].homePencilNode].skip();
00131   }
00132 
00133   return 1;
00134 }

bool ComputePmeCUDA::storePmeForceMsg ( PmeForceMsg msg  ) 

Definition at line 345 of file ComputePmeCUDA.C.

References Compute::getNumPatches(), and NAMD_bug().

Referenced by ComputePmeCUDADevice::sendForcesToPatch().

00345                                                       {
00346   bool done = false;
00347   int i;
00348   CmiLock(lock);
00349   patchCounter--;
00350   i = patchCounter;
00351   if (patchCounter == 0) {
00352     patchCounter = getNumPatches();
00353     done = true;
00354   }
00355   CmiUnlock(lock);
00356   if (patches[i].pmeForceMsg != NULL)
00357     NAMD_bug("ComputePmeCUDA::storePmeForceMsg, already contains message");
00358   patches[i].pmeForceMsg = msg;
00359   return done;
00360 }


The documentation for this class was generated from the following files:
Generated on Sun Sep 24 01:17:17 2017 for NAMD by  doxygen 1.4.7