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 19 of file ComputePmeCUDA.C.

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

19  : Compute(c) {
20  setNumPatches(pids.size());
21  patches.resize(getNumPatches());
22  for (int i=0;i < getNumPatches();i++) {
23  patches[i].patchID = pids[i];
24  }
25 }
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 30 of file ComputePmeCUDA.C.

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

30  : Compute(c) {
31  setNumPatches(1);
32  patches.resize(getNumPatches());
33  patches[0].patchID = pid;
34 }
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 39 of file ComputePmeCUDA.C.

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

39  {
40  for (int i=0;i < getNumPatches();i++) {
41  if (patches[i].positionBox != NULL) {
42  PatchMap::Object()->patch(patches[i].patchID)->unregisterPositionPickup(this, &patches[i].positionBox);
43  }
44  if (patches[i].avgPositionBox != NULL) {
45  PatchMap::Object()->patch(patches[i].patchID)->unregisterAvgPositionPickup(this, &patches[i].avgPositionBox);
46  }
47  if (patches[i].forceBox != NULL) {
48  PatchMap::Object()->patch(patches[i].patchID)->unregisterForceDeposit(this, &patches[i].forceBox);
49  }
50  }
51  delete reduction;
52  CmiDestroyLock(lock);
53 }
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 95 of file ComputePmeCUDA.C.

95  {
96  atomsChanged = true;
97 }
void ComputePmeCUDA::doWork ( void  )
virtual

Reimplemented from Compute.

Definition at line 139 of file ComputePmeCUDA.C.

139  {
140  if (sendAtomsDone) {
141  // Second part of computation: receive forces from ComputePmeCUDAMgr
142  // basePriority = PME_OFFLOAD_PRIORITY;
143  sendAtomsDone = false;
144  recvForces();
145  } else {
146  // First part of computation: send atoms to ComputePmeCUDAMgr
147  sendAtomsDone = true;
148  // basePriority = COMPUTE_HOME_PRIORITY + PATCH_PRIORITY(patchID);
149  sendAtoms();
150  }
151 }
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(), Node::Object(), ReductionMgr::Object(), SimParameters::pairInteractionOn, REDUCTIONS_BASIC, Node::simParameters, simParams, and ReductionMgr::willSubmit().

58  {
59  lock = CmiCreateLock();
60 
61  // Sanity Check
63  if (simParams->alchFepOn) NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, alchFepOn not yet implemented");
64  if (simParams->alchThermIntOn) NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, alchThermIntOn not yet implemented");
65  if (simParams->lesOn) NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, lesOn not yet implemented");
66  if (simParams->pairInteractionOn) NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, pairInteractionOn not yet implemented");
67 
68  sendAtomsDone = false;
70  // basePriority = PME_PRIORITY;
71  patchCounter = getNumPatches();
72 
73  // Get proxy to ComputePmeCUDAMgr
74  computePmeCUDAMgrProxy = CkpvAccess(BOCclass_group).computePmeCUDAMgr;
75  mgr = computePmeCUDAMgrProxy.ckLocalBranch();
76  if (mgr == NULL)
77  NAMD_bug("ComputePmeCUDA::ComputePmeCUDA, unable to locate local branch of BOC entry computePmeCUDAMgr");
78  pmeGrid = mgr->getPmeGrid();
79 
80  for (int i=0;i < getNumPatches();i++) {
81  if (patches[i].positionBox != NULL || patches[i].avgPositionBox != NULL
82  || patches[i].forceBox != NULL || patches[i].patch != NULL)
83  NAMD_bug("ComputePmeCUDA::initialize() called twice or boxes not set to NULL");
84  if (!(patches[i].patch = PatchMap::Object()->patch(patches[i].patchID))) {
85  NAMD_bug("ComputePmeCUDA::initialize() patch not found");
86  }
87  patches[i].positionBox = patches[i].patch->registerPositionPickup(this);
88  patches[i].forceBox = patches[i].patch->registerForceDeposit(this);
89  patches[i].avgPositionBox = patches[i].patch->registerAvgPositionPickup(this);
90  }
91 
92  setupActivePencils();
93 }
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:123
#define simParams
Definition: Output.C:127
int getNumPatches()
Definition: Compute.h:53
int ComputePmeCUDA::noWork ( )
virtual

Reimplemented from Compute.

Definition at line 123 of file ComputePmeCUDA.C.

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

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

Definition at line 343 of file ComputePmeCUDA.C.

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

Referenced by ComputePmeCUDADevice::sendForcesToPatch().

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

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