#include <WorkDistrib.h>
Inheritance diagram for WorkDistrib:

|
|
Definition at line 76 of file WorkDistrib.C. 00077 {
00078 CkpvAccess(BOCclass_group).workDistrib = thisgroup;
00079 mapsArrived = false;
00080 awaitingMaps = false;
00081 }
|
|
|
Definition at line 84 of file WorkDistrib.C. 00085 { }
|
|
|
Definition at line 925 of file WorkDistrib.C. References Patch::getNumAtoms(), Node::molecule, NAMD_die(), PatchMap::node(), Molecule::numAtoms, Node::numNodes(), PatchMap::numPatches(), Node::Object(), PatchMap::Object(), and PatchMap::patch(). Referenced by Node::startup(). 00926 {
00927 PatchMap *patchMap = PatchMap::Object();
00928 int nNodes = Node::Object()->numNodes();
00929
00930 #if USE_TOPOMAP
00931 TopoManager tmgr;
00932 int numPes = tmgr.getDimNX() * tmgr.getDimNY() * tmgr.getDimNZ();
00933 if (numPes > patchMap->numPatches() && (assignPatchesTopoGridRecBisection() > 0)) {
00934 CkPrintf ("Blue Gene/L topology partitioner finished successfully \n");
00935 }
00936 else
00937 #endif
00938 if (nNodes > patchMap->numPatches())
00939 assignPatchesBitReversal();
00940 else
00941 #if (CMK_BLUEGENEP | CMK_BLUEGENEL)
00942 assignPatchesRecursiveBisection();
00943 #else
00944 assignPatchesSpaceFillingCurve();
00945 #endif
00946 // assignPatchesRoundRobin();
00947 // assignPatchesToLowestLoadNode();
00948
00949 int *nAtoms = new int[nNodes];
00950 int numAtoms=0;
00951 int i;
00952 for(i=0; i < nNodes; i++)
00953 nAtoms[i] = 0;
00954
00955 for(i=0; i < patchMap->numPatches(); i++)
00956 {
00957 // iout << iINFO << "Patch " << i << " has "
00958 // << patchMap->patch(i)->getNumAtoms() << " atoms and "
00959 // << patchMap->patch(i)->getNumAtoms() *
00960 // patchMap->patch(i)->getNumAtoms()
00961 // << " pairs.\n" << endi;
00962
00963 if (patchMap->patch(i)) {
00964 numAtoms += patchMap->patch(i)->getNumAtoms();
00965 nAtoms[patchMap->node(i)] += patchMap->patch(i)->getNumAtoms();
00966 }
00967 }
00968
00969 // for(i=0; i < nNodes; i++)
00970 // iout << iINFO
00971 // << nAtoms[i] << " atoms assigned to node " << i << "\n" << endi;
00972 if ( numAtoms != Node::Object()->molecule->numAtoms ) {
00973 NAMD_die("Incorrect atom count in WorkDistrib::assignNodeToPatch\n");
00974 }
00975
00976 delete [] nAtoms;
00977
00978 // PatchMap::Object()->printPatchMap();
00979 }
|
|
|
Definition at line 139 of file WorkDistrib.C. References PatchMap::assignToPatch(), PDB::get_position_for_atom(), PatchMap::getTmpPatchAtomsList(), Molecule::hydrogenGroup, SimParameters::lattice, Node::molecule, PDB::num_atoms(), PatchMap::numPatches(), PatchMap::Object(), Node::pdb, Position, Node::simParameters, and SimParameters::splitPatch. Referenced by preCreateHomePatches(). 00139 {
00140 StringList *current;
00141 int i;
00142 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00143 Node *node = nd.ckLocalBranch();
00144 PatchMap *patchMap = PatchMap::Object();
00145 CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
00146 PatchMgr *patchMgr = pm.ckLocalBranch();
00147 SimParameters *params = node->simParameters;
00148 Molecule *molecule = node->molecule;
00149 PDB *pdb = node->pdb;
00150
00151 int numPatches = patchMap->numPatches();
00152 int numAtoms = pdb->num_atoms();
00153
00154 vector<int> *eachPatchAtomList = patchMap->getTmpPatchAtomsList();
00155
00156 int *patchAtomCnt = new int[numPatches];
00157 memset(patchAtomCnt, 0, sizeof(int)*numPatches);
00158
00159 const Lattice lattice = params->lattice;
00160
00161 Position eachAtomPos;
00162 if (params->splitPatch == SPLIT_PATCH_HYDROGEN)
00163 {
00164 // split atoms into patched based on helix-group and position
00165 int aid, pid=0;
00166 for(i=0; i < numAtoms; i++)
00167 {
00168 // Assign atoms to patches without splitting hydrogen groups.
00169 // We know that the hydrogenGroup array is sorted with group parents
00170 // listed first. Thus, only change the pid if an atom is a group parent.
00171 aid = molecule->hydrogenGroup[i].atomID;
00172 pdb->get_position_for_atom(&eachAtomPos, aid);
00173 if (molecule->hydrogenGroup[i].isGP)
00174 pid = patchMap->assignToPatch(eachAtomPos,lattice);
00175 // else: don't change pid
00176 patchAtomCnt[pid]++;
00177 eachPatchAtomList[pid].push_back(aid);
00178 }
00179 }
00180 else
00181 {
00182 // split atoms into patched based on position
00183 for(i=0; i < numAtoms; i++)
00184 {
00185 pdb->get_position_for_atom(&eachAtomPos, i);
00186 int pid = patchMap->assignToPatch(eachAtomPos,lattice);
00187 patchAtomCnt[pid]++;
00188 eachPatchAtomList[pid].push_back(i);
00189 }
00190 }
00191
00192 return patchAtomCnt;
00193 }
|
|
|
Definition at line 198 of file WorkDistrib.C. References ResizeArray< Elem >::add(), SimParameters::alchFepOn, SimParameters::alchThermIntOn, Lattice::apply_transform(), PatchMap::assignToPatch(), Molecule::atomcharge(), CompAtomExt::atomFixed, Molecule::atommass(), Molecule::atomvdwtype(), ResizeArray< Elem >::begin(), Bool, CompAtom::charge, SimParameters::comMove, Node::configList, StringList::data, DebugM, ConfigList::find(), FullAtom::fixedPosition, FullAtomList, PDB::get_all_positions(), Molecule::get_fep_type(), Molecule::get_groupSize(), CompAtomExt::groupFixed, Molecule::hydrogenGroup, CompAtom::hydrogenGroupSize, CompAtomExt::id, SimParameters::initialTemp, iout, Molecule::is_atom_fixed(), Molecule::is_hydrogenGroupParent(), j, SimParameters::lattice, SimParameters::lesOn, FullAtom::mass, PatchMap::max_a(), PatchMap::max_b(), PatchMap::max_c(), PatchMap::min_a(), PatchMap::min_b(), PatchMap::min_c(), Node::molecule, NAMD_bug(), Lattice::nearest(), CompAtom::nonbondedGroupSize, PDB::num_atoms(), PatchMap::numPatches(), PatchMap::Object(), SimParameters::outputPatchDetails, SimParameters::pairInteractionOn, CompAtom::partition, Node::pdb, CompAtom::position, Position, SimParameters::pressureProfileAtomTypes, ScaledPosition, Node::simParameters, ResizeArray< Elem >::size(), SimParameters::splitPatch, FullAtom::transform, CompAtom::vdwType, FullAtom::velocity, and Velocity. Referenced by createHomePatches(), and reinitAtoms(). 00199 {
00200 int i;
00201 StringList *current; // Pointer used to retrieve configuration items
00202 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00203 Node *node = nd.ckLocalBranch();
00204 PatchMap *patchMap = PatchMap::Object();
00205 CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
00206 PatchMgr *patchMgr = pm.ckLocalBranch();
00207 SimParameters *params = node->simParameters;
00208 Molecule *molecule = node->molecule;
00209 PDB *pdb = node->pdb;
00210
00211 int numPatches = patchMap->numPatches();
00212 int numAtoms = pdb->num_atoms();
00213
00214 Vector *positions = new Position[numAtoms];
00215 pdb->get_all_positions(positions);
00216
00217 Vector *velocities = new Velocity[numAtoms];
00218
00219 if ( params->initialTemp < 0.0 ) {
00220 Bool binvels=FALSE;
00221
00222 // Reading the veolcities from a PDB
00223 current = node->configList->find("velocities");
00224
00225 if (current == NULL) {
00226 current = node->configList->find("binvelocities");
00227 binvels = TRUE;
00228 }
00229
00230 if (!binvels) {
00231 velocities_from_PDB(current->data, velocities, numAtoms);
00232 }
00233 else {
00234 velocities_from_binfile(current->data, velocities, numAtoms);
00235 }
00236 }
00237 else {
00238 // Random velocities for a given temperature
00239 random_velocities(params->initialTemp, molecule, velocities, numAtoms);
00240 }
00241
00242 // If COMMotion == no, remove center of mass motion
00243 if (!(params->comMove)) {
00244 remove_com_motion(velocities, molecule, numAtoms);
00245 }
00246
00247 FullAtomList *atoms = new FullAtomList[numPatches];
00248
00249 const Lattice lattice = params->lattice;
00250
00251 if (params->splitPatch == SPLIT_PATCH_HYDROGEN)
00252 {
00253 // split atoms into patched based on helix-group and position
00254 int aid, pid=0;
00255 for(i=0; i < numAtoms; i++)
00256 {
00257 if ( ! ( i % 1000 ) )
00258 {
00259 DebugM(3,"Assigned " << i << " atoms to patches so far.\n");
00260 }
00261 // Assign atoms to patches without splitting hydrogen groups.
00262 // We know that the hydrogenGroup array is sorted with group parents
00263 // listed first. Thus, only change the pid if an atom is a group parent.
00264 aid = molecule->hydrogenGroup[i].atomID;
00265 if (molecule->hydrogenGroup[i].isGP)
00266 pid = patchMap->assignToPatch(positions[aid],lattice);
00267 // else: don't change pid
00268 FullAtom a;
00269 a.id = aid;
00270 a.position = positions[aid];
00271 a.velocity = velocities[aid];
00272 #ifdef MEM_OPT_VERSION
00273 a.sigId = molecule->getAtomSigId(aid);
00274 a.exclId = molecule->getAtomExclSigId(aid);
00275 #endif
00276 a.vdwType = molecule->atomvdwtype(aid);
00277 atoms[pid].add(a);
00278 }
00279 }
00280 else
00281 {
00282 // split atoms into patched based on position
00283 for(i=0; i < numAtoms; i++)
00284 {
00285 if ( ! ( i % 1000 ) )
00286 {
00287 DebugM(3,"Assigned " << i << " atoms to patches so far.\n");
00288 }
00289 int pid = patchMap->assignToPatch(positions[i],lattice);
00290 FullAtom a;
00291 a.id = i;
00292 a.position = positions[i];
00293 a.velocity = velocities[i];
00294 #ifdef MEM_OPT_VERSION
00295 a.sigId = molecule->getAtomSigId(i);
00296 a.exclId = molecule->getAtomExclSigId(i);
00297 #endif
00298 a.vdwType = molecule->atomvdwtype(i);
00299 atoms[pid].add(a);
00300 }
00301 }
00302
00303 delete [] positions;
00304 delete [] velocities;
00305
00306 for(i=0; i < numPatches; i++)
00307 {
00308 ScaledPosition center(0.5*(patchMap->min_a(i)+patchMap->max_a(i)),
00309 0.5*(patchMap->min_b(i)+patchMap->max_b(i)),
00310 0.5*(patchMap->min_c(i)+patchMap->max_c(i)));
00311
00312 int n = atoms[i].size();
00313 FullAtom *a = atoms[i].begin();
00314 int j;
00315 //Modifications for alchemical fep
00316 Bool alchFepOn = params->alchFepOn;
00317 Bool alchThermIntOn = params->alchThermIntOn;
00318 //fepe
00319 Bool lesOn = params->lesOn;
00320
00321 Bool pairInteractionOn = params->pairInteractionOn;
00322
00323 Bool pressureProfileTypes = (params->pressureProfileAtomTypes > 1);
00324
00325 Transform mother_transform;
00326 for(j=0; j < n; j++)
00327 {
00328 int aid = a[j].id;
00329
00330 if (params->splitPatch == SPLIT_PATCH_HYDROGEN) {
00331 if ( molecule->is_hydrogenGroupParent(aid) ) {
00332 a[j].hydrogenGroupSize = molecule->get_groupSize(aid);
00333 } else {
00334 a[j].hydrogenGroupSize = 0;
00335 }
00336 } else {
00337 a[j].hydrogenGroupSize = 1;
00338 }
00339
00340 a[j].nonbondedGroupSize = 0; // must be set based on coordinates
00341
00342 a[j].atomFixed = molecule->is_atom_fixed(aid) ? 1 : 0;
00343 a[j].fixedPosition = a[j].position;
00344
00345 if ( a[j].hydrogenGroupSize ) {
00346 a[j].position = lattice.nearest(
00347 a[j].position, center, &(a[j].transform));
00348 mother_transform = a[j].transform;
00349 } else {
00350 a[j].position = lattice.apply_transform(a[j].position,mother_transform);
00351 a[j].transform = mother_transform;
00352 }
00353
00354 a[j].mass = molecule->atommass(aid);
00355 a[j].charge = molecule->atomcharge(aid);
00356
00357 //Modifications for alchemical fep
00358 if ( alchFepOn || alchThermIntOn || lesOn || pairInteractionOn || pressureProfileTypes) {
00359 a[j].partition = molecule->get_fep_type(aid);
00360 }
00361 else {
00362 a[j].partition = 0;
00363 }
00364 //fepe
00365
00366 }
00367
00368 int size, allfixed, k;
00369 for(j=0; j < n; j+=size) {
00370 size = a[j].hydrogenGroupSize;
00371 if ( ! size ) {
00372 NAMD_bug("Mother atom with hydrogenGroupSize of 0!");
00373 }
00374 allfixed = 1;
00375 for ( k = 0; k < size; ++k ) {
00376 allfixed = ( allfixed && (a[j+k].atomFixed) );
00377 }
00378 for ( k = 0; k < size; ++k ) {
00379 a[j+k].groupFixed = allfixed ? 1 : 0;
00380 }
00381 }
00382
00383 if ( params->outputPatchDetails ) {
00384 int patchId = i;
00385 int numAtomsInPatch = n;
00386 int numFixedAtomsInPatch = 0;
00387 int numAtomsInFixedGroupsInPatch = 0;
00388 for(j=0; j < n; j++) {
00389 numFixedAtomsInPatch += ( a[j].atomFixed ? 1 : 0 );
00390 numAtomsInFixedGroupsInPatch += ( a[j].groupFixed ? 1 : 0 );
00391 }
00392 iout << "PATCH_DETAILS:"
00393 << " patch " << patchId
00394 << " atoms " << numAtomsInPatch
00395 << " fixed_atoms " << numFixedAtomsInPatch
00396 << " fixed_groups " << numAtomsInFixedGroupsInPatch
00397 << "\n" << endi;
00398 }
00399 }
00400
00401 return atoms;
00402
00403 }
|
|
|
Definition at line 447 of file WorkDistrib.C. References createAtomLists(), PatchMgr::createHomePatch(), DebugM, FullAtomList, iINFO(), iout, PatchMap::numPatches(), PatchMap::Object(), and ResizeArray< Elem >::size(). Referenced by Node::startup(). 00448 {
00449 int i;
00450 PatchMap *patchMap = PatchMap::Object();
00451 CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
00452 PatchMgr *patchMgr = pm.ckLocalBranch();
00453
00454 int numPatches = patchMap->numPatches();
00455
00456 FullAtomList *atoms = createAtomLists();
00457
00458 #ifdef MEM_OPT_VERSION
00459 /* CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00460 Node *node = nd.ckLocalBranch();
00461 node->molecule->delEachAtomSigs();
00462 node->molecule->delMassChargeSpace();
00463 */
00464 #endif
00465
00466 int maxAtoms = -1;
00467 int maxPatch = -1;
00468 for(i=0; i < numPatches; i++) {
00469 int numAtoms = atoms[i].size();
00470 if ( numAtoms > maxAtoms ) { maxAtoms = numAtoms; maxPatch = i; }
00471 }
00472 iout << iINFO << "LARGEST PATCH (" << maxPatch <<
00473 ") HAS " << maxAtoms << " ATOMS\n" << endi;
00474
00475 for(i=0; i < numPatches; i++)
00476 {
00477 if ( ! ( i % 100 ) )
00478 {
00479 DebugM(3,"Created " << i << " patches so far.\n");
00480 }
00481
00482 patchMgr->createHomePatch(i,atoms[i]);
00483 }
00484
00485 delete [] atoms;
00486 }
|
|
|
Definition at line 689 of file WorkDistrib.C. References DebugM, PatchMgr::movePatch(), Node::myid(), PatchMap::node(), PatchMap::numPatches(), PatchMap::Object(), and PatchMgr::sendMovePatches(). Referenced by Node::startup(). 00689 {
00690 // ref BOC
00691 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00692 Node *node = nd.ckLocalBranch();
00693 CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
00694 PatchMgr *patchMgr = pm.ckLocalBranch();
00695 // ref singleton
00696 PatchMap *patchMap = PatchMap::Object();
00697
00698 // Move patches to the proper node
00699 for(int i=0;i < patchMap->numPatches(); i++)
00700 {
00701 if (patchMap->node(i) != node->myid() )
00702 {
00703 DebugM(3,"patchMgr->movePatch("
00704 << i << "," << patchMap->node(i) << ")\n");
00705 patchMgr->movePatch(i,patchMap->node(i));
00706 }
00707 }
00708 patchMgr->sendMovePatches();
00709 }
|
|
|
Definition at line 131 of file WorkDistrib.C. 00131 {
00132 if (!--saveComputeMapCount) {
00133 CkSendMsgBranch(saveComputeMapReturnEP, CkAllocMsg(0,0,0), 0, saveComputeMapReturnChareID);
00134 }
00135 }
|
|
|
Definition at line 1717 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01717 {
01718 msg->compute->doWork();
01719 if ( msg->compute->localWorkMsg != msg )
01720 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01721 }
|
|
|
Definition at line 1711 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01711 {
01712 msg->compute->doWork();
01713 if ( msg->compute->localWorkMsg != msg )
01714 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01715 }
|
|
|
Definition at line 1735 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01735 {
01736 msg->compute->doWork();
01737 if ( msg->compute->localWorkMsg != msg )
01738 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01739 }
|
|
|
Definition at line 1777 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01777 {
01778 msg->compute->doWork();
01779 if ( msg->compute->localWorkMsg != msg )
01780 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01781 }
|
|
|
Definition at line 1723 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01723 {
01724 msg->compute->doWork();
01725 if ( msg->compute->localWorkMsg != msg )
01726 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01727 }
|
|
|
Definition at line 1705 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01705 {
01706 msg->compute->doWork();
01707 if ( msg->compute->localWorkMsg != msg )
01708 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01709 }
|
|
|
Definition at line 1729 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01729 {
01730 msg->compute->doWork();
01731 if ( msg->compute->localWorkMsg != msg )
01732 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01733 }
|
|
|
Definition at line 1741 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01741 {
01742 msg->compute->doWork();
01743 if ( msg->compute->localWorkMsg != msg )
01744 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01745 }
|
|
|
Definition at line 1747 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01747 {
01748 msg->compute->doWork();
01749 if ( msg->compute->localWorkMsg != msg )
01750 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01751 }
|
|
|
Definition at line 1753 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01753 {
01754 msg->compute->doWork();
01755 if ( msg->compute->localWorkMsg != msg )
01756 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01757 }
|
|
|
Definition at line 1699 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01699 {
01700 msg->compute->doWork();
01701 if ( msg->compute->localWorkMsg != msg )
01702 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01703 }
|
|
|
Definition at line 1759 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01759 {
01760 msg->compute->doWork();
01761 if ( msg->compute->localWorkMsg != msg )
01762 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01763 }
|
|
|
Definition at line 1765 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01765 {
01766 msg->compute->doWork();
01767 if ( msg->compute->localWorkMsg != msg )
01768 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01769 }
|
|
|
Definition at line 1771 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 01771 {
01772 msg->compute->doWork();
01773 if ( msg->compute->localWorkMsg != msg )
01774 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
01775 }
|
|
||||||||||||||||
|
Definition at line 488 of file WorkDistrib.C. References ResizeArray< Elem >::add(), SimParameters::alchFepOn, SimParameters::alchThermIntOn, Lattice::apply_transform(), Molecule::atomcharge(), CompAtomExt::atomFixed, Molecule::atommass(), Molecule::atomvdwtype(), ResizeArray< Elem >::begin(), Bool, CompAtom::charge, SimParameters::fixedAtomsOn, FullAtom::fixedPosition, FullAtomList, Molecule::get_fep_type(), Molecule::get_groupSize(), PDB::get_position_for_atom(), PatchMap::getTmpPatchAtomsList(), CompAtomExt::groupFixed, CompAtom::hydrogenGroupSize, CompAtomExt::id, iout, Molecule::is_atom_fixed(), Molecule::is_hydrogenGroupParent(), j, SimParameters::lattice, SimParameters::lesOn, FullAtom::mass, PatchMap::max_a(), PatchMap::max_b(), PatchMap::max_c(), PatchMap::min_a(), PatchMap::min_b(), PatchMap::min_c(), Node::molecule, NAMD_bug(), Lattice::nearest(), CompAtom::nonbondedGroupSize, PatchMap::Object(), SimParameters::outputPatchDetails, SimParameters::pairInteractionOn, CompAtom::partition, Node::pdb, CompAtom::position, Position, SimParameters::pressureProfileAtomTypes, ScaledPosition, PatchMgr::setHomePatchFixedAtomNum(), Node::simParameters, ResizeArray< Elem >::size(), SimParameters::splitPatch, FullAtom::transform, CompAtom::vdwType, and FullAtom::velocity. Referenced by initAndSendHomePatch(). 00488 {
00489 // ref BOC
00490 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00491 Node *node = nd.ckLocalBranch();
00492 PDB *pdb = node->pdb;
00493 SimParameters *params = node->simParameters;
00494 Molecule *molecule = node->molecule;
00495
00496 const Lattice lattice = params->lattice;
00497
00498 CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
00499 PatchMgr *patchMgr = pm.ckLocalBranch();
00500 // ref singleton
00501 PatchMap *patchMap = PatchMap::Object();
00502
00503 vector<int> *eachPatchAtomsList = patchMap->getTmpPatchAtomsList();
00504 vector<int> *thisPatchAtomsList = &eachPatchAtomsList[patchId];
00505
00506 for(int i=0; i<thisPatchAtomsList->size(); i++){
00507 int aid = thisPatchAtomsList->at(i);
00508 FullAtom a;
00509 a.id = aid;
00510 Position pos;
00511 pdb->get_position_for_atom(&pos, aid);
00512 a.position = pos;
00513 a.velocity = velocities[aid];
00514 #ifdef MEM_OPT_VERSION
00515 a.sigId = molecule->getAtomSigId(aid);
00516 a.exclId = molecule->getAtomExclSigId(aid);
00517 #endif
00518 a.vdwType = molecule->atomvdwtype(aid);
00519 onePatchAtoms->add(a);
00520 }
00521
00522 ScaledPosition center(0.5*(patchMap->min_a(patchId)+patchMap->max_a(patchId)),
00523 0.5*(patchMap->min_b(patchId)+patchMap->max_b(patchId)),
00524 0.5*(patchMap->min_c(patchId)+patchMap->max_c(patchId)));
00525 int n = onePatchAtoms->size();
00526 FullAtom *a = onePatchAtoms->begin();
00527 int j;
00528 //Modifications for alchemical fep
00529 Bool alchFepOn = params->alchFepOn;
00530 Bool alchThermIntOn = params->alchThermIntOn;
00531 //fepe
00532 Bool lesOn = params->lesOn;
00533
00534 Bool pairInteractionOn = params->pairInteractionOn;
00535
00536 Bool pressureProfileTypes = (params->pressureProfileAtomTypes > 1);
00537
00538 Transform mother_transform;
00539 for(j=0; j < n; j++)
00540 {
00541 int aid = a[j].id;
00542
00543 if (params->splitPatch == SPLIT_PATCH_HYDROGEN) {
00544 if ( molecule->is_hydrogenGroupParent(aid) ) {
00545 a[j].hydrogenGroupSize = molecule->get_groupSize(aid);
00546 } else {
00547 a[j].hydrogenGroupSize = 0;
00548 }
00549 } else {
00550 a[j].hydrogenGroupSize = 1;
00551 }
00552
00553 a[j].nonbondedGroupSize = 0; // must be set based on coordinates
00554
00555 a[j].atomFixed = molecule->is_atom_fixed(aid) ? 1 : 0;
00556 a[j].fixedPosition = a[j].position;
00557
00558 if ( a[j].hydrogenGroupSize ) {
00559 a[j].position = lattice.nearest(
00560 a[j].position, center, &(a[j].transform));
00561 mother_transform = a[j].transform;
00562 } else {
00563 a[j].position = lattice.apply_transform(a[j].position,mother_transform);
00564 a[j].transform = mother_transform;
00565 }
00566
00567 a[j].mass = molecule->atommass(aid);
00568 a[j].charge = molecule->atomcharge(aid);
00569
00570 //Modifications for alchemical fep
00571 if ( alchFepOn || alchThermIntOn || lesOn || pairInteractionOn || pressureProfileTypes) {
00572 a[j].partition = molecule->get_fep_type(aid);
00573 }
00574 else {
00575 a[j].partition = 0;
00576 }
00577 //fepe
00578 }
00579
00580 int size, allfixed, k;
00581 for(j=0; j < n; j+=size) {
00582 size = a[j].hydrogenGroupSize;
00583 if ( ! size ) {
00584 NAMD_bug("Mother atom with hydrogenGroupSize of 0!");
00585 }
00586 allfixed = 1;
00587 for ( k = 0; k < size; ++k ) {
00588 allfixed = ( allfixed && (a[j+k].atomFixed) );
00589 }
00590 for ( k = 0; k < size; ++k ) {
00591 a[j+k].groupFixed = allfixed ? 1 : 0;
00592 }
00593 }
00594
00595 if(params->fixedAtomsOn){
00596 int fixedCnt=0;
00597 for(j=0; j<n; j++)
00598 fixedCnt += (a[j].atomFixed ? 1:0);
00599 patchMgr->setHomePatchFixedAtomNum(patchId, fixedCnt);
00600 }
00601
00602 if ( params->outputPatchDetails ) {
00603 int numAtomsInPatch = n;
00604 int numFixedAtomsInPatch = 0;
00605 int numAtomsInFixedGroupsInPatch = 0;
00606 for(j=0; j < n; j++) {
00607 numFixedAtomsInPatch += ( a[j].atomFixed ? 1 : 0 );
00608 numAtomsInFixedGroupsInPatch += ( a[j].groupFixed ? 1 : 0 );
00609 }
00610 iout << "PATCH_DETAILS:"
00611 << " patch " << patchId
00612 << " atoms " << numAtomsInPatch
00613 << " fixed_atoms " << numFixedAtomsInPatch
00614 << " fixed_groups " << numAtomsInFixedGroupsInPatch
00615 << "\n" << endi;
00616 }
00617 }
|
|
|
Definition at line 620 of file WorkDistrib.C. References Bool, SimParameters::comMove, Node::configList, StringList::data, PatchMap::delTmpPatchAtomsList(), PatchMgr::fillHomePatchAtomList(), fillOnePatchAtoms(), ConfigList::find(), FullAtomList, SimParameters::initialTemp, Node::molecule, Node::myid(), PatchMap::node(), PDB::num_atoms(), PatchMap::numPatches(), PatchMap::Object(), Node::pdb, PatchMgr::sendOneHomePatch(), Node::simParameters, and Velocity. Referenced by Node::startup(). 00620 {
00621 StringList *current;
00622 // ref BOC
00623 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00624 Node *node = nd.ckLocalBranch();
00625 Molecule *molecule = node->molecule;
00626 PDB *pdb = node->pdb;
00627 SimParameters *params = node->simParameters;
00628
00629 CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
00630 PatchMgr *patchMgr = pm.ckLocalBranch();
00631 // ref singleton
00632 PatchMap *patchMap = PatchMap::Object();
00633
00634 int numAtoms = pdb->num_atoms();
00635
00636 //1. create atoms' velocities
00637 Vector *velocities = new Velocity[numAtoms];
00638 if ( params->initialTemp < 0.0 ) {
00639 Bool binvels=FALSE;
00640
00641 // Reading the veolcities from a PDB
00642 current = node->configList->find("velocities");
00643
00644 if (current == NULL) {
00645 current = node->configList->find("binvelocities");
00646 binvels = TRUE;
00647 }
00648
00649 if (!binvels) {
00650 velocities_from_PDB(current->data, velocities, numAtoms);
00651 }
00652 else {
00653 velocities_from_binfile(current->data, velocities, numAtoms);
00654 }
00655 }
00656 else {
00657 // Random velocities for a given temperature
00658 random_velocities(params->initialTemp, molecule, velocities, numAtoms);
00659 }
00660
00661 // If COMMotion == no, remove center of mass motion
00662 if (!(params->comMove)) {
00663 remove_com_motion(velocities, molecule, numAtoms);
00664 }
00665
00666
00667 for(int i=0; i<patchMap->numPatches(); i++){
00668 //2. fill each patch with actual atom data
00669 //the work flow should looks like the createAtomList
00670 FullAtomList *onePatchAtoms = new FullAtomList;
00671 fillOnePatchAtoms(i, onePatchAtoms, velocities);
00672
00673 patchMgr->fillHomePatchAtomList(i, onePatchAtoms);
00674
00675 delete onePatchAtoms;
00676
00677 //distribute this home patch
00678 if(patchMap->node(i) != node->myid()){
00679 //need to move to other nodes
00680 patchMgr->sendOneHomePatch(i, patchMap->node(i));
00681 }
00682
00683 }
00684
00685 delete [] velocities;
00686 patchMap->delTmpPatchAtomsList();
00687 }
|
|
|
Definition at line 1300 of file WorkDistrib.C. References ComputeMap::allocateCids(), computeAnglesType, computeBondsType, computeConsForceType, computeConsTorqueType, computeCrosstermsType, computeCylindricalBCType, computeDihedralsType, computeEFieldType, computeEwaldType, computeExclsType, computeExtType, computeFullDirectType, computeGlobalType, computeGridForceType, computeImpropersType, computeNonbondedCUDAType, computePmeType, computeRestraintsType, computeSelfAnglesType, computeSelfBondsType, computeSelfCrosstermsType, computeSelfDihedralsType, computeSelfExclsType, computeSelfImpropersType, computeSphericalBCType, computeStirType, computeTclBCType, SimParameters::consForceOn, SimParameters::consTorqueOn, SimParameters::constraintsOn, SimParameters::cylindricalBCOn, DebugM, SimParameters::eFieldOn, SimParameters::extForcesOn, SimParameters::FMAOn, SimParameters::fullDirectOn, SimParameters::globalForcesOn, SimParameters::mgridforceOn, NAMD_die(), ComputeMap::Object(), PatchMap::Object(), optPmeType, SimParameters::pairInteractionOn, SimParameters::pairInteractionSelf, SimParameters::PMEOn, SimParameters::pressureProfileEwaldOn, Node::simParameters, SimParameters::sphericalBCOn, SimParameters::stirOn, SimParameters::tclBCOn, SimParameters::useDPME, and SimParameters::useOptPME. Referenced by Node::startup(). 01301 {
01302 PatchMap *patchMap = PatchMap::Object();
01303 ComputeMap *computeMap = ComputeMap::Object();
01304 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
01305 Node *node = nd.ckLocalBranch();
01306
01307 DebugM(3,"Mapping computes\n");
01308
01309 computeMap->allocateCids();
01310
01311 // Handle full electrostatics
01312 if ( node->simParameters->fullDirectOn )
01313 mapComputeHomePatches(computeFullDirectType);
01314 if ( node->simParameters->FMAOn )
01315 #ifdef DPMTA
01316 mapComputeHomePatches(computeDPMTAType);
01317 #else
01318 NAMD_die("This binary does not include DPMTA (FMA).");
01319 #endif
01320 if ( node->simParameters->PMEOn ) {
01321 #ifdef DPME
01322 if ( node->simParameters->useDPME )
01323 mapComputeHomePatches(computeDPMEType);
01324 else {
01325 if (node->simParameters->useOptPME) {
01326 mapComputeHomePatches(optPmeType);
01327 if ( node->simParameters->pressureProfileEwaldOn )
01328 mapComputeHomePatches(computeEwaldType);
01329 }
01330 else {
01331 mapComputeHomePatches(computePmeType);
01332 if ( node->simParameters->pressureProfileEwaldOn )
01333 mapComputeHomePatches(computeEwaldType);
01334 }
01335 }
01336 #else
01337 if (node->simParameters->useOptPME) {
01338 mapComputeHomePatches(optPmeType);
01339 if ( node->simParameters->pressureProfileEwaldOn )
01340 mapComputeHomePatches(computeEwaldType);
01341 }
01342 else {
01343 mapComputeHomePatches(computePmeType);
01344 if ( node->simParameters->pressureProfileEwaldOn )
01345 mapComputeHomePatches(computeEwaldType);
01346 }
01347 #endif
01348 }
01349
01350 if ( node->simParameters->globalForcesOn ) {
01351 DebugM(2,"adding ComputeGlobal\n");
01352 mapComputeHomePatches(computeGlobalType);
01353 }
01354
01355 if ( node->simParameters->extForcesOn )
01356 mapComputeHomePatches(computeExtType);
01357
01358 #ifdef NAMD_CUDA
01359 mapComputeNode(computeNonbondedCUDAType);
01360 mapComputeHomeTuples(computeExclsType);
01361 mapComputePatch(computeSelfExclsType);
01362 #endif
01363
01364 mapComputeNonbonded();
01365
01366 // If we're doing true pair interactions, no need for bonded terms.
01367 // But if we're doing within-group interactions, we do need them.
01368 if ( !node->simParameters->pairInteractionOn ||
01369 node->simParameters->pairInteractionSelf) {
01370 mapComputeHomeTuples(computeBondsType);
01371 mapComputeHomeTuples(computeAnglesType);
01372 mapComputeHomeTuples(computeDihedralsType);
01373 mapComputeHomeTuples(computeImpropersType);
01374 mapComputeHomeTuples(computeCrosstermsType);
01375 mapComputePatch(computeSelfBondsType);
01376 mapComputePatch(computeSelfAnglesType);
01377 mapComputePatch(computeSelfDihedralsType);
01378 mapComputePatch(computeSelfImpropersType);
01379 mapComputePatch(computeSelfCrosstermsType);
01380 }
01381
01382
01383 if ( node->simParameters->eFieldOn )
01384 mapComputePatch(computeEFieldType);
01385 /* BEGIN gf */
01386 if ( node->simParameters->mgridforceOn )
01387 mapComputeHomePatches(computeGridForceType);
01388 /* END gf */
01389 if ( node->simParameters->stirOn )
01390 mapComputePatch(computeStirType);
01391 if ( node->simParameters->sphericalBCOn )
01392 mapComputePatch(computeSphericalBCType);
01393 if ( node->simParameters->cylindricalBCOn )
01394 mapComputePatch(computeCylindricalBCType);
01395 if ( node->simParameters->tclBCOn ) {
01396 mapComputeHomePatches(computeTclBCType);
01397 }
01398 if ( node->simParameters->constraintsOn )
01399 mapComputePatch(computeRestraintsType);
01400 if ( node->simParameters->consForceOn )
01401 mapComputePatch(computeConsForceType);
01402 if ( node->simParameters->consTorqueOn )
01403 mapComputePatch(computeConsTorqueType);
01404 }
|
|
|
Definition at line 1604 of file WorkDistrib.C. References LocalWorkMsg::compute, computeAnglesType, computeBondsType, computeCrosstermsType, computeDihedralsType, computeExclsType, computeImpropersType, computeNonbondedCUDAType, computeNonbondedPairType, computeNonbondedSelfType, computePmeType, computeSelfAnglesType, computeSelfBondsType, computeSelfCrosstermsType, computeSelfDihedralsType, computeSelfExclsType, computeSelfImpropersType, Compute::doWork(), Compute::enqueueWork(), Compute::localWorkMsg, NAMD_bug(), optPmeType, Compute::priority(), Compute::sequence(), SET_PRIORITY, and Compute::type(). Referenced by cuda_check_local_progress(), cuda_check_remote_progress(), and Compute::enqueueWork(). 01604 {
01605 LocalWorkMsg *msg = compute->localWorkMsg;
01606 int seq = compute->sequence();
01607
01608 if ( seq < 0 ) {
01609 NAMD_bug("compute->sequence() < 0 in WorkDistrib::messageEnqueueWork");
01610 } else {
01611 SET_PRIORITY(msg,seq,compute->priority());
01612 }
01613
01614 msg->compute = compute; // pointer is valid since send is to local Pe
01615 int type = compute->type();
01616
01617 CProxy_WorkDistrib wdProxy(CkpvAccess(BOCclass_group).workDistrib);
01618 switch ( type ) {
01619 case computeExclsType:
01620 case computeSelfExclsType:
01621 wdProxy[CkMyPe()].enqueueExcls(msg);
01622 break;
01623 case computeBondsType:
01624 case computeSelfBondsType:
01625 wdProxy[CkMyPe()].enqueueBonds(msg);
01626 break;
01627 case computeAnglesType:
01628 case computeSelfAnglesType:
01629 wdProxy[CkMyPe()].enqueueAngles(msg);
01630 break;
01631 case computeDihedralsType:
01632 case computeSelfDihedralsType:
01633 wdProxy[CkMyPe()].enqueueDihedrals(msg);
01634 break;
01635 case computeImpropersType:
01636 case computeSelfImpropersType:
01637 wdProxy[CkMyPe()].enqueueImpropers(msg);
01638 break;
01639 case computeCrosstermsType:
01640 case computeSelfCrosstermsType:
01641 wdProxy[CkMyPe()].enqueueCrossterms(msg);
01642 break;
01643 case computeNonbondedSelfType:
01644 switch ( seq % 2 ) {
01645 case 0:
01646 wdProxy[CkMyPe()].enqueueSelfA(msg);
01647 break;
01648 case 1:
01649 wdProxy[CkMyPe()].enqueueSelfB(msg);
01650 break;
01651 default:
01652 NAMD_bug("WorkDistrib::messageEnqueueSelf case statement error!");
01653 }
01654 break;
01655 case computeNonbondedPairType:
01656 switch ( seq % 2 ) {
01657 case 0:
01658 wdProxy[CkMyPe()].enqueueWorkA(msg);
01659 break;
01660 case 1:
01661 wdProxy[CkMyPe()].enqueueWorkB(msg);
01662 break;
01663 case 2:
01664 wdProxy[CkMyPe()].enqueueWorkC(msg);
01665 break;
01666 default:
01667 NAMD_bug("WorkDistrib::messageEnqueueWork case statement error!");
01668 }
01669 break;
01670 case computeNonbondedCUDAType:
01671 #ifdef NAMD_CUDA
01672 // CkPrintf("CUDA %d %d %x\n", CkMyPe(), seq, compute->priority());
01673 wdProxy[CkMyPe()].enqueueCUDA(msg);
01674 #else
01675 msg->compute->doWork();
01676 #endif
01677 break;
01678 case computePmeType:
01679 // CkPrintf("PME %d %d %x\n", CkMyPe(), seq, compute->priority());
01680 #ifdef NAMD_CUDA
01681 wdProxy[CkMyPe()].enqueuePme(msg);
01682 #else
01683 msg->compute->doWork();
01684 #endif
01685 break;
01686 case optPmeType:
01687 // CkPrintf("PME %d %d %x\n", CkMyPe(), seq, compute->priority());
01688 #ifdef NAMD_CUDA
01689 wdProxy[CkMyPe()].enqueuePme(msg);
01690 #else
01691 msg->compute->doWork();
01692 #endif
01693 break;
01694 default:
01695 wdProxy[CkMyPe()].enqueueWork(msg);
01696 }
01697 }
|
|
|
Definition at line 812 of file WorkDistrib.C. References Lattice::a_p(), Lattice::a_r(), Lattice::b_p(), Lattice::b_r(), BigReal, Lattice::c_p(), Lattice::c_r(), DebugM, PDB::find_extremes(), SimParameters::FMAOn, SimParameters::lattice, PatchMap::makePatches(), SimParameters::minAtomsPerPatch, NAMD_die(), PDB::num_atoms(), PatchMap::Object(), Lattice::origin(), SimParameters::patchDimension, Node::pdb, ScaledPosition, Node::simParameters, PatchMap::sizeGrid(), SimParameters::twoAwayX, SimParameters::twoAwayY, SimParameters::twoAwayZ, Vector::x, Vector::y, and Vector::z. Referenced by Node::startup(). 00813 {
00814 PatchMap *patchMap = PatchMap::Object();
00815 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00816 Node *node = nd.ckLocalBranch();
00817 SimParameters *params = node->simParameters;
00818 Lattice lattice = params->lattice;
00819
00820 BigReal patchSize = params->patchDimension;
00821
00822 ScaledPosition xmin, xmax;
00823
00824 double maxNumPatches = 1000000; // need to adjust fractional values
00825 if ( params->minAtomsPerPatch > 0 )
00826 maxNumPatches = node->pdb->num_atoms() / params->minAtomsPerPatch;
00827
00828 DebugM(3,"Mapping patches\n");
00829 if ( lattice.a_p() && lattice.b_p() && lattice.c_p() ) {
00830 xmin = 0.; xmax = 0.;
00831 } else {
00832 // Need to use full box for FMA to match NAMD 1.X results.
00833 if ( params->FMAOn ) {
00834 node->pdb->find_extremes(&(xmin.x),&(xmax.x),lattice.a_r());
00835 node->pdb->find_extremes(&(xmin.y),&(xmax.y),lattice.b_r());
00836 node->pdb->find_extremes(&(xmin.z),&(xmax.z),lattice.c_r());
00837 // Otherwise, this allows a small number of stray atoms.
00838 } else {
00839 node->pdb->find_extremes(&(xmin.x),&(xmax.x),lattice.a_r(),0.9);
00840 node->pdb->find_extremes(&(xmin.y),&(xmax.y),lattice.b_r(),0.9);
00841 node->pdb->find_extremes(&(xmin.z),&(xmax.z),lattice.c_r(),0.9);
00842 }
00843 }
00844
00845 BigReal origin_shift;
00846 origin_shift = lattice.a_r() * lattice.origin();
00847 xmin.x -= origin_shift;
00848 xmax.x -= origin_shift;
00849 origin_shift = lattice.b_r() * lattice.origin();
00850 xmin.y -= origin_shift;
00851 xmax.y -= origin_shift;
00852 origin_shift = lattice.c_r() * lattice.origin();
00853 xmin.z -= origin_shift;
00854 xmax.z -= origin_shift;
00855
00856 // SimParameters default is -1 for unset
00857 int twoAwayX = params->twoAwayX;
00858 int twoAwayY = params->twoAwayY;
00859 int twoAwayZ = params->twoAwayZ;
00860
00861 #ifdef NAMD_CUDA
00862 // for CUDA be sure there are more patches than pes
00863
00864 int numPatches = patchMap->sizeGrid(
00865 xmin,xmax,lattice,patchSize,maxNumPatches,
00866 twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
00867 if ( numPatches < CkNumPes() && twoAwayX < 0 ) {
00868 twoAwayX = 1;
00869 numPatches = patchMap->sizeGrid(
00870 xmin,xmax,lattice,patchSize,maxNumPatches,
00871 twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
00872 }
00873 if ( numPatches < CkNumPes() && twoAwayY < 0 ) {
00874 twoAwayY = 1;
00875 numPatches = patchMap->sizeGrid(
00876 xmin,xmax,lattice,patchSize,maxNumPatches,
00877 twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
00878 }
00879 if ( numPatches < CkNumPes() && twoAwayZ < 0 ) {
00880 twoAwayZ = 1;
00881 numPatches = patchMap->sizeGrid(
00882 xmin,xmax,lattice,patchSize,maxNumPatches,
00883 twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
00884 }
00885 if ( numPatches < CkNumPes() ) {
00886 NAMD_die("CUDA-enabled NAMD requires more patches than processes.");
00887 }
00888
00889 patchMap->makePatches(xmin,xmax,lattice,patchSize,maxNumPatches,
00890 twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
00891
00892 #else
00893
00894 int numPatches = patchMap->sizeGrid(
00895 xmin,xmax,lattice,patchSize,maxNumPatches,
00896 twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
00897 if ( numPatches > (CkNumPes() - 1) && twoAwayZ < 0 ) {
00898 twoAwayZ = 0;
00899 numPatches = patchMap->sizeGrid(
00900 xmin,xmax,lattice,patchSize,maxNumPatches,
00901 twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
00902 }
00903 if ( numPatches > (CkNumPes() - 1) && twoAwayY < 0 ) {
00904 twoAwayY = 0;
00905 numPatches = patchMap->sizeGrid(
00906 xmin,xmax,lattice,patchSize,maxNumPatches,
00907 twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
00908 }
00909 if ( numPatches > (CkNumPes() - 1) && twoAwayX < 0 ) {
00910 twoAwayX = 0;
00911 numPatches = patchMap->sizeGrid(
00912 xmin,xmax,lattice,patchSize,maxNumPatches,
00913 twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
00914 }
00915
00916 patchMap->makePatches(xmin,xmax,lattice,patchSize,maxNumPatches,
00917 twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
00918
00919 #endif
00920
00921 }
|
|
|
Definition at line 409 of file WorkDistrib.C. References caclNumAtomsInEachPatch(), DebugM, iINFO(), PatchMap::initTmpPatchAtomsList(), iout, PatchMap::numPatches(), PatchMap::Object(), and PatchMgr::preCreateHomePatch(). Referenced by Node::startup(). 00409 {
00410
00411 PatchMap *patchMap = PatchMap::Object();
00412 CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
00413 PatchMgr *patchMgr = pm.ckLocalBranch();
00414
00415 int numPatches = patchMap->numPatches();
00416
00417 patchMap->initTmpPatchAtomsList();
00418
00419 int *patchAtomCnt = caclNumAtomsInEachPatch();
00420
00421 int maxAtoms = -1;
00422 int maxPatch = -1;
00423 for(int i=0; i < numPatches; i++) {
00424 int numAtoms = patchAtomCnt[i];
00425 if ( numAtoms > maxAtoms ) { maxAtoms = numAtoms; maxPatch = i; }
00426 }
00427 iout << iINFO << "LARGEST PATCH (" << maxPatch <<
00428 ") HAS " << maxAtoms << " ATOMS\n" << endi;
00429
00430 for(int i=0; i < numPatches; i++)
00431 {
00432 if ( ! ( i % 100 ) )
00433 {
00434 DebugM(3,"Pre-created " << i << " patches so far.\n");
00435 }
00436
00437 patchMgr->preCreateHomePatch(i,patchAtomCnt[i]);
00438 }
00439
00440 delete [] patchAtomCnt;
00441 }
|
|
|
Definition at line 112 of file WorkDistrib.C. References DebugM, ComputeMap::newNode(), ComputeMapChangeMsg::newNodes, ComputeMap::node(), ComputeMap::numComputes(), ComputeMap::Object(), ComputeMap::setNewNode(), and ComputeMap::type(). 00112 {
00113
00114 ComputeMap *computeMap = ComputeMap::Object();
00115 int i;
00116 for(i=0; i<computeMap->numComputes(); i++)
00117 computeMap->setNewNode(i,msg->newNodes[i]);
00118
00119 delete msg;
00120
00121 CProxy_WorkDistrib workProxy(thisgroup);
00122 workProxy[0].doneSaveComputeMap();
00123
00124 DebugM(2, "ComputeMap after send!\n");
00125 for (i=0; i<computeMap->numComputes(); i++) {
00126 DebugM(2, "ComputeMap (" << i << ") node = " << computeMap->node(i) << " newNode = " << computeMap->newNode(i) << " type=" << computeMap->type(i) << "\n");
00127 }
00128 DebugM(2, "===================================================\n");
00129 }
|
|
|
Definition at line 711 of file WorkDistrib.C. References createAtomLists(), FullAtomList, PatchMap::numPatches(), PatchMap::Object(), and PatchMgr::sendAtoms(). 00711 {
00712
00713 PatchMap *patchMap = PatchMap::Object();
00714 CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
00715 PatchMgr *patchMgr = pm.ckLocalBranch();
00716
00717 int numPatches = patchMap->numPatches();
00718
00719 FullAtomList *atoms = createAtomLists();
00720
00721 for(int i=0; i < numPatches; i++) {
00722 patchMgr->sendAtoms(i,atoms[i]);
00723 }
00724
00725 delete [] atoms;
00726
00727 }
|
|
||||||||||||
|
Definition at line 89 of file WorkDistrib.C. References DebugM, ComputeMap::newNode(), ComputeMapChangeMsg::newNodes, ComputeMap::node(), ComputeMap::numComputes(), ComputeMapChangeMsg::numNewNodes, and ComputeMap::Object(). Referenced by ComputeMgr::updateComputes2(). 00090 {
00091 saveComputeMapReturnEP = ep;
00092 saveComputeMapReturnChareID = chareID;
00093 saveComputeMapCount = CkNumPes();
00094
00095 ComputeMap *computeMap = ComputeMap::Object();
00096
00097 int i;
00098 int nc = computeMap->numComputes();
00099 for (i=0; i<nc; i++) {
00100 DebugM(3, "ComputeMap (" << i << ") node = " << computeMap->node(i) << " newNode = " << computeMap->newNode(i) << "\n");
00101 }
00102
00103 ComputeMapChangeMsg *mapMsg = new (nc, 0) ComputeMapChangeMsg ;
00104
00105 mapMsg->numNewNodes = nc;
00106 for(i=0; i<nc; i++)
00107 mapMsg->newNodes[i] = computeMap->newNode(i);
00108
00109 CProxy_WorkDistrib(thisgroup).recvComputeMapChanges(mapMsg);
00110 }
|
|
|
Definition at line 775 of file WorkDistrib.C. References MapDistribMsg::computeMapData, SimParameters::isSendSpanningTreeUnset(), PatchMap::numPatches(), ProxyMgr::Object(), ComputeMap::Object(), PatchMap::Object(), MapDistribMsg::patchMapData, ProxyMgr::setSendSpanning(), Node::simParameters, ComputeMap::unpack(), and PatchMap::unpack(). 00776 {
00777 // Use a resend to forward messages before processing. Otherwise the
00778 // map distribution is slow on many CPUs. We need to use a tree
00779 // rather than a broadcast because some implementations of broadcast
00780 // generate a copy of the message on the sender for each recipient.
00781 // This is because MPI doesn't allow re-use of an outstanding buffer.
00782
00783 if ( mapsArrived && CkMyPe() ) {
00784 PatchMap::Object()->unpack(msg->patchMapData);
00785 ComputeMap::Object()->unpack(msg->computeMapData);
00786
00787 //Automatically enable spanning tree
00788 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00789 Node *node = nd.ckLocalBranch();
00790 SimParameters *params = node->simParameters;
00791 if(PatchMap::Object()->numPatches() <= CkNumPes()/4 && params->isSendSpanningTreeUnset())
00792 ProxyMgr::Object()->setSendSpanning();
00793 }
00794 if ( mapsArrived ) {
00795 delete msg;
00796 return;
00797 }
00798
00799 mapsArrived = true;
00800
00801 int pids[3];
00802 int basePe = 2 * CkMyPe() + 1;
00803 int npid = 0;
00804 if ( (basePe+npid) < CkNumPes() ) { pids[npid] = basePe + npid; ++npid; }
00805 if ( (basePe+npid) < CkNumPes() ) { pids[npid] = basePe + npid; ++npid; }
00806 pids[npid] = CkMyPe(); ++npid; // always send the message to ourselves
00807 CProxy_WorkDistrib(thisgroup).saveMaps(msg,npid,pids);
00808 }
|
|
|
Definition at line 747 of file WorkDistrib.C. References MapDistribMsg::computeMapData, SimParameters::isSendSpanningTreeUnset(), PatchMap::numPatches(), ComputeMap::Object(), ProxyMgr::Object(), PatchMap::Object(), ComputeMap::pack(), PatchMap::pack(), ComputeMap::packSize(), PatchMap::packSize(), MapDistribMsg::patchMapData, ProxyMgr::setSendSpanning(), and Node::simParameters. Referenced by Node::startup(). 00748 {
00749 if ( CkNumPes() == 1 ) {
00750 mapsArrived = true;
00751 return;
00752 }
00753
00754 //Automatically enable spanning tree
00755 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00756 Node *node = nd.ckLocalBranch();
00757 SimParameters *params = node->simParameters;
00758 if(PatchMap::Object()->numPatches() <= CkNumPes()/4 && params->isSendSpanningTreeUnset())
00759 ProxyMgr::Object()->setSendSpanning();
00760
00761 int sizes[2];
00762 sizes[0] = PatchMap::Object()->packSize();
00763 sizes[1] = ComputeMap::Object()->packSize();
00764
00765 MapDistribMsg *mapMsg = new (sizes[0], sizes[1], 0) MapDistribMsg;
00766
00767 PatchMap::Object()->pack(mapMsg->patchMapData);
00768 ComputeMap::Object()->pack(mapMsg->computeMapData);
00769
00770 CProxy_WorkDistrib workProxy(thisgroup);
00771 workProxy[0].saveMaps(mapMsg);
00772 }
|
1.3.9.1