ComputePmeCUDA Class Reference

#include <ComputePmeCUDA.h>

Inheritance diagram for ComputePmeCUDA:
Compute

List of all members.

Classes

struct  PatchRecord

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)

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   delete reduction;
00052   CmiDestroyLock(lock);
00053 }


Member Function Documentation

void ComputePmeCUDA::atomUpdate ( void   )  [virtual]

Reimplemented from Compute.

Definition at line 95 of file ComputePmeCUDA.C.

00095                                 {
00096   atomsChanged = true;
00097 }

void ComputePmeCUDA::doWork ( void   )  [virtual]

Reimplemented from Compute.

Definition at line 139 of file ComputePmeCUDA.C.

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

void ComputePmeCUDA::initialize ( void   )  [virtual]

Reimplemented from Compute.

Definition at line 58 of file ComputePmeCUDA.C.

References SimParameters::alchFepOn, SimParameters::alchThermIntOn, Compute::getNumPatches(), ComputePmeCUDAMgr::getPmeGrid(), SimParameters::lesOn, NAMD_bug(), PatchMap::Object(), ReductionMgr::Object(), Node::Object(), SimParameters::pairInteractionOn, REDUCTIONS_BASIC, Node::simParameters, simParams, and ReductionMgr::willSubmit().

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

int ComputePmeCUDA::noWork (  )  [virtual]

Reimplemented from Compute.

Definition at line 123 of file ComputePmeCUDA.C.

References Compute::getNumPatches(), and SubmitReduction::submit().

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

bool ComputePmeCUDA::storePmeForceMsg ( PmeForceMsg msg  ) 

Definition at line 342 of file ComputePmeCUDA.C.

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

Referenced by ComputePmeCUDADevice::sendForcesToPatch().

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


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

Generated on 6 Dec 2019 for NAMD by  doxygen 1.6.1