NAMD
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ComputePatch Class Referenceabstract

#include <ComputePatch.h>

Inheritance diagram for ComputePatch:
Compute ComputeNonbondedSelf

Public Member Functions

 ComputePatch (ComputeID c, PatchID pid)
 
virtual ~ComputePatch ()
 
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, CompAtomExt *pExt, Results *r)=0
 
- Protected Member Functions inherited from Compute
void enqueueWork ()
 

Protected Attributes

int numAtoms
 
CompAtomExtpExt
 
CompAtomp
 
Resultsr
 
Patchpatch
 
PatchID patchID
 
Box< Patch, CompAtom > * positionBox
 
Box< Patch, Results > * forceBox
 
- 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 24 of file ComputePatch.h.

Constructor & Destructor Documentation

ComputePatch::ComputePatch ( ComputeID  c,
PatchID  pid 
)

Definition at line 24 of file ComputePatch.C.

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

24  : Compute(c) {
25  setNumPatches(1);
26  patchID = p;
27  patch = NULL;
28  positionBox = NULL;
29  forceBox = NULL;
30  gbisPhase = 3;
31 }
void setNumPatches(int n)
Definition: Compute.h:52
CompAtom * p
Definition: ComputePatch.h:37
Patch * patch
Definition: ComputePatch.h:46
Box< Patch, Results > * forceBox
Definition: ComputePatch.h:51
PatchID patchID
Definition: ComputePatch.h:49
int gbisPhase
Definition: Compute.h:39
Box< Patch, CompAtom > * positionBox
Definition: ComputePatch.h:50
Compute(ComputeID)
Definition: Compute.C:33
ComputePatch::~ComputePatch ( )
virtual

Definition at line 33 of file ComputePatch.C.

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

33  {
34  DebugM(4, "~ComputePatch("<<cid<<") numAtoms("<<patchID<<") = "
35  << numAtoms << "\n");
36  if (positionBox != NULL) {
38  &positionBox);
39  }
40  if (forceBox != NULL) {
42  &forceBox);
43  }
44 }
static PatchMap * Object()
Definition: PatchMap.h:27
Box< Patch, Results > * forceBox
Definition: ComputePatch.h:51
#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
PatchID patchID
Definition: ComputePatch.h:49
void unregisterPositionPickup(Compute *cid, Box< Patch, CompAtom > **const box)
Definition: Patch.C:122
Box< Patch, CompAtom > * positionBox
Definition: ComputePatch.h:50
const ComputeID cid
Definition: Compute.h:43

Member Function Documentation

void ComputePatch::atomUpdate ( void  )
virtual

Reimplemented from Compute.

Definition at line 78 of file ComputePatch.C.

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

78  {
79  // How can we tell if BoxOwner has packed up and left? Need a mechanism
80  // to handle this or do we assume the Boxes have been dumped?
82 
83  // DMK - Atom Separation (water vs. non-water)
84  #if NAMD_SeparateWaters != 0
85  numWaterAtoms = patch->getNumWaterAtoms();
86  #endif
87 }
Patch * patch
Definition: ComputePatch.h:46
int getNumAtoms()
Definition: Patch.h:105
virtual void ComputePatch::doForce ( CompAtom p,
CompAtomExt pExt,
Results r 
)
protectedpure virtual

Implemented in ComputeNonbondedSelf.

Referenced by doWork().

void ComputePatch::doWork ( void  )
virtual

Reimplemented from Compute.

Definition at line 89 of file ComputePatch.C.

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

89  {
90  DebugM(3,patchID << ": doWork() called.\n");
91 
92 #ifndef NAMD_CUDA
93  // Inform load balancer.
94  // I assume no threads will suspend until endWork is called
96 #endif
98  (!patch->flags.doGBIS || gbisPhase == 1) ) {
99  // Open up positionBox, forceBox
100  p = positionBox->open();
101  r = forceBox->open();
103  }
104 
105  // Pass pointers to doForce
106  doForce(p, pExt, r);
107 // Inform load balancer
108 #ifndef NAMD_CUDA
109  if (patch->flags.doGBIS && (gbisPhase == 1 || gbisPhase == 2)) {
111  } else {
113  }
114 #endif
115  // Close up boxes
117  (!patch->flags.doGBIS || gbisPhase == 3) ) {
118  positionBox->close(&p);
119  forceBox->close(&r);
120  }
121  DebugM(2,patchID << ": doWork() completed.\n");
122 }
CompAtom * p
Definition: ComputePatch.h:37
CompAtomExt * pExt
Definition: ComputePatch.h:36
Patch * patch
Definition: ComputePatch.h:46
Box< Patch, Results > * forceBox
Definition: ComputePatch.h:51
#define DebugM(x, y)
Definition: Debug.h:59
void startWork(const LDObjHandle &handle)
virtual void doForce(CompAtom *p, CompAtomExt *pExt, Results *r)=0
LDObjHandle ldObjHandle
Definition: Compute.h:44
void pauseWork(const LDObjHandle &handle)
Flags flags
Definition: Patch.h:127
PatchID patchID
Definition: ComputePatch.h:49
Results * r
Definition: ComputePatch.h:38
int computeType
Definition: Compute.h:36
static LdbCoordinator * Object()
int gbisPhase
Definition: Compute.h:39
void endWork(const LDObjHandle &handle)
Box< Patch, CompAtom > * positionBox
Definition: ComputePatch.h:50
int doGBIS
Definition: PatchTypes.h:28
Data * open(void)
Definition: Box.h:39
void close(Data **const t)
Definition: Box.h:49
CompAtomExt * getCompAtomExtInfo()
Definition: Patch.h:117
void ComputePatch::initialize ( void  )
virtual

Reimplemented from Compute.

Reimplemented in ComputeNonbondedSelf.

Definition at line 46 of file ComputePatch.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(), Patch::getPatchID(), Compute::initialize(), NAMD_bug(), numAtoms, PatchMap::Object(), patch, PATCH_PRIORITY, patchID, positionBox, Patch::registerForceDeposit(), and Patch::registerPositionPickup().

Referenced by ComputeNonbondedSelf::initialize().

46  {
47  // How can we tell if BoxOwner has packed up and left? Need a mechanism
48  // to handle this or do we assume the Boxes have been dumped?
49 
50  if (positionBox == NULL) { // We have yet to get boxes
51  if (!(patch = PatchMap::Object()->patch(patchID))) {
52  NAMD_bug("ComputePatch used with unknown patch.");
53  }
54  DebugM(3, "initialize(" << cid <<") patchid = "<<patch->getPatchID()<<"\n");
57  }
59 
60  DebugM(3, "initialize("<<cid<<") numAtoms("<<patchID<<") = "
61  << numAtoms << " patchAddr=" << patch << "\n");
63 
64  int myNode = CkMyPe();
65  if ( PatchMap::Object()->node(patchID) != myNode ) {
67  gbisPhasePriority[0] = 0;
70  } else {
72  gbisPhasePriority[0] = 0;
75  }
76 }
#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
static PatchMap * Object()
Definition: PatchMap.h:27
Patch * patch
Definition: ComputePatch.h:46
Box< Patch, Results > * forceBox
Definition: ComputePatch.h:51
#define DebugM(x, y)
Definition: Debug.h:59
virtual void initialize()
Definition: Compute.h:56
PatchID patchID
Definition: ComputePatch.h:49
#define COMPUTE_HOME_PRIORITY
Definition: Priorities.h:76
void NAMD_bug(const char *err_msg)
Definition: common.C:123
int gbisPhasePriority[3]
Definition: Compute.h:40
PatchID getPatchID()
Definition: Patch.h:114
#define GB1_COMPUTE_PROXY_PRIORITY
Definition: Priorities.h:52
Box< Patch, CompAtom > * positionBox
Definition: ComputePatch.h:50
#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>* ComputePatch::forceBox
protected
int ComputePatch::numAtoms
protected
CompAtom* ComputePatch::p
protected

Definition at line 37 of file ComputePatch.h.

Referenced by ComputePatch(), ComputeNonbondedSelf::doForce(), and doWork().

Patch* ComputePatch::patch
protected
PatchID ComputePatch::patchID
protected
CompAtomExt* ComputePatch::pExt
protected

Definition at line 36 of file ComputePatch.h.

Referenced by ComputeNonbondedSelf::doForce(), and doWork().

Box<Patch,CompAtom>* ComputePatch::positionBox
protected
Results* ComputePatch::r
protected

Definition at line 38 of file ComputePatch.h.

Referenced by doWork().


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