#include <ComputePatch.h>
Public Member Functions | |
ComputePatch (ComputeID c, PatchID pid) | |
virtual | ~ComputePatch () |
virtual void | initialize () |
virtual void | atomUpdate () |
virtual void | doWork () |
Protected Member Functions | |
virtual void | doForce (CompAtom *p, CompAtomExt *pExt, Results *r)=0 |
Protected Attributes | |
int | numAtoms |
CompAtomExt * | pExt |
CompAtom * | p |
Results * | r |
Patch * | patch |
PatchID | patchID |
Box< Patch, CompAtom > * | positionBox |
Box< Patch, Results > * | forceBox |
Definition at line 24 of file ComputePatch.h.
Definition at line 24 of file ComputePatch.C.
References forceBox, Compute::gbisPhase, patch, patchID, positionBox, and Compute::setNumPatches().
00024 : Compute(c) { 00025 setNumPatches(1); 00026 patchID = p; 00027 patch = NULL; 00028 positionBox = NULL; 00029 forceBox = NULL; 00030 gbisPhase = 3; 00031 }
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().
00033 { 00034 DebugM(4, "~ComputePatch("<<cid<<") numAtoms("<<patchID<<") = " 00035 << numAtoms << "\n"); 00036 if (positionBox != NULL) { 00037 PatchMap::Object()->patch(patchID)->unregisterPositionPickup(this, 00038 &positionBox); 00039 } 00040 if (forceBox != NULL) { 00041 PatchMap::Object()->patch(patchID)->unregisterForceDeposit(this, 00042 &forceBox); 00043 } 00044 }
void ComputePatch::atomUpdate | ( | void | ) | [virtual] |
Reimplemented from Compute.
Definition at line 78 of file ComputePatch.C.
References Patch::getNumAtoms(), numAtoms, and patch.
00078 { 00079 // How can we tell if BoxOwner has packed up and left? Need a mechanism 00080 // to handle this or do we assume the Boxes have been dumped? 00081 numAtoms = patch->getNumAtoms(); 00082 00083 // DMK - Atom Separation (water vs. non-water) 00084 #if NAMD_SeparateWaters != 0 00085 numWaterAtoms = patch->getNumWaterAtoms(); 00086 #endif 00087 }
virtual void ComputePatch::doForce | ( | CompAtom * | p, | |
CompAtomExt * | pExt, | |||
Results * | r | |||
) | [protected, pure 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().
00089 { 00090 DebugM(3,patchID << ": doWork() called.\n"); 00091 00092 #if !defined(NAMD_CUDA) && !defined(NAMD_HIP) 00093 // Inform load balancer. 00094 // I assume no threads will suspend until endWork is called 00095 LdbCoordinator::Object()->startWork(ldObjHandle); 00096 #endif 00097 if ( (computeType != computeNonbondedSelfType ) || 00098 (!patch->flags.doGBIS || gbisPhase == 1) ) { 00099 // Open up positionBox, forceBox 00100 p = positionBox->open(); 00101 r = forceBox->open(); 00102 pExt = patch->getCompAtomExtInfo(); 00103 } 00104 00105 // Pass pointers to doForce 00106 doForce(p, pExt, r); 00107 // Inform load balancer 00108 #if !defined(NAMD_CUDA) && !defined(NAMD_HIP) 00109 if (patch->flags.doGBIS && (gbisPhase == 1 || gbisPhase == 2)) { 00110 LdbCoordinator::Object()->pauseWork(ldObjHandle); 00111 } else { 00112 LdbCoordinator::Object()->endWork(ldObjHandle); 00113 } 00114 #endif 00115 // Close up boxes 00116 if ( (computeType != computeNonbondedSelfType ) || 00117 (!patch->flags.doGBIS || gbisPhase == 3) ) { 00118 positionBox->close(&p); 00119 forceBox->close(&r); 00120 } 00121 DebugM(2,patchID << ": doWork() completed.\n"); 00122 }
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(), NAMD_bug(), numAtoms, PatchMap::Object(), patch, PATCH_PRIORITY, patchID, positionBox, Patch::registerForceDeposit(), and Patch::registerPositionPickup().
00046 { 00047 // How can we tell if BoxOwner has packed up and left? Need a mechanism 00048 // to handle this or do we assume the Boxes have been dumped? 00049 00050 if (positionBox == NULL) { // We have yet to get boxes 00051 if (!(patch = PatchMap::Object()->patch(patchID))) { 00052 NAMD_bug("ComputePatch used with unknown patch."); 00053 } 00054 DebugM(3, "initialize(" << cid <<") patchid = "<<patch->getPatchID()<<"\n"); 00055 positionBox = patch->registerPositionPickup(this); 00056 forceBox = patch->registerForceDeposit(this); 00057 } 00058 numAtoms = patch->getNumAtoms(); 00059 00060 DebugM(3, "initialize("<<cid<<") numAtoms("<<patchID<<") = " 00061 << numAtoms << " patchAddr=" << patch << "\n"); 00062 Compute::initialize(); 00063 00064 int myNode = CkMyPe(); 00065 if ( PatchMap::Object()->node(patchID) != myNode ) { 00066 basePriority = GB1_COMPUTE_PROXY_PRIORITY + PATCH_PRIORITY(patchID); 00067 gbisPhasePriority[0] = 0; 00068 gbisPhasePriority[1] = GB2_COMPUTE_PROXY_PRIORITY-GB1_COMPUTE_PROXY_PRIORITY;//sub GB1_PRIOR 00069 gbisPhasePriority[2] = COMPUTE_PROXY_PRIORITY-GB1_COMPUTE_PROXY_PRIORITY; 00070 } else { 00071 basePriority = GB1_COMPUTE_HOME_PRIORITY + PATCH_PRIORITY(patchID); 00072 gbisPhasePriority[0] = 0; 00073 gbisPhasePriority[1] = GB2_COMPUTE_HOME_PRIORITY-GB1_COMPUTE_HOME_PRIORITY; 00074 gbisPhasePriority[2] = COMPUTE_HOME_PRIORITY-GB1_COMPUTE_HOME_PRIORITY; 00075 } 00076 }
Box<Patch,Results>* ComputePatch::forceBox [protected] |
Definition at line 51 of file ComputePatch.h.
Referenced by ComputePatch(), doWork(), initialize(), ComputeNonbondedSelf::noWork(), and ~ComputePatch().
int ComputePatch::numAtoms [protected] |
Definition at line 35 of file ComputePatch.h.
Referenced by atomUpdate(), ComputeNonbondedSelf::doForce(), initialize(), ComputeNonbondedSelf::noWork(), and ~ComputePatch().
CompAtom* ComputePatch::p [protected] |
Definition at line 37 of file ComputePatch.h.
Referenced by doWork().
Patch* ComputePatch::patch [protected] |
Definition at line 46 of file ComputePatch.h.
Referenced by atomUpdate(), ComputePatch(), ComputeNonbondedSelf::doForce(), doWork(), initialize(), ComputeNonbondedSelf::initialize(), ComputeNonbondedSelf::noWork(), and ComputeNonbondedSelf::~ComputeNonbondedSelf().
PatchID ComputePatch::patchID [protected] |
Definition at line 49 of file ComputePatch.h.
Referenced by ComputePatch(), doWork(), initialize(), ComputeNonbondedSelf::initialize(), and ~ComputePatch().
CompAtomExt* ComputePatch::pExt [protected] |
Definition at line 36 of file ComputePatch.h.
Referenced by doWork().
Box<Patch,CompAtom>* ComputePatch::positionBox [protected] |
Definition at line 50 of file ComputePatch.h.
Referenced by ComputePatch(), doWork(), initialize(), ComputeNonbondedSelf::noWork(), and ~ComputePatch().
Results* ComputePatch::r [protected] |
Definition at line 38 of file ComputePatch.h.
Referenced by doWork().