NAMD
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ComputePatchPair Class Reference

#include <ComputePatchPair.h>

Inheritance diagram for ComputePatchPair:
Compute ComputeNonbondedPair

Public Member Functions

 ComputePatchPair (ComputeID c, PatchID pid[], int t[])
 
virtual ~ComputePatchPair ()
 
virtual void initialize ()
 
virtual void atomUpdate ()
 
virtual void doWork ()
 
- 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 int noWork ()
 
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)
 

Protected Member Functions

virtual void doForce (CompAtom *p[2], CompAtomExt *pExt[2], Results *r[2])
 
- Protected Member Functions inherited from Compute
void enqueueWork ()
 

Protected Attributes

int numAtoms [2]
 
CompAtomExtpExt [2]
 
CompAtomp [2]
 
Resultsr [2]
 
Patchpatch [2]
 
PatchID patchID [2]
 
int trans [2]
 
Box< Patch, CompAtom > * positionBox [2]
 
Box< Patch, Results > * forceBox [2]
 
- Protected Attributes inherited from Compute
int computeType
 
int basePriority
 
int gbisPhase
 
int gbisPhasePriority [3]
 

Additional Inherited Members

- Public Attributes inherited from Compute
const ComputeID cid
 
LDObjHandle ldObjHandle
 
LocalWorkMsg *const localWorkMsg
 

Detailed Description

Definition at line 25 of file ComputePatchPair.h.

Constructor & Destructor Documentation

ComputePatchPair::ComputePatchPair ( ComputeID  c,
PatchID  pid[],
int  t[] 
)

Definition at line 20 of file ComputePatchPair.C.

References forceBox, Compute::gbisPhase, patch, patchID, positionBox, Compute::setNumPatches(), and trans.

21  : Compute(c) {
22 
23  gbisPhase = 3;
24  setNumPatches(2);
25 
26  for (int i=0; i<2; i++) {
27  patchID[i] = p[i];
28  trans[i] = t[i];
29  patch[i] = NULL;
30  positionBox[i] = NULL;
31  forceBox[i] = NULL;
32  }
33 }
void setNumPatches(int n)
Definition: Compute.h:52
CompAtom * p[2]
Box< Patch, CompAtom > * positionBox[2]
Box< Patch, Results > * forceBox[2]
int gbisPhase
Definition: Compute.h:39
Compute(ComputeID)
Definition: Compute.C:33
ComputePatchPair::~ComputePatchPair ( )
virtual

Definition at line 35 of file ComputePatchPair.C.

References Compute::cid, DebugM, forceBox, numAtoms, PatchMap::Object(), patch, PatchMap::patch(), patchID, positionBox, Patch::unregisterForceDeposit(), and Patch::unregisterPositionPickup().

35  {
36  DebugM(4, "~ComputePatchPair("<<cid<<") numAtoms("<<patchID[0]<<") = "
37  << numAtoms[0]
38  << " numAtoms("<<patchID[1]<<") = " << numAtoms[1] << "\n" );
39  DebugM(4, "~ComputePatchPair("<<cid<<") addr("<<patchID[0]<<") = "
40  << PatchMap::Object()->patch(patchID[0]) << " addr("<<patchID[1]<<") = "
41  << PatchMap::Object()->patch(patchID[1]) << "\n");
42  for (int i=0; i<2; i++) {
43  if (positionBox[i] != NULL) {
45  &positionBox[i]);
46  }
47  if (forceBox[i] != NULL) {
49  &forceBox[i]);
50  }
51  }
52 
53 }
Box< Patch, CompAtom > * positionBox[2]
static PatchMap * Object()
Definition: PatchMap.h:27
#define DebugM(x, y)
Definition: Debug.h:59
void unregisterForceDeposit(Compute *cid, Box< Patch, Results > **const box)
Definition: Patch.C:239
Patch * patch(PatchID pid)
Definition: PatchMap.h:235
Box< Patch, Results > * forceBox[2]
void unregisterPositionPickup(Compute *cid, Box< Patch, CompAtom > **const box)
Definition: Patch.C:122
const ComputeID cid
Definition: Compute.h:43

Member Function Documentation

void ComputePatchPair::atomUpdate ( void  )
virtual

Reimplemented from Compute.

Definition at line 116 of file ComputePatchPair.C.

References Patch::getNumAtoms(), numAtoms, and patch.

116  {
117  // How can we tell if BoxOwner has packed up and left? Need a mechanism
118  // to handle this or do we assume the Boxes have been dumped?
119 
120  // DebugM(4,"atomUpdate() - positionBox[0] is " << positionBox[0] << "\n");
121  for (int i=0; i<2; i++) {
122 
123  numAtoms[i] = patch[i]->getNumAtoms();
124 
125  // DMK - Atom Separation (water vs. non-water)
126  #if NAMD_SeparateWaters != 0
127  numWaterAtoms[i] = patch[i]->getNumWaterAtoms();
128  #endif
129  }
130 
131 
132 
133  // Compute::atomUpdate();
134 }
int getNumAtoms()
Definition: Patch.h:105
void ComputePatchPair::doForce ( CompAtom p[2],
CompAtomExt pExt[2],
Results r[2] 
)
protectedvirtual

Reimplemented in ComputeNonbondedPair.

Definition at line 137 of file ComputePatchPair.C.

References numAtoms.

Referenced by doWork().

138 {
139  CkPrintf("ComputePatchPair::doForce() - Dummy eval was sent\n");
140  CkPrintf(" %d patch 1 atoms and %d patch 2 atoms\n", numAtoms[0], numAtoms[1] );
141 }
void ComputePatchPair::doWork ( void  )
virtual

Reimplemented from Compute.

Definition at line 147 of file ComputePatchPair.C.

References Box< Owner, Data >::close(), computeNonbondedPairType, Compute::computeType, doForce(), LdbCoordinator::endWork(), forceBox, Compute::gbisPhase, Patch::getCompAtomExtInfo(), Compute::ldObjHandle, LdbCoordinator::Object(), Box< Owner, Data >::open(), p, patch, LdbCoordinator::pauseWork(), pExt, positionBox, r, and LdbCoordinator::startWork().

147  {
148 
149 #ifndef NAMD_CUDA
151 #endif
153  (!patch[0]->flags.doGBIS || gbisPhase == 1) ) {
154  // Open up positionBox, forceBox, and atomBox
155  for (int i=0; i<2; i++) {
156  p[i] = positionBox[i]->open();
157  r[i] = forceBox[i]->open();
158  pExt[i] = patch[i]->getCompAtomExtInfo();
159  }
160  }
161 
162  doForce(p, pExt, r);
163  // Inform load balancer
164 #ifndef NAMD_CUDA
165  if (patch[0]->flags.doGBIS && (gbisPhase == 1 || gbisPhase == 2)) {
167  } else {
169  }
170 #endif
171 
172  // Close up boxes
174  (!patch[0]->flags.doGBIS || gbisPhase == 3) ) {
175  for (int i=0; i<2; i++) {
176  positionBox[i]->close(&p[i]);
177  forceBox[i]->close(&r[i]);
178  }
179  }
180 
181 }
CompAtom * p[2]
Box< Patch, CompAtom > * positionBox[2]
CompAtomExt * pExt[2]
void startWork(const LDObjHandle &handle)
LDObjHandle ldObjHandle
Definition: Compute.h:44
void pauseWork(const LDObjHandle &handle)
Box< Patch, Results > * forceBox[2]
int computeType
Definition: Compute.h:36
static LdbCoordinator * Object()
int gbisPhase
Definition: Compute.h:39
void endWork(const LDObjHandle &handle)
virtual void doForce(CompAtom *p[2], CompAtomExt *pExt[2], Results *r[2])
Data * open(void)
Definition: Box.h:39
void close(Data **const t)
Definition: Box.h:49
CompAtomExt * getCompAtomExtInfo()
Definition: Patch.h:117
void ComputePatchPair::initialize ( void  )
virtual

Reimplemented from Compute.

Reimplemented in ComputeNonbondedPair.

Definition at line 55 of file ComputePatchPair.C.

References Compute::basePriority, Compute::cid, COMPUTE_HOME_PRIORITY, COMPUTE_PROXY_PRIORITY, DebugM, forceBox, GB1_COMPUTE_HOME_PRIORITY, GB1_COMPUTE_PROXY_PRIORITY, GB2_COMPUTE_HOME_PRIORITY, GB2_COMPUTE_PROXY_PRIORITY, Compute::gbisPhasePriority, Patch::getNumAtoms(), Compute::initialize(), numAtoms, PatchMap::Object(), patch, PATCH_PRIORITY, patchID, positionBox, Patch::registerForceDeposit(), and Patch::registerPositionPickup().

Referenced by ComputeNonbondedPair::initialize().

55  {
56  // How can we tell if BoxOwner has packed up and left? Need a mechanism
57  // to handle this or do we assume the Boxes have been dumped?
58 
59  for (int i=0; i<2; i++) {
60  if (positionBox[i] == NULL) { // We have yet to get boxes
61  if (!(patch[i] = PatchMap::Object()->patch(patchID[i]))) {
62  DebugM(5,"invalid patch(" << patchID[i]
63  << ") pointer!\n");
64  }
66  forceBox[i] = patch[i]->registerForceDeposit(this);
67  }
68  numAtoms[i] = patch[i]->getNumAtoms();
69  }
70 
71  DebugM(4, "initialize("<<cid<<") numAtoms("<<patchID[0]<<") = "
72  << numAtoms[0]
73  << " numAtoms(" <<patchID[1]<<") = " << numAtoms[1] << "\n" );
74 
76 
77  // proxies are more urgent (lower priority) than patches
78  int myNode = CkMyPe();
79  int p0 = PATCH_PRIORITY(patchID[0]);
80  if ( PatchMap::Object()->node(patchID[0]) == myNode ) {
82  } else {
84  }
85  int p1 = PATCH_PRIORITY(patchID[1]);
86  if ( PatchMap::Object()->node(patchID[1]) == myNode ) {
88  } else {
90  }
91  if (p0<p1) { //base phase priorities off of p0
92  if ( PatchMap::Object()->node(patchID[0]) == myNode ) {
93  gbisPhasePriority[0] = 0;
96  } else {
97  gbisPhasePriority[0] = 0;
100  }
101  } else { //base phase priorities off of p1
102  if ( PatchMap::Object()->node(patchID[1]) == myNode ) {
103  gbisPhasePriority[0] = 0;
106  } else {
107  gbisPhasePriority[0] = 0;
110  }
111  }
112  basePriority = ((p0<p1)?p0:p1); // most urgent wins
113 
114 }
#define COMPUTE_PROXY_PRIORITY
Definition: Priorities.h:71
#define GB1_COMPUTE_HOME_PRIORITY
Definition: Priorities.h:56
#define GB2_COMPUTE_PROXY_PRIORITY
Definition: Priorities.h:60
Box< Patch, CompAtom > * positionBox[2]
static PatchMap * Object()
Definition: PatchMap.h:27
#define DebugM(x, y)
Definition: Debug.h:59
virtual void initialize()
Definition: Compute.h:56
Box< Patch, Results > * forceBox[2]
#define COMPUTE_HOME_PRIORITY
Definition: Priorities.h:76
int gbisPhasePriority[3]
Definition: Compute.h:40
#define GB1_COMPUTE_PROXY_PRIORITY
Definition: Priorities.h:52
#define GB2_COMPUTE_HOME_PRIORITY
Definition: Priorities.h:64
int getNumAtoms()
Definition: Patch.h:105
int basePriority
Definition: Compute.h:37
const ComputeID cid
Definition: Compute.h:43
Box< Patch, CompAtom > * registerPositionPickup(Compute *cid)
Definition: Patch.C:107
#define PATCH_PRIORITY(PID)
Definition: Priorities.h:25
Box< Patch, Results > * registerForceDeposit(Compute *cid)
Definition: Patch.C:228

Member Data Documentation

Box<Patch,Results>* ComputePatchPair::forceBox[2]
protected
int ComputePatchPair::numAtoms[2]
protected
CompAtom* ComputePatchPair::p[2]
protected

Definition at line 38 of file ComputePatchPair.h.

Referenced by doWork().

Patch* ComputePatchPair::patch[2]
protected
PatchID ComputePatchPair::patchID[2]
protected
CompAtomExt* ComputePatchPair::pExt[2]
protected

Definition at line 37 of file ComputePatchPair.h.

Referenced by doWork().

Box<Patch,CompAtom>* ComputePatchPair::positionBox[2]
protected
Results* ComputePatchPair::r[2]
protected

Definition at line 39 of file ComputePatchPair.h.

Referenced by doWork().

int ComputePatchPair::trans[2]
protected

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