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

|
|
Definition at line 75 of file WorkDistrib.C. References eventMachineProgress. 00076 {
00077 CkpvAccess(BOCclass_group).workDistrib = thisgroup;
00078 patchMapArrived = false;
00079 computeMapArrived = false;
00080 eventMachineProgress = traceRegisterUserEvent("CmiMachineProgressImpl",233);
00081 }
|
|
|
Definition at line 84 of file WorkDistrib.C. 00085 { }
|
|
|
Definition at line 1010 of file WorkDistrib.C. References Patch::getNumAtoms(), iINFO(), iout, Node::molecule, NAMD_die(), PatchMap::node(), Molecule::numAtoms, Node::numNodes(), PatchMap::numPatches(), Node::Object(), PatchMap::Object(), PatchMap::patch(), SimParameters::PMEOn, Node::simParameters, SimParameters::simulatedPEs, and SimParameters::simulateInitialMapping. Referenced by Node::startup(). 01011 {
01012 PatchMap *patchMap = PatchMap::Object();
01013 int nNodes = Node::Object()->numNodes();
01014 SimParameters *simparam = Node::Object()->simParameters;
01015 if(simparam->simulateInitialMapping) {
01016 nNodes = simparam->simulatedPEs;
01017 }
01018
01019 #if USE_TOPOMAP
01020 TopoManager tmgr;
01021 int numPes = tmgr.getDimNX() * tmgr.getDimNY() * tmgr.getDimNZ();
01022 if (numPes > patchMap->numPatches() && (assignPatchesTopoGridRecBisection() > 0)) {
01023 CkPrintf ("Blue Gene/L topology partitioner finished successfully \n");
01024 }
01025 else
01026 #endif
01027 if (nNodes > patchMap->numPatches())
01028 assignPatchesBitReversal();
01029 else
01030 #if ! (CMK_BLUEGENEP | CMK_BLUEGENEL)
01031 if ( simparam->PMEOn )
01032 assignPatchesSpaceFillingCurve();
01033 else
01034 #endif
01035 assignPatchesRecursiveBisection();
01036 // assignPatchesRoundRobin();
01037 // assignPatchesToLowestLoadNode();
01038
01039 int *nAtoms = new int[nNodes];
01040 int numAtoms=0;
01041 int i;
01042 for(i=0; i < nNodes; i++)
01043 nAtoms[i] = 0;
01044
01045 for(i=0; i < patchMap->numPatches(); i++)
01046 {
01047 // iout << iINFO << "Patch " << i << " has "
01048 // << patchMap->patch(i)->getNumAtoms() << " atoms and "
01049 // << patchMap->patch(i)->getNumAtoms() *
01050 // patchMap->patch(i)->getNumAtoms()
01051 // << " pairs.\n" << endi;
01052 #ifdef MEM_OPT_VERSION
01053 numAtoms += patchMap->numAtoms(i);
01054 nAtoms[patchMap->node(i)] += patchMap->numAtoms(i);
01055 #else
01056 if (patchMap->patch(i)) {
01057 numAtoms += patchMap->patch(i)->getNumAtoms();
01058 nAtoms[patchMap->node(i)] += patchMap->patch(i)->getNumAtoms();
01059 }
01060 #endif
01061 }
01062
01063 if ( numAtoms != Node::Object()->molecule->numAtoms ) {
01064 for(i=0; i < nNodes; i++)
01065 iout << iINFO << nAtoms[i] << " atoms assigned to node " << i << "\n" << endi;
01066 iout << iINFO << "Assigned " << numAtoms << " atoms but expected " << Node::Object()->molecule->numAtoms << "\n" << endi;
01067 NAMD_die("Incorrect atom count in WorkDistrib::assignNodeToPatch\n");
01068 }
01069
01070 delete [] nAtoms;
01071
01072 // PatchMap::Object()->printPatchMap();
01073 }
|
|
|
Definition at line 337 of file WorkDistrib.C. References ResizeArray< Elem >::add(), SimParameters::alchFepOn, SimParameters::alchThermIntOn, Lattice::apply_transform(), PatchMap::assignToPatch(), Molecule::atomcharge(), CompAtomExt::atomFixed, HydrogenGroupID::atomID, Molecule::atommass(), HydrogenGroupID::atomsInGroup, HydrogenGroupID::atomsInMigrationGroup, Molecule::atomvdwtype(), ResizeArray< Elem >::begin(), Bool, CompAtom::charge, SimParameters::comMove, Node::configList, StringList::data, ConfigList::find(), FullAtom::fixedPosition, FullAtomList, PDB::get_all_positions(), Molecule::get_fep_type(), Molecule::getAtoms(), PatchMap::gridsize_a(), PatchMap::gridsize_b(), PatchMap::gridsize_c(), CompAtomExt::groupFixed, Molecule::hydrogenGroup, CompAtom::hydrogenGroupSize, CompAtomExt::id, PatchMap::index_a(), PatchMap::index_b(), PatchMap::index_c(), SimParameters::initialTemp, iout, Molecule::is_atom_fixed(), HydrogenGroupID::isGP, HydrogenGroupID::isMP, j, Molecule::langevin_param(), FullAtom::langevinParam, SimParameters::lattice, SimParameters::lesOn, FullAtom::mass, PatchMap::max_a(), PatchMap::max_b(), PatchMap::max_c(), FullAtom::migrationGroupSize, PatchMap::min_a(), PatchMap::min_b(), PatchMap::min_c(), Node::molecule, NAMD_bug(), Lattice::nearest(), CompAtom::nonbondedGroupSize, PDB::num_atoms(), PatchMap::numPatches(), PatchMap::Object(), order, SimParameters::outputPatchDetails, SimParameters::pairInteractionOn, CompAtom::partition, Node::pdb, CompAtom::position, Position, SimParameters::pressureProfileAtomTypes, Molecule::rigid_bond_length(), FullAtom::rigidBondLength, SimParameters::rigidBonds, ScaledPosition, Node::simParameters, ResizeArray< Elem >::size(), sortAtomsForPatches(), SimParameters::staticAtomAssignment, atom_constants::status, FullAtom::status, FullAtom::transform, CompAtom::vdwType, FullAtom::velocity, and Velocity. Referenced by createHomePatches(), and reinitAtoms(). 00338 {
00339 int i;
00340 StringList *current; // Pointer used to retrieve configuration items
00341 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00342 Node *node = nd.ckLocalBranch();
00343 PatchMap *patchMap = PatchMap::Object();
00344 CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
00345 PatchMgr *patchMgr = pm.ckLocalBranch();
00346 SimParameters *params = node->simParameters;
00347 Molecule *molecule = node->molecule;
00348 PDB *pdb = node->pdb;
00349
00350 int numPatches = patchMap->numPatches();
00351 int numAtoms = pdb->num_atoms();
00352
00353 Vector *positions = new Position[numAtoms];
00354 pdb->get_all_positions(positions);
00355
00356 Vector *velocities = new Velocity[numAtoms];
00357
00358 if ( params->initialTemp < 0.0 ) {
00359 Bool binvels=FALSE;
00360
00361 // Reading the veolcities from a PDB
00362 current = node->configList->find("velocities");
00363
00364 if (current == NULL) {
00365 current = node->configList->find("binvelocities");
00366 binvels = TRUE;
00367 }
00368
00369 if (!binvels) {
00370 velocities_from_PDB(current->data, velocities, numAtoms);
00371 }
00372 else {
00373 velocities_from_binfile(current->data, velocities, numAtoms);
00374 }
00375 }
00376 else {
00377 // Random velocities for a given temperature
00378 random_velocities(params->initialTemp, molecule, velocities, numAtoms);
00379 }
00380
00381 // If COMMotion == no, remove center of mass motion
00382 if (!(params->comMove)) {
00383 remove_com_motion(velocities, molecule, numAtoms);
00384 }
00385
00386 FullAtomList *atoms = new FullAtomList[numPatches];
00387
00388 const Lattice lattice = params->lattice;
00389
00390 if ( params->staticAtomAssignment ) {
00391 FullAtomList sortAtoms;
00392 for ( i=0; i < numAtoms; i++ ) {
00393 HydrogenGroupID &h = molecule->hydrogenGroup[i];
00394 if ( ! h.isMP ) continue;
00395 FullAtom a;
00396 a.id = i;
00397 a.migrationGroupSize = h.isMP ? h.atomsInMigrationGroup : 0;
00398 a.position = positions[h.atomID];
00399 sortAtoms.add(a);
00400 }
00401 int *order = new int[sortAtoms.size()];
00402 for ( i=0; i < sortAtoms.size(); i++ ) {
00403 order[i] = i;
00404 }
00405 int *breaks = new int[numPatches];
00406 sortAtomsForPatches(order,breaks,sortAtoms.begin(),
00407 sortAtoms.size(),numAtoms,
00408 patchMap->gridsize_c(),
00409 patchMap->gridsize_b(),
00410 patchMap->gridsize_a());
00411
00412 i = 0;
00413 for ( int pid = 0; pid < numPatches; ++pid ) {
00414 int iend = breaks[pid];
00415 for ( ; i<iend; ++i ) {
00416 FullAtom &sa = sortAtoms[order[i]];
00417 int mgs = sa.migrationGroupSize;
00418 /*
00419 CkPrintf("patch %d (%d %d %d) has group %d atom %d size %d at %.2f %.2f %.2f\n",
00420 pid, patchMap->index_a(pid), patchMap->index_b(pid),
00421 patchMap->index_c(pid), order[i], sa.id, mgs,
00422 sa.position.x, sa.position.y, sa.position.z);
00423 */
00424 for ( int k=0; k<mgs; ++k ) {
00425 HydrogenGroupID &h = molecule->hydrogenGroup[sa.id + k];
00426 int aid = h.atomID;
00427 FullAtom a;
00428 a.id = aid;
00429 a.position = positions[aid];
00430 a.velocity = velocities[aid];
00431 a.vdwType = molecule->atomvdwtype(aid);
00432 a.status = molecule->getAtoms()[aid].status;
00433 a.langevinParam = molecule->langevin_param(aid);
00434 a.hydrogenGroupSize = h.isGP ? h.atomsInGroup : 0;
00435 a.migrationGroupSize = h.isMP ? h.atomsInMigrationGroup : 0;
00436 if(params->rigidBonds != RIGID_NONE) {
00437 a.rigidBondLength = molecule->rigid_bond_length(aid);
00438 }else{
00439 a.rigidBondLength = 0.0;
00440 }
00441 atoms[pid].add(a);
00442 }
00443 }
00444 CkPrintf("patch %d (%d %d %d) has %d atoms\n",
00445 pid, patchMap->index_a(pid), patchMap->index_b(pid),
00446 patchMap->index_c(pid), atoms[pid].size());
00447 }
00448 delete [] order;
00449 delete [] breaks;
00450 } else
00451 {
00452 // split atoms into patches based on migration group and position
00453 int aid, pid=0;
00454 for(i=0; i < numAtoms; i++)
00455 {
00456 // Assign atoms to patches without splitting hydrogen groups.
00457 // We know that the hydrogenGroup array is sorted with group parents
00458 // listed first. Thus, only change the pid if an atom is a group parent.
00459 HydrogenGroupID &h = molecule->hydrogenGroup[i];
00460 aid = h.atomID;
00461 FullAtom a;
00462 a.id = aid;
00463 a.position = positions[aid];
00464 a.velocity = velocities[aid];
00465 a.vdwType = molecule->atomvdwtype(aid);
00466 a.status = molecule->getAtoms()[aid].status;
00467 a.langevinParam = molecule->langevin_param(aid);
00468 a.hydrogenGroupSize = h.isGP ? h.atomsInGroup : 0;
00469 a.migrationGroupSize = h.isMP ? h.atomsInMigrationGroup : 0;
00470 if(params->rigidBonds != RIGID_NONE) {
00471 a.rigidBondLength = molecule->rigid_bond_length(aid);
00472 }else{
00473 a.rigidBondLength = 0.0;
00474 }
00475 if (h.isMP) {
00476 pid = patchMap->assignToPatch(positions[aid],lattice);
00477 } // else: don't change pid
00478 atoms[pid].add(a);
00479 }
00480 }
00481
00482 delete [] positions;
00483 delete [] velocities;
00484
00485 for(i=0; i < numPatches; i++)
00486 {
00487 ScaledPosition center(0.5*(patchMap->min_a(i)+patchMap->max_a(i)),
00488 0.5*(patchMap->min_b(i)+patchMap->max_b(i)),
00489 0.5*(patchMap->min_c(i)+patchMap->max_c(i)));
00490
00491 int n = atoms[i].size();
00492 FullAtom *a = atoms[i].begin();
00493 int j;
00494 //Modifications for alchemical fep
00495 Bool alchFepOn = params->alchFepOn;
00496 Bool alchThermIntOn = params->alchThermIntOn;
00497 //fepe
00498 Bool lesOn = params->lesOn;
00499
00500 Bool pairInteractionOn = params->pairInteractionOn;
00501
00502 Bool pressureProfileTypes = (params->pressureProfileAtomTypes > 1);
00503
00504 Transform mother_transform;
00505 for(j=0; j < n; j++)
00506 {
00507 int aid = a[j].id;
00508
00509 a[j].nonbondedGroupSize = 0; // must be set based on coordinates
00510
00511 a[j].atomFixed = molecule->is_atom_fixed(aid) ? 1 : 0;
00512 a[j].fixedPosition = a[j].position;
00513
00514 if ( a[j].migrationGroupSize ) {
00515 if ( a[j].migrationGroupSize != a[j].hydrogenGroupSize ) {
00516 Position pos = a[j].position;
00517 int mgs = a[j].migrationGroupSize;
00518 int c = 1;
00519 for ( int k=a[j].hydrogenGroupSize; k<mgs;
00520 k+=a[j+k].hydrogenGroupSize ) {
00521 pos += a[j+k].position;
00522 ++c;
00523 }
00524 pos *= 1./c;
00525 mother_transform = a[j].transform; // should be 0,0,0
00526 pos = lattice.nearest(pos,center,&mother_transform);
00527 a[j].position = lattice.apply_transform(a[j].position,mother_transform);
00528 a[j].transform = mother_transform;
00529 } else {
00530 a[j].position = lattice.nearest(
00531 a[j].position, center, &(a[j].transform));
00532 mother_transform = a[j].transform;
00533 }
00534 } else {
00535 a[j].position = lattice.apply_transform(a[j].position,mother_transform);
00536 a[j].transform = mother_transform;
00537 }
00538
00539 a[j].mass = molecule->atommass(aid);
00540 a[j].charge = molecule->atomcharge(aid);
00541
00542 //Modifications for alchemical fep
00543 if ( alchFepOn || alchThermIntOn || lesOn || pairInteractionOn || pressureProfileTypes) {
00544 a[j].partition = molecule->get_fep_type(aid);
00545 }
00546 else {
00547 a[j].partition = 0;
00548 }
00549 //fepe
00550
00551 }
00552
00553 int size, allfixed, k;
00554 for(j=0; j < n; j+=size) {
00555 size = a[j].hydrogenGroupSize;
00556 if ( ! size ) {
00557 NAMD_bug("Mother atom with hydrogenGroupSize of 0!");
00558 }
00559 allfixed = 1;
00560 for ( k = 0; k < size; ++k ) {
00561 allfixed = ( allfixed && (a[j+k].atomFixed) );
00562 }
00563 for ( k = 0; k < size; ++k ) {
00564 a[j+k].groupFixed = allfixed ? 1 : 0;
00565 }
00566 }
00567
00568 if ( params->outputPatchDetails ) {
00569 int patchId = i;
00570 int numAtomsInPatch = n;
00571 int numFixedAtomsInPatch = 0;
00572 int numAtomsInFixedGroupsInPatch = 0;
00573 for(j=0; j < n; j++) {
00574 numFixedAtomsInPatch += ( a[j].atomFixed ? 1 : 0 );
00575 numAtomsInFixedGroupsInPatch += ( a[j].groupFixed ? 1 : 0 );
00576 }
00577 iout << "PATCH_DETAILS:"
00578 << " patch " << patchId
00579 << " atoms " << numAtomsInPatch
00580 << " fixed_atoms " << numFixedAtomsInPatch
00581 << " fixed_groups " << numAtomsInFixedGroupsInPatch
00582 << "\n" << endi;
00583 }
00584 }
00585
00586 return atoms;
00587
00588 }
|
|
|
Definition at line 593 of file WorkDistrib.C. References createAtomLists(), PatchMgr::createHomePatch(), DebugM, FullAtomList, iINFO(), iout, PatchMap::numPatches(), PatchMap::Object(), and ResizeArray< Elem >::size(). Referenced by Node::startup(). 00594 {
00595 int i;
00596 PatchMap *patchMap = PatchMap::Object();
00597 CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
00598 PatchMgr *patchMgr = pm.ckLocalBranch();
00599
00600 int numPatches = patchMap->numPatches();
00601
00602 FullAtomList *atoms = createAtomLists();
00603
00604 #ifdef MEM_OPT_VERSION
00605 /* CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00606 Node *node = nd.ckLocalBranch();
00607 node->molecule->delEachAtomSigs();
00608 node->molecule->delMassChargeSpace();
00609 */
00610 #endif
00611
00612 int maxAtoms = -1;
00613 int maxPatch = -1;
00614 for(i=0; i < numPatches; i++) {
00615 int numAtoms = atoms[i].size();
00616 if ( numAtoms > maxAtoms ) { maxAtoms = numAtoms; maxPatch = i; }
00617 }
00618 iout << iINFO << "LARGEST PATCH (" << maxPatch <<
00619 ") HAS " << maxAtoms << " ATOMS\n" << endi;
00620
00621 for(i=0; i < numPatches; i++)
00622 {
00623 if ( ! ( i % 100 ) )
00624 {
00625 DebugM(3,"Created " << i << " patches so far.\n");
00626 }
00627
00628 patchMgr->createHomePatch(i,atoms[i]);
00629 }
00630
00631 delete [] atoms;
00632 }
|
|
|
Definition at line 634 of file WorkDistrib.C. References DebugM, PatchMgr::movePatch(), Node::myid(), PatchMap::node(), PatchMap::numPatches(), PatchMap::Object(), and PatchMgr::sendMovePatches(). Referenced by Node::startup(). 00634 {
00635 // ref BOC
00636 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00637 Node *node = nd.ckLocalBranch();
00638 CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
00639 PatchMgr *patchMgr = pm.ckLocalBranch();
00640 // ref singleton
00641 PatchMap *patchMap = PatchMap::Object();
00642
00643 // Move patches to the proper node
00644 for(int i=0;i < patchMap->numPatches(); i++)
00645 {
00646 if (patchMap->node(i) != node->myid() )
00647 {
00648 DebugM(3,"patchMgr->movePatch("
00649 << i << "," << patchMap->node(i) << ")\n");
00650 patchMgr->movePatch(i,patchMap->node(i));
00651 }
00652 }
00653 patchMgr->sendMovePatches();
00654 }
|
|
|
Definition at line 142 of file WorkDistrib.C. 00142 {
00143 delete msg;
00144
00145 CkSendMsgBranch(saveComputeMapReturnEP, CkAllocMsg(0,0,0), 0, saveComputeMapReturnChareID);
00146 }
|
|
|
Definition at line 2038 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02038 {
02039 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02040 if ( msg->compute->localWorkMsg != msg )
02041 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02042 }
|
|
|
Definition at line 2062 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02062 {
02063 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02064 if ( msg->compute->localWorkMsg != msg )
02065 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02066 }
|
|
|
Definition at line 2032 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02032 {
02033 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02034 if ( msg->compute->localWorkMsg != msg )
02035 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02036 }
|
|
|
Definition at line 2068 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02068 {
02069 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02070 if ( msg->compute->localWorkMsg != msg )
02071 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02072 }
|
|
|
Definition at line 2157 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), and eventMachineProgress. 02157 {
02158 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02159 // ComputeNonbondedCUDA *c = msg->compute;
02160 // if ( c->localWorkMsg != msg && c->localWorkMsg2 != msg )
02161 // NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02162 }
|
|
|
Definition at line 2163 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), and eventMachineProgress. 02163 {
02164 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02165 }
|
|
|
Definition at line 2166 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), and eventMachineProgress. 02166 {
02167 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02168 }
|
|
|
Definition at line 2044 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02044 {
02045 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02046 if ( msg->compute->localWorkMsg != msg )
02047 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02048 }
|
|
|
Definition at line 2026 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02026 {
02027 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02028 if ( msg->compute->localWorkMsg != msg )
02029 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02030 }
|
|
|
Definition at line 2050 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02050 {
02051 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02052 if ( msg->compute->localWorkMsg != msg )
02053 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02054 }
|
|
|
Definition at line 2080 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), Compute::localWorkMsg, and NAMD_bug(). 02080 {
02081 msg->compute->doWork();
02082 if ( msg->compute->localWorkMsg != msg )
02083 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02084 }
|
|
|
Definition at line 2074 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02074 {
02075 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02076 if ( msg->compute->localWorkMsg != msg )
02077 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02078 }
|
|
|
Definition at line 2085 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02085 {
02086 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02087 if ( msg->compute->localWorkMsg != msg )
02088 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02089 }
|
|
|
Definition at line 2090 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02090 {
02091 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02092 if ( msg->compute->localWorkMsg != msg )
02093 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02094 }
|
|
|
Definition at line 2095 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02095 {
02096 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02097 if ( msg->compute->localWorkMsg != msg )
02098 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02099 }
|
|
|
Definition at line 2101 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02101 {
02102 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02103 if ( msg->compute->localWorkMsg != msg )
02104 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02105 }
|
|
|
Definition at line 2106 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02106 {
02107 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02108 if ( msg->compute->localWorkMsg != msg )
02109 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02110 }
|
|
|
Definition at line 2111 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02111 {
02112 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02113 if ( msg->compute->localWorkMsg != msg )
02114 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02115 }
|
|
|
Definition at line 2056 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02056 {
02057 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02058 if ( msg->compute->localWorkMsg != msg )
02059 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02060 }
|
|
|
Definition at line 2020 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02020 {
02021 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02022 if ( msg->compute->localWorkMsg != msg )
02023 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02024 }
|
|
|
Definition at line 2117 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02117 {
02118 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02119 if ( msg->compute->localWorkMsg != msg )
02120 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02121 }
|
|
|
Definition at line 2122 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02122 {
02123 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02124 if ( msg->compute->localWorkMsg != msg )
02125 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02126 }
|
|
|
Definition at line 2127 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02127 {
02128 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02129 if ( msg->compute->localWorkMsg != msg )
02130 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02131 }
|
|
|
Definition at line 2133 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02133 {
02134 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02135 if ( msg->compute->localWorkMsg != msg )
02136 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02137 }
|
|
|
Definition at line 2138 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02138 {
02139 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02140 if ( msg->compute->localWorkMsg != msg )
02141 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02142 }
|
|
|
Definition at line 2143 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02143 {
02144 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02145 if ( msg->compute->localWorkMsg != msg )
02146 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02147 }
|
|
|
Definition at line 2151 of file WorkDistrib.C. References LocalWorkMsg::compute, Compute::doWork(), eventMachineProgress, Compute::localWorkMsg, and NAMD_bug(). 02151 {
02152 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02153 if ( msg->compute->localWorkMsg != msg )
02154 NAMD_bug("WorkDistrib LocalWorkMsg recycling failed!");
02155 }
|
|
|
Definition at line 1428 of file WorkDistrib.C. References ComputeMap::allocateCids(), computeAnglesType, computeAnisoType, computeBondsType, computeConsForceType, computeConsTorqueType, computeCrosstermsType, computeCylindricalBCType, computeDihedralsType, computeEFieldType, computeEwaldType, computeExclsType, computeExtType, computeFullDirectType, computeGBISserType, computeGlobalType, computeGridForceType, computeImpropersType, SimParameters::computeMapFilename, computeMsmMsaType, computeMsmSerialType, computeMsmType, computeNonbondedCUDAType, computePmeType, computeRestraintsType, computeSelfAnglesType, computeSelfAnisoType, computeSelfBondsType, computeSelfCrosstermsType, computeSelfDihedralsType, computeSelfExclsType, computeSelfImpropersType, computeSelfTholeType, computeSphericalBCType, computeStirType, computeTclBCType, computeTholeType, SimParameters::consForceOn, SimParameters::consTorqueOn, SimParameters::constraintsOn, SimParameters::cylindricalBCOn, DebugM, SimParameters::drudeOn, SimParameters::eFieldOn, SimParameters::extForcesOn, SimParameters::FMAOn, SimParameters::fullDirectOn, SimParameters::GBISserOn, SimParameters::globalForcesOn, SimParameters::LCPOOn, ComputeMap::loadComputeMap(), SimParameters::loadComputeMap, SimParameters::mgridforceOn, SimParameters::MSMOn, SimParameters::MsmSerialOn, NAMD_die(), Node::Object(), ComputeMap::Object(), PatchMap::Object(), optPmeType, SimParameters::pairInteractionOn, SimParameters::pairInteractionSelf, SimParameters::PMEOn, SimParameters::pressureProfileEwaldOn, ComputeMap::saveComputeMap(), Node::simParameters, simParams, SimParameters::sphericalBCOn, SimParameters::stirOn, SimParameters::storeComputeMap, SimParameters::tclBCOn, SimParameters::useDPME, and SimParameters::useOptPME. Referenced by Node::startup(). 01429 {
01430 PatchMap *patchMap = PatchMap::Object();
01431 ComputeMap *computeMap = ComputeMap::Object();
01432 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
01433 Node *node = nd.ckLocalBranch();
01434
01435 DebugM(3,"Mapping computes\n");
01436
01437 computeMap->allocateCids();
01438
01439 // Handle full electrostatics
01440 if ( node->simParameters->fullDirectOn )
01441 mapComputeHomePatches(computeFullDirectType);
01442 if ( node->simParameters->FMAOn )
01443 #ifdef DPMTA
01444 mapComputeHomePatches(computeDPMTAType);
01445 #else
01446 NAMD_die("This binary does not include DPMTA (FMA).");
01447 #endif
01448 if ( node->simParameters->PMEOn ) {
01449 #ifdef DPME
01450 if ( node->simParameters->useDPME )
01451 mapComputeHomePatches(computeDPMEType);
01452 else {
01453 if (node->simParameters->useOptPME) {
01454 mapComputeHomePatches(optPmeType);
01455 if ( node->simParameters->pressureProfileEwaldOn )
01456 mapComputeHomePatches(computeEwaldType);
01457 }
01458 else {
01459 mapComputeHomePatches(computePmeType);
01460 if ( node->simParameters->pressureProfileEwaldOn )
01461 mapComputeHomePatches(computeEwaldType);
01462 }
01463 }
01464 #else
01465 if (node->simParameters->useOptPME) {
01466 mapComputeHomePatches(optPmeType);
01467 if ( node->simParameters->pressureProfileEwaldOn )
01468 mapComputeHomePatches(computeEwaldType);
01469 }
01470 else {
01471 mapComputeHomePatches(computePmeType);
01472 if ( node->simParameters->pressureProfileEwaldOn )
01473 mapComputeHomePatches(computeEwaldType);
01474 }
01475 #endif
01476 }
01477
01478 if ( node->simParameters->globalForcesOn ) {
01479 DebugM(2,"adding ComputeGlobal\n");
01480 mapComputeHomePatches(computeGlobalType);
01481 }
01482
01483 if ( node->simParameters->extForcesOn )
01484 mapComputeHomePatches(computeExtType);
01485
01486 if ( node->simParameters->GBISserOn )
01487 mapComputeHomePatches(computeGBISserType);
01488
01489 if ( node->simParameters->MsmSerialOn )
01490 mapComputeHomePatches(computeMsmSerialType);
01491 #ifdef CHARM_HAS_MSA
01492 else if ( node->simParameters->MSMOn )
01493 mapComputeHomePatches(computeMsmMsaType);
01494 #else
01495 else if ( node->simParameters->MSMOn )
01496 mapComputeHomePatches(computeMsmType);
01497 #endif
01498
01499 #ifdef NAMD_CUDA
01500 mapComputeNode(computeNonbondedCUDAType);
01501 mapComputeHomeTuples(computeExclsType);
01502 mapComputePatch(computeSelfExclsType);
01503 #endif
01504
01505 mapComputeNonbonded();
01506
01507 if ( node->simParameters->LCPOOn ) {
01508 mapComputeLCPO();
01509 }
01510
01511 // If we're doing true pair interactions, no need for bonded terms.
01512 // But if we're doing within-group interactions, we do need them.
01513 if ( !node->simParameters->pairInteractionOn ||
01514 node->simParameters->pairInteractionSelf) {
01515 mapComputeHomeTuples(computeBondsType);
01516 mapComputeHomeTuples(computeAnglesType);
01517 mapComputeHomeTuples(computeDihedralsType);
01518 mapComputeHomeTuples(computeImpropersType);
01519 mapComputeHomeTuples(computeCrosstermsType);
01520 mapComputePatch(computeSelfBondsType);
01521 mapComputePatch(computeSelfAnglesType);
01522 mapComputePatch(computeSelfDihedralsType);
01523 mapComputePatch(computeSelfImpropersType);
01524 mapComputePatch(computeSelfCrosstermsType);
01525 }
01526
01527 if ( node->simParameters->drudeOn ) {
01528 mapComputeHomeTuples(computeTholeType);
01529 mapComputePatch(computeSelfTholeType);
01530 mapComputeHomeTuples(computeAnisoType);
01531 mapComputePatch(computeSelfAnisoType);
01532 }
01533
01534 if ( node->simParameters->eFieldOn )
01535 mapComputePatch(computeEFieldType);
01536 /* BEGIN gf */
01537 if ( node->simParameters->mgridforceOn )
01538 mapComputePatch(computeGridForceType);
01539 /* END gf */
01540 if ( node->simParameters->stirOn )
01541 mapComputePatch(computeStirType);
01542 if ( node->simParameters->sphericalBCOn )
01543 mapComputePatch(computeSphericalBCType);
01544 if ( node->simParameters->cylindricalBCOn )
01545 mapComputePatch(computeCylindricalBCType);
01546 if ( node->simParameters->tclBCOn ) {
01547 mapComputeHomePatches(computeTclBCType);
01548 }
01549 if ( node->simParameters->constraintsOn )
01550 mapComputePatch(computeRestraintsType);
01551 if ( node->simParameters->consForceOn )
01552 mapComputePatch(computeConsForceType);
01553 if ( node->simParameters->consTorqueOn )
01554 mapComputePatch(computeConsTorqueType);
01555
01556 // store the latest compute map
01557 SimParameters *simParams = Node::Object()->simParameters;
01558 if (simParams->storeComputeMap) {
01559 computeMap->saveComputeMap(simParams->computeMapFilename);
01560 }
01561 // override mapping decision
01562 if (simParams->loadComputeMap) {
01563 computeMap->loadComputeMap(simParams->computeMapFilename);
01564 CkPrintf("ComputeMap has been loaded from %s.\n", simParams->computeMapFilename);
01565 }
01566 }
|
|
|
Definition at line 1857 of file WorkDistrib.C. References Compute::cid, LocalWorkMsg::compute, computeAnglesType, computeAnisoType, computeBondsType, computeCrosstermsType, computeDihedralsType, computeExclsType, computeImpropersType, computeLCPOType, computeNonbondedCUDAType, computeNonbondedPairType, computeNonbondedSelfType, computePmeType, computeSelfAnglesType, computeSelfAnisoType, computeSelfBondsType, computeSelfCrosstermsType, computeSelfDihedralsType, computeSelfExclsType, computeSelfImpropersType, computeSelfTholeType, computeTholeType, Compute::doWork(), Compute::enqueueWork(), eventMachineProgress, Compute::getGBISPhase(), Compute::localWorkMsg, NAMD_bug(), optPmeType, Compute::priority(), Compute::sequence(), SET_PRIORITY, and Compute::type(). Referenced by Compute::enqueueWork(), and ComputeNonbondedCUDA::messageFinishWork(). 01857 {
01858 LocalWorkMsg *msg = compute->localWorkMsg;
01859 int seq = compute->sequence();
01860 int gbisPhase = compute->getGBISPhase();
01861
01862 if ( seq < 0 ) {
01863 NAMD_bug("compute->sequence() < 0 in WorkDistrib::messageEnqueueWork");
01864 } else {
01865 SET_PRIORITY(msg,seq,compute->priority());
01866 }
01867
01868 msg->compute = compute; // pointer is valid since send is to local Pe
01869 int type = compute->type();
01870 int cid = compute->cid;
01871
01872 CProxy_WorkDistrib wdProxy(CkpvAccess(BOCclass_group).workDistrib);
01873 switch ( type ) {
01874 case computeExclsType:
01875 case computeSelfExclsType:
01876 wdProxy[CkMyPe()].enqueueExcls(msg);
01877 break;
01878 case computeBondsType:
01879 case computeSelfBondsType:
01880 wdProxy[CkMyPe()].enqueueBonds(msg);
01881 break;
01882 case computeAnglesType:
01883 case computeSelfAnglesType:
01884 wdProxy[CkMyPe()].enqueueAngles(msg);
01885 break;
01886 case computeDihedralsType:
01887 case computeSelfDihedralsType:
01888 wdProxy[CkMyPe()].enqueueDihedrals(msg);
01889 break;
01890 case computeImpropersType:
01891 case computeSelfImpropersType:
01892 wdProxy[CkMyPe()].enqueueImpropers(msg);
01893 break;
01894 case computeTholeType:
01895 case computeSelfTholeType:
01896 wdProxy[CkMyPe()].enqueueThole(msg);
01897 break;
01898 case computeAnisoType:
01899 case computeSelfAnisoType:
01900 wdProxy[CkMyPe()].enqueueAniso(msg);
01901 break;
01902 case computeCrosstermsType:
01903 case computeSelfCrosstermsType:
01904 wdProxy[CkMyPe()].enqueueCrossterms(msg);
01905 break;
01906 case computeLCPOType:
01907 wdProxy[CkMyPe()].enqueueLCPO(msg);
01908 break;
01909 case computeNonbondedSelfType:
01910 switch ( seq % 2 ) {
01911 case 0:
01912 //wdProxy[CkMyPe()].enqueueSelfA(msg);
01913 switch ( gbisPhase ) {
01914 case 1:
01915 wdProxy[CkMyPe()].enqueueSelfA1(msg);
01916 break;
01917 case 2:
01918 wdProxy[CkMyPe()].enqueueSelfA2(msg);
01919 break;
01920 case 3:
01921 wdProxy[CkMyPe()].enqueueSelfA3(msg);
01922 break;
01923 }
01924 break;
01925 case 1:
01926 //wdProxy[CkMyPe()].enqueueSelfB(msg);
01927 switch ( gbisPhase ) {
01928 case 1:
01929 wdProxy[CkMyPe()].enqueueSelfB1(msg);
01930 break;
01931 case 2:
01932 wdProxy[CkMyPe()].enqueueSelfB2(msg);
01933 break;
01934 case 3:
01935 wdProxy[CkMyPe()].enqueueSelfB3(msg);
01936 break;
01937 }
01938 break;
01939 default:
01940 NAMD_bug("WorkDistrib::messageEnqueueSelf case statement error!");
01941 }
01942 break;
01943 case computeNonbondedPairType:
01944 switch ( seq % 2 ) {
01945 case 0:
01946 //wdProxy[CkMyPe()].enqueueWorkA(msg);
01947 switch ( gbisPhase ) {
01948 case 1:
01949 wdProxy[CkMyPe()].enqueueWorkA1(msg);
01950 break;
01951 case 2:
01952 wdProxy[CkMyPe()].enqueueWorkA2(msg);
01953 break;
01954 case 3:
01955 wdProxy[CkMyPe()].enqueueWorkA3(msg);
01956 break;
01957 }
01958 break;
01959 case 1:
01960 //wdProxy[CkMyPe()].enqueueWorkB(msg);
01961 switch ( gbisPhase ) {
01962 case 1:
01963 wdProxy[CkMyPe()].enqueueWorkB1(msg);
01964 break;
01965 case 2:
01966 wdProxy[CkMyPe()].enqueueWorkB2(msg);
01967 break;
01968 case 3:
01969 wdProxy[CkMyPe()].enqueueWorkB3(msg);
01970 break;
01971 }
01972 break;
01973 case 2:
01974 wdProxy[CkMyPe()].enqueueWorkC(msg);
01975 break;
01976 default:
01977 NAMD_bug("WorkDistrib::messageEnqueueWork case statement error!");
01978 }
01979 break;
01980 case computeNonbondedCUDAType:
01981 #ifdef NAMD_CUDA
01982 // CkPrintf("WorkDistrib[%d]::CUDA seq=%d phase=%d\n", CkMyPe(), seq, gbisPhase);
01983 //wdProxy[CkMyPe()].enqueueCUDA(msg);
01984 switch ( gbisPhase ) {
01985 case 1:
01986 wdProxy[CkMyPe()].enqueueCUDA(msg);
01987 break;
01988 case 2:
01989 wdProxy[CkMyPe()].enqueueCUDAP2(msg);
01990 break;
01991 case 3:
01992 wdProxy[CkMyPe()].enqueueCUDAP3(msg);
01993 break;
01994 }
01995 #else
01996 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
01997 #endif
01998 break;
01999 case computePmeType:
02000 // CkPrintf("PME %d %d %x\n", CkMyPe(), seq, compute->priority());
02001 #ifdef NAMD_CUDA
02002 wdProxy[CkMyPe()].enqueuePme(msg);
02003 #else
02004 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02005 #endif
02006 break;
02007 case optPmeType:
02008 // CkPrintf("PME %d %d %x\n", CkMyPe(), seq, compute->priority());
02009 #ifdef NAMD_CUDA
02010 wdProxy[CkMyPe()].enqueuePme(msg);
02011 #else
02012 msg->compute->doWork(); traceUserEvent(eventMachineProgress); CmiMachineProgressImpl();
02013 #endif
02014 break;
02015 default:
02016 wdProxy[CkMyPe()].enqueueWork(msg);
02017 }
02018 }
|
|
|
Definition at line 820 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, PDB::get_extremes(), iINFO(), iout, iWARN(), SimParameters::lattice, SimParameters::LCPOOn, PatchMap::makePatches(), SimParameters::maxPatches, SimParameters::minAtomsPerPatch, Node::molecule, SimParameters::MSMOn, NAMD_die(), SimParameters::noPatchesOnOne, SimParameters::noPatchesOnZero, PatchMap::nPatchesOnNode, PDB::num_atoms(), Molecule::numAtoms, Node::Object(), PatchMap::Object(), Lattice::origin(), SimParameters::patchDimension, Node::pdb, ScaledPosition, Node::simParameters, SimParameters::simulatedPEs, SimParameters::simulateInitialMapping, PatchMap::sizeGrid(), SimParameters::staticAtomAssignment, SimParameters::twoAwayX, SimParameters::twoAwayY, SimParameters::twoAwayZ, Vector::x, Vector::y, and Vector::z. Referenced by Node::startup(). 00821 {
00822 PatchMap *patchMap = PatchMap::Object();
00823 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00824 Node *node = nd.ckLocalBranch();
00825 SimParameters *params = node->simParameters;
00826 Lattice lattice = params->lattice;
00827
00828 BigReal patchSize = params->patchDimension;
00829
00830 ScaledPosition xmin, xmax;
00831
00832 double maxNumPatches = 1.e9; // need to adjust fractional values
00833 if ( params->minAtomsPerPatch > 0 )
00834 #ifndef MEM_OPT_VERSION
00835 maxNumPatches = node->pdb->num_atoms() / params->minAtomsPerPatch;
00836 #else
00837 maxNumPatches = node->molecule->numAtoms / params->minAtomsPerPatch;
00838 #endif
00839
00840 DebugM(3,"Mapping patches\n");
00841 if ( lattice.a_p() && lattice.b_p() && lattice.c_p() ) {
00842 xmin = 0.; xmax = 0.;
00843 }
00844 else if ( params->FMAOn || params->MSMOn ) {
00845 // Need to use full box for FMA to match NAMD 1.X results.
00846 #if 0
00847 node->pdb->find_extremes(&(xmin.x),&(xmax.x),lattice.a_r());
00848 node->pdb->find_extremes(&(xmin.y),&(xmax.y),lattice.b_r());
00849 node->pdb->find_extremes(&(xmin.z),&(xmax.z),lattice.c_r());
00850 #endif
00851 node->pdb->find_extremes(lattice);
00852 node->pdb->get_extremes(xmin, xmax);
00853 #if 0
00854 printf("+++ center=%.4f %.4f %.4f\n",
00855 lattice.origin().x, lattice.origin().y, lattice.origin().z);
00856 printf("+++ xmin=%.4f xmax=%.4f\n", xmin.x, xmax.x);
00857 printf("+++ ymin=%.4f ymax=%.4f\n", xmin.y, xmax.y);
00858 printf("+++ zmin=%.4f zmax=%.4f\n", xmin.z, xmax.z);
00859 #endif
00860 // Otherwise, this allows a small number of stray atoms.
00861 }
00862 else {
00863 #if 0
00864 node->pdb->find_extremes(&(xmin.x),&(xmax.x),lattice.a_r(),0.9);
00865 node->pdb->find_extremes(&(xmin.y),&(xmax.y),lattice.b_r(),0.9);
00866 node->pdb->find_extremes(&(xmin.z),&(xmax.z),lattice.c_r(),0.9);
00867 #endif
00868 node->pdb->find_extremes(lattice, 0.9);
00869 node->pdb->get_extremes(xmin, xmax);
00870 }
00871
00872 #if 0
00873 BigReal origin_shift;
00874 origin_shift = lattice.a_r() * lattice.origin();
00875 xmin.x -= origin_shift;
00876 xmax.x -= origin_shift;
00877 origin_shift = lattice.b_r() * lattice.origin();
00878 xmin.y -= origin_shift;
00879 xmax.y -= origin_shift;
00880 origin_shift = lattice.c_r() * lattice.origin();
00881 xmin.z -= origin_shift;
00882 xmax.z -= origin_shift;
00883 #endif
00884
00885 // SimParameters default is -1 for unset
00886 int twoAwayX = params->twoAwayX;
00887 int twoAwayY = params->twoAwayY;
00888 int twoAwayZ = params->twoAwayZ;
00889
00890 // SASA implementation is not compatible with twoAway patches
00891 if (params->LCPOOn) {
00892 if ( twoAwayX > 0 || twoAwayY > 0 || twoAwayZ > 0 ) {
00893 iout << iWARN << "Ignoring twoAway[XYZ] due to LCPO SASA implementation.\n" << endi;
00894 }
00895 twoAwayX = twoAwayY = twoAwayZ = 0;
00896 }
00897
00898 // if you think you know what you're doing go right ahead
00899 if ( twoAwayX > 0 ) maxNumPatches = 1.e9;
00900 if ( twoAwayY > 0 ) maxNumPatches = 1.e9;
00901 if ( twoAwayZ > 0 ) maxNumPatches = 1.e9;
00902 if ( params->maxPatches > 0 ) {
00903 maxNumPatches = params->maxPatches;
00904 iout << iINFO << "LIMITING NUMBER OF PATCHES TO " <<
00905 maxNumPatches << "\n" << endi;
00906 }
00907
00908 int numpes = CkNumPes();
00909 SimParameters *simparam = Node::Object()->simParameters;
00910 if(simparam->simulateInitialMapping) {
00911 numpes = simparam->simulatedPEs;
00912 delete [] patchMap->nPatchesOnNode;
00913 patchMap->nPatchesOnNode = new int[numpes];
00914 memset(patchMap->nPatchesOnNode, 0, numpes*sizeof(int));
00915 }
00916
00917 #ifdef NAMD_CUDA
00918 // for CUDA be sure there are more patches than pes
00919
00920 int numPatches = patchMap->sizeGrid(
00921 xmin,xmax,lattice,patchSize,maxNumPatches,params->staticAtomAssignment,
00922 twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
00923 if ( numPatches < numpes && twoAwayX < 0 ) {
00924 twoAwayX = 1;
00925 numPatches = patchMap->sizeGrid(
00926 xmin,xmax,lattice,patchSize,maxNumPatches,params->staticAtomAssignment,
00927 twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
00928 }
00929 if ( numPatches < numpes && twoAwayY < 0 ) {
00930 twoAwayY = 1;
00931 numPatches = patchMap->sizeGrid(
00932 xmin,xmax,lattice,patchSize,maxNumPatches,params->staticAtomAssignment,
00933 twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
00934 }
00935 if ( numPatches < numpes && twoAwayZ < 0 ) {
00936 twoAwayZ = 1;
00937 numPatches = patchMap->sizeGrid(
00938 xmin,xmax,lattice,patchSize,maxNumPatches,params->staticAtomAssignment,
00939 twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
00940 }
00941 if ( numPatches < numpes ) {
00942 NAMD_die("CUDA-enabled NAMD requires at least one patch per process.");
00943 }
00944 if ( numPatches % numpes && numPatches <= 1.4 * numpes ) {
00945 int exactFit = numPatches - numPatches % numpes;
00946 int newNumPatches = patchMap->sizeGrid(
00947 xmin,xmax,lattice,patchSize,exactFit,params->staticAtomAssignment,
00948 twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
00949 if ( newNumPatches == exactFit ) {
00950 iout << iINFO << "REDUCING NUMBER OF PATCHES TO IMPROVE LOAD BALANCE\n" << endi;
00951 maxNumPatches = exactFit;
00952 }
00953 }
00954
00955 patchMap->makePatches(xmin,xmax,lattice,patchSize,maxNumPatches,params->staticAtomAssignment,
00956 twoAwayX>0 ? 2 : 1, twoAwayY>0 ? 2 : 1, twoAwayZ>0 ? 2 : 1);
00957
00958 #else
00959
00960 int availPes = numpes;
00961 if ( params->noPatchesOnZero && numpes > 1 ) {
00962 availPes -= 1;
00963 if(params->noPatchesOnOne && numpes > 2)
00964 availPes -= 1;
00965 }
00966
00967 int numPatches = patchMap->sizeGrid(
00968 xmin,xmax,lattice,patchSize,1.e9,params->staticAtomAssignment,
00969 twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
00970 if ( ( numPatches > (0.3*availPes) || numPatches > maxNumPatches
00971 ) && twoAwayZ < 0 ) {
00972 twoAwayZ = 0;
00973 numPatches = patchMap->sizeGrid(
00974 xmin,xmax,lattice,patchSize,1.e9,params->staticAtomAssignment,
00975 twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
00976 }
00977 if ( ( numPatches > (0.6*availPes) || numPatches > maxNumPatches
00978 ) && twoAwayY < 0 ) {
00979 twoAwayY = 0;
00980 numPatches = patchMap->sizeGrid(
00981 xmin,xmax,lattice,patchSize,1.e9,params->staticAtomAssignment,
00982 twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
00983 }
00984 if ( ( numPatches > availPes || numPatches > maxNumPatches
00985 ) && twoAwayX < 0 ) {
00986 twoAwayX = 0;
00987 numPatches = patchMap->sizeGrid(
00988 xmin,xmax,lattice,patchSize,1.e9,params->staticAtomAssignment,
00989 twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
00990 }
00991 if ( numPatches > availPes && numPatches <= (1.4*availPes) && availPes <= maxNumPatches ) {
00992 int newNumPatches = patchMap->sizeGrid(
00993 xmin,xmax,lattice,patchSize,availPes,params->staticAtomAssignment,
00994 twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
00995 if ( newNumPatches <= availPes && numPatches <= (1.4*newNumPatches) ) {
00996 iout << iINFO << "REDUCING NUMBER OF PATCHES TO IMPROVE LOAD BALANCE\n" << endi;
00997 maxNumPatches = availPes;
00998 }
00999 }
01000
01001 patchMap->makePatches(xmin,xmax,lattice,patchSize,maxNumPatches,params->staticAtomAssignment,
01002 twoAwayX ? 2 : 1, twoAwayY ? 2 : 1, twoAwayZ ? 2 : 1);
01003
01004 #endif
01005
01006 }
|
|
|
Definition at line 120 of file WorkDistrib.C. References NAMD_bug(), ComputeMapChangeMsg::newNodes, ComputeMapChangeMsg::newNumPartitions, ComputeMap::numComputes(), ComputeMapChangeMsg::numNewNodes, ComputeMapChangeMsg::numNewNumPartitions, ComputeMap::Object(), ComputeMap::setNewNode(), and ComputeMap::setNewNumPartitions(). 00120 {
00121
00122 if ( ! CkMyRank() ) {
00123 ComputeMap *computeMap = ComputeMap::Object();
00124 int nc = computeMap->numComputes();
00125 if ( nc != msg->numNewNodes ) NAMD_bug("recvComputeMapChanges 1");
00126 int i;
00127 for(i=0; i<nc; i++)
00128 computeMap->setNewNode(i,msg->newNodes[i]);
00129 if ( msg->numNewNumPartitions ) {
00130 if ( nc != msg->numNewNumPartitions ) NAMD_bug("recvComputeMapChanges 2");
00131 for(i=0; i<nc; i++)
00132 computeMap->setNewNumPartitions(i,msg->newNumPartitions[i]);
00133 }
00134 }
00135
00136 delete msg;
00137
00138 CkCallback cb(CkIndex_WorkDistrib::doneSaveComputeMap(NULL), 0, thisgroup);
00139 contribute(NULL, 0, CkReduction::random, cb);
00140 }
|
|
|
Definition at line 656 of file WorkDistrib.C. References createAtomLists(), FullAtomList, PatchMap::numPatches(), PatchMap::Object(), and PatchMgr::sendAtoms(). 00656 {
00657
00658 PatchMap *patchMap = PatchMap::Object();
00659 CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
00660 PatchMgr *patchMgr = pm.ckLocalBranch();
00661
00662 int numPatches = patchMap->numPatches();
00663
00664 FullAtomList *atoms = createAtomLists();
00665
00666 for(int i=0; i < numPatches; i++) {
00667 patchMgr->sendAtoms(i,atoms[i]);
00668 }
00669
00670 delete [] atoms;
00671
00672 }
|
|
|
Definition at line 785 of file WorkDistrib.C. References ComputeMapMsg::computeMapData, ComputeMap::initPtrs(), NAMD_bug(), ComputeMapMsg::nComputes, ComputeMap::Object(), ComputeMap::saveComputeMap(), and ComputeMap::unpack(). 00786 {
00787 // Use a resend to forward messages before processing. Otherwise the
00788 // map distribution is slow on many CPUs. We need to use a tree
00789 // rather than a broadcast because some implementations of broadcast
00790 // generate a copy of the message on the sender for each recipient.
00791 // This is because MPI doesn't allow re-use of an outstanding buffer.
00792
00793 if ( CkMyRank() ) {
00794 NAMD_bug("WorkDistrib::saveComputeMap called on non-rank-zero pe");
00795 }
00796
00797 if ( computeMapArrived && CkMyPe() ) {
00798 ComputeMap::Object()->unpack(msg->nComputes, msg->computeMapData);
00799 }
00800
00801 if ( computeMapArrived ) {
00802 delete msg;
00803 ComputeMap::Object()->initPtrs();
00804 return;
00805 }
00806
00807 computeMapArrived = true;
00808
00809 int pids[3];
00810 int baseNid = 2 * CkMyNode() + 1;
00811 int npid = 0;
00812 if ( (baseNid+npid) < CkNumNodes() ) { pids[npid] = CkNodeFirst(baseNid + npid); ++npid; }
00813 if ( (baseNid+npid) < CkNumNodes() ) { pids[npid] = CkNodeFirst(baseNid + npid); ++npid; }
00814 pids[npid] = CkMyPe(); ++npid; // always send the message to ourselves
00815 CProxy_WorkDistrib(thisgroup).saveComputeMap(msg,npid,pids);
00816 }
|
|
||||||||||||
|
Definition at line 89 of file WorkDistrib.C. References ComputeMap::newNode(), ComputeMapChangeMsg::newNodes, ComputeMap::newNumPartitions(), ComputeMapChangeMsg::newNumPartitions, ComputeMap::numComputes(), ComputeMapChangeMsg::numNewNodes, ComputeMapChangeMsg::numNewNumPartitions, and ComputeMap::Object(). Referenced by ComputeMgr::updateComputes2(). 00090 {
00091 saveComputeMapReturnEP = ep;
00092 saveComputeMapReturnChareID = chareID;
00093
00094 ComputeMap *computeMap = ComputeMap::Object();
00095
00096 int i;
00097 int nc = computeMap->numComputes();
00098
00099 ComputeMapChangeMsg *mapMsg = new (nc, nc, 0) ComputeMapChangeMsg ;
00100
00101 mapMsg->numNewNodes = nc;
00102 for(i=0; i<nc; i++)
00103 mapMsg->newNodes[i] = computeMap->newNode(i);
00104 mapMsg->numNewNumPartitions = nc;
00105 for(i=0; i<nc; i++)
00106 mapMsg->newNumPartitions[i] = computeMap->newNumPartitions(i);
00107
00108 CProxy_WorkDistrib(thisgroup).recvComputeMapChanges(mapMsg);
00109
00110 /*
00111 // store the latest compute map
00112 SimParameters *simParams = Node::Object()->simParameters;
00113 if (simParams->storeComputeMap) {
00114 computeMap->saveComputeMap(simParams->computeMapFilename);
00115 CkPrintf("ComputeMap has been stored in %s.\n", simParams->computeMapFilename);
00116 }
00117 */
00118 }
|
|
|
Definition at line 712 of file WorkDistrib.C. References SimParameters::isSendSpanningTreeUnset(), PatchMap::numPatches(), ProxyMgr::Object(), PatchMap::Object(), PatchMapMsg::patchMapData, ProxyMgr::setSendSpanning(), Node::simParameters, and PatchMap::unpack(). 00713 {
00714 // Use a resend to forward messages before processing. Otherwise the
00715 // map distribution is slow on many CPUs. We need to use a tree
00716 // rather than a broadcast because some implementations of broadcast
00717 // generate a copy of the message on the sender for each recipient.
00718 // This is because MPI doesn't allow re-use of an outstanding buffer.
00719
00720 if ( CkMyRank() ) patchMapArrived = true;
00721
00722 if ( patchMapArrived && CkMyPe() ) {
00723 PatchMap::Object()->unpack(msg->patchMapData);
00724
00725 //Automatically enable spanning tree
00726 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00727 Node *node = nd.ckLocalBranch();
00728 SimParameters *params = node->simParameters;
00729 if( ( PatchMap::Object()->numPatches() <= CkNumPes()/4
00730 #ifdef NODEAWARE_PROXY_SPANNINGTREE
00731 || CkNumPes() > CkNumNodes()
00732 ) && ( CkNumNodes() > 1
00733 #endif
00734 ) && params->isSendSpanningTreeUnset() )
00735 ProxyMgr::Object()->setSendSpanning();
00736 }
00737
00738 if ( patchMapArrived ) {
00739 if ( CkMyRank() + 1 < CkNodeSize(CkMyNode()) ) {
00740 ((CProxy_WorkDistrib(thisgroup))[CkMyPe()+1]).savePatchMap(msg);
00741 } else {
00742 delete msg;
00743 }
00744 return;
00745 }
00746
00747 patchMapArrived = true;
00748
00749 int pids[3];
00750 int baseNid = 2 * CkMyNode() + 1;
00751 int npid = 0;
00752 if ( (baseNid+npid) < CkNumNodes() ) { pids[npid] = CkNodeFirst(baseNid + npid); ++npid; }
00753 if ( (baseNid+npid) < CkNumNodes() ) { pids[npid] = CkNodeFirst(baseNid + npid); ++npid; }
00754 pids[npid] = CkMyPe(); ++npid; // always send the message to ourselves
00755 CProxy_WorkDistrib(thisgroup).savePatchMap(msg,npid,pids);
00756 }
|
|
|
Definition at line 765 of file WorkDistrib.C. References ComputeMapMsg::computeMapData, ComputeMap::initPtrs(), ComputeMapMsg::nComputes, ComputeMap::numComputes(), ComputeMap::Object(), ComputeMap::pack(), and ComputeMap::saveComputeMap(). Referenced by Node::startup(). 00766 {
00767 if ( CkNumNodes() == 1 ) {
00768 computeMapArrived = true;
00769 ComputeMap::Object()->initPtrs();
00770 return;
00771 }
00772
00773 int size = ComputeMap::Object()->numComputes();
00774
00775 ComputeMapMsg *mapMsg = new (size, 0) ComputeMapMsg;
00776
00777 mapMsg->nComputes = size;
00778 ComputeMap::Object()->pack(mapMsg->computeMapData);
00779
00780 CProxy_WorkDistrib workProxy(thisgroup);
00781 workProxy[0].saveComputeMap(mapMsg);
00782 }
|
|
|
Definition at line 682 of file WorkDistrib.C. References SimParameters::isSendSpanningTreeUnset(), PatchMap::numPatches(), ProxyMgr::Object(), PatchMap::Object(), PatchMap::pack(), PatchMap::packSize(), PatchMapMsg::patchMapData, ProxyMgr::setSendSpanning(), and Node::simParameters. Referenced by Node::startup(). 00683 {
00684 if ( CkNumPes() == 1 ) {
00685 patchMapArrived = true;
00686 return;
00687 }
00688
00689 //Automatically enable spanning tree
00690 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00691 Node *node = nd.ckLocalBranch();
00692 SimParameters *params = node->simParameters;
00693 if( ( PatchMap::Object()->numPatches() <= CkNumPes()/4
00694 #ifdef NODEAWARE_PROXY_SPANNINGTREE
00695 || CkNumPes() > CkNumNodes()
00696 ) && ( CkNumNodes() > 1
00697 #endif
00698 ) && params->isSendSpanningTreeUnset() )
00699 ProxyMgr::Object()->setSendSpanning();
00700
00701 int size = PatchMap::Object()->packSize();
00702
00703 PatchMapMsg *mapMsg = new (size, 0) PatchMapMsg;
00704
00705 PatchMap::Object()->pack(mapMsg->patchMapData);
00706
00707 CProxy_WorkDistrib workProxy(thisgroup);
00708 workProxy[0].savePatchMap(mapMsg);
00709 }
|
|
|
Definition at line 91 of file WorkDistrib.h. Referenced by Node::startup(). 00091 {patchMapArrived=s;}
|
1.3.9.1