NAMD
Classes | Public Member Functions | List of all members
ComputePmeCUDA Class Reference

#include <ComputePmeCUDA.h>

Inheritance diagram for ComputePmeCUDA:
Compute

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)
 
- Public Member Functions inherited from Compute
 Compute (ComputeID)
 
int type ()
 
virtual ~Compute ()
 
void setNumPatches (int n)
 
int getNumPatches ()
 
virtual void patchReady (PatchID, int doneMigration, int seq)
 
virtual void finishPatch (int)
 
int sequence (void)
 
int priority (void)
 
int getGBISPhase (void)
 
virtual void gbisP2PatchReady (PatchID, int seq)
 
virtual void gbisP3PatchReady (PatchID, int seq)
 

Additional Inherited Members

- Public Attributes inherited from Compute
const ComputeID cid
 
LDObjHandle ldObjHandle
 
LocalWorkMsg *const localWorkMsg
 
- Protected Member Functions inherited from Compute
void enqueueWork ()
 
- Protected Attributes inherited from Compute
int computeType
 
int basePriority
 
int gbisPhase
 
int gbisPhasePriority [3]
 

Detailed Description

Definition at line 17 of file ComputePmeCUDA.h.

Constructor & Destructor Documentation

ComputePmeCUDA::ComputePmeCUDA ( ComputeID  c,
PatchIDList pids 
)

Definition at line 24 of file ComputePmeCUDA.C.

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

24  : Compute(c) {
25  setNumPatches(pids.size());
26  patches.resize(getNumPatches());
27  for (int i=0;i < getNumPatches();i++) {
28  patches[i].patchID = pids[i];
29  }
30 }
void setNumPatches(int n)
Definition: Compute.h:52
int getNumPatches()
Definition: Compute.h:53
int size(void) const
Definition: ResizeArray.h:127
Compute(ComputeID)
Definition: Compute.C:33
ComputePmeCUDA::ComputePmeCUDA ( ComputeID  c,
PatchID  pid 
)

Definition at line 35 of file ComputePmeCUDA.C.

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

35  : Compute(c) {
36  setNumPatches(1);
37  patches.resize(getNumPatches());
38  patches[0].patchID = pid;
39 }
void setNumPatches(int n)
Definition: Compute.h:52
int getNumPatches()
Definition: Compute.h:53
Compute(ComputeID)
Definition: Compute.C:33
ComputePmeCUDA::~ComputePmeCUDA ( )
virtual

Definition at line 44 of file ComputePmeCUDA.C.

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

44  {
45  for (int i=0;i < getNumPatches();i++) {
46  if (patches[i].positionBox != NULL) {
47  PatchMap::Object()->patch(patches[i].patchID)->unregisterPositionPickup(this, &patches[i].positionBox);
48  }
49  if (patches[i].avgPositionBox != NULL) {
50  PatchMap::Object()->patch(patches[i].patchID)->unregisterAvgPositionPickup(this, &patches[i].avgPositionBox);
51  }
52  if (patches[i].forceBox != NULL) {
53  PatchMap::Object()->patch(patches[i].patchID)->unregisterForceDeposit(this, &patches[i].forceBox);
54  }
55  }
56  delete reduction;
57  CmiDestroyLock(lock);
58 }
void unregisterAvgPositionPickup(Compute *cid, Box< Patch, CompAtom > **const box)
Definition: Patch.C:140
static PatchMap * Object()
Definition: PatchMap.h:27
void unregisterForceDeposit(Compute *cid, Box< Patch, Results > **const box)
Definition: Patch.C:239
Patch * patch(PatchID pid)
Definition: PatchMap.h:235
void unregisterPositionPickup(Compute *cid, Box< Patch, CompAtom > **const box)
Definition: Patch.C:122
int getNumPatches()
Definition: Compute.h:53

Member Function Documentation

void ComputePmeCUDA::atomUpdate ( void  )
virtual

Reimplemented from Compute.

Definition at line 100 of file ComputePmeCUDA.C.

100  {
101  atomsChanged = true;
102 }
void ComputePmeCUDA::doWork ( void  )
virtual

Reimplemented from Compute.

Definition at line 144 of file ComputePmeCUDA.C.

144  {
145  if (sendAtomsDone) {
146  // Second part of computation: receive forces from ComputePmeCUDAMgr
147  // basePriority = PME_OFFLOAD_PRIORITY;
148  sendAtomsDone = false;
149  recvForces();
150  } else {
151  // First part of computation: send atoms to ComputePmeCUDAMgr
152  sendAtomsDone = true;
153  // basePriority = COMPUTE_HOME_PRIORITY + PATCH_PRIORITY(patchID);
154  sendAtoms();
155  }
156 }
void ComputePmeCUDA::initialize ( void  )
virtual

Reimplemented from Compute.

Definition at line 63 of file ComputePmeCUDA.C.

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

63  {
64  lock = CmiCreateLock();
65 
66  // Sanity Check
68  if (simParams->alchFepOn) NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, alchFepOn not yet implemented");
69  if (simParams->alchThermIntOn) NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, alchThermIntOn not yet implemented");
70  if (simParams->lesOn) NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, lesOn not yet implemented");
71  if (simParams->pairInteractionOn) NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, pairInteractionOn not yet implemented");
72 
73  sendAtomsDone = false;
75  // basePriority = PME_PRIORITY;
76  patchCounter = getNumPatches();
77 
78  // Get proxy to ComputePmeCUDAMgr
79  computePmeCUDAMgrProxy = CkpvAccess(BOCclass_group).computePmeCUDAMgr;
80  mgr = computePmeCUDAMgrProxy.ckLocalBranch();
81  if (mgr == NULL)
82  NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, unable to locate local branch of BOC entry computePmeCUDAMgr");
83  pmeGrid = mgr->getPmeGrid();
84 
85  for (int i=0;i < getNumPatches();i++) {
86  if (patches[i].positionBox != NULL || patches[i].avgPositionBox != NULL
87  || patches[i].forceBox != NULL || patches[i].patch != NULL)
88  NAMD_bug("ComputePmeCUDA::initialize() called twice or boxes not set to NULL");
89  if (!(patches[i].patch = PatchMap::Object()->patch(patches[i].patchID))) {
90  NAMD_bug("ComputePmeCUDA::initialize() patch not found");
91  }
92  patches[i].positionBox = patches[i].patch->registerPositionPickup(this);
93  patches[i].forceBox = patches[i].patch->registerForceDeposit(this);
94  patches[i].avgPositionBox = patches[i].patch->registerAvgPositionPickup(this);
95  }
96 
97  setupActivePencils();
98 }
static Node * Object()
Definition: Node.h:86
static PatchMap * Object()
Definition: PatchMap.h:27
SimParameters * simParameters
Definition: Node.h:178
SubmitReduction * willSubmit(int setID, int size=-1)
Definition: ReductionMgr.C:365
static ReductionMgr * Object(void)
Definition: ReductionMgr.h:278
Bool pairInteractionOn
void NAMD_bug(const char *err_msg)
Definition: common.C:129
#define simParams
Definition: Output.C:127
int getNumPatches()
Definition: Compute.h:53
int ComputePmeCUDA::noWork ( )
virtual

Reimplemented from Compute.

Definition at line 128 of file ComputePmeCUDA.C.

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

128  {
129 
130  if (patches[0].patch->flags.doFullElectrostatics) return 0;
131 
132  reduction->submit();
133 
134  for (int i=0;i < getNumPatches();i++) {
135  patches[i].positionBox->skip();
136  patches[i].forceBox->skip();
137  // We only need to call skip() once
138  if (patches[i].patchID == 0) computePmeCUDAMgrProxy[patches[i].homePencilNode].skip();
139  }
140 
141  return 1;
142 }
int getNumPatches()
Definition: Compute.h:53
void submit(void)
Definition: ReductionMgr.h:323
bool ComputePmeCUDA::storePmeForceMsg ( PmeForceMsg msg)

Definition at line 348 of file ComputePmeCUDA.C.

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

Referenced by ComputePmeCUDADevice::sendForcesToPatch().

348  {
349  bool done = false;
350  int i;
351  CmiLock(lock);
352  patchCounter--;
353  i = patchCounter;
354  if (patchCounter == 0) {
355  patchCounter = getNumPatches();
356  done = true;
357  }
358  CmiUnlock(lock);
359  if (patches[i].pmeForceMsg != NULL)
360  NAMD_bug("ComputePmeCUDA::storePmeForceMsg, already contains message");
361  patches[i].pmeForceMsg = msg;
362  return done;
363 }
void NAMD_bug(const char *err_msg)
Definition: common.C:129
int getNumPatches()
Definition: Compute.h:53

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