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

|
|
Definition at line 181 of file Node.C. References atomMap, colvars, configList, DebugM, eventEndOfTimeStep, GroupInitMsg::group, imd, ComputeMap::Instance(), AtomMap::Instance(), PatchMap::Instance(), molecule, NAMD_bug(), output, parameters, patchMap, pdb, simParameters, specialTracing, and state. 00182 {
00183 DebugM(4,"Creating Node\n");
00184 #if(CMK_CCS_AVAILABLE && CMK_WEB_MODE)
00185 CApplicationInit();
00186 #endif
00187 if (CkpvAccess(Node_instance) == 0) {
00188 CkpvAccess(Node_instance) = this;
00189 eventEndOfTimeStep = traceRegisterUserEvent("EndOfTimeStep");
00190 } else {
00191 NAMD_bug("Node::Node() - another instance of Node exists!");
00192 }
00193
00194 CkpvAccess(BOCclass_group) = msg->group;
00195 delete msg;
00196
00197 CkpvAccess(BOCclass_group).node = thisgroup;
00198
00199 startupPhase = 0;
00200
00201 molecule = NULL;
00202 parameters = NULL;
00203 simParameters = NULL;
00204 configList = NULL;
00205 pdb = NULL;
00206 state = NULL;
00207 output = NULL;
00208 imd = new IMDOutput;
00209 colvars = 0;
00210
00211 #if USE_HPM
00212 // assumes that this will be done only on BG/P
00213 TopoManager *tmgr = new TopoManager();
00214 int x, y, z;
00215 tmgr->rankToCoordinates(CkMyPe(), x, y, z, localRankOnNode);
00216 delete tmgr;
00217 #endif
00218
00219 specialTracing = traceAvailable() && (traceIsOn()==0);
00220
00221 DebugM(4,"Creating PatchMap, AtomMap, ComputeMap\n");
00222 patchMap = PatchMap::Instance();
00223 atomMap = AtomMap::Instance();
00224 if ( CkMyRank() == 0 ) ComputeMap::Instance();
00225
00226 //Note: Binding BOC vars such as workDistrib has been moved
00227 //to the 1st phase of startup because the in-order message delivery
00228 //is not always guaranteed --Chao Mei
00229 }
|
|
|
Definition at line 234 of file Node.C. 00235 {
00236 delete output;
00237 delete computeMap;
00238 delete atomMap;
00239 delete patchMap;
00240 delete CkpvAccess(comm);
00241 // BEGIN LA
00242 delete rand;
00243 // END LA
00244 #ifdef MEASURE_NAMD_WITH_PAPI
00245 delete CkpvAccess(papiEvents);
00246 #endif
00247 }
|
|
|
|
|
|
|
|
|
Definition at line 1027 of file Node.C. References BackEnd::exit(), iERROR(), and iout. 01027 {
01028 iout << iERROR << "Exiting prematurely; see error messages above.\n" << endi;
01029 BackEnd::exit();
01030 delete msg;
01031 }
|
|
|
Definition at line 1019 of file Node.C. References sendEnableEarlyExit(). Referenced by Sequencer::maximumMove(), Sequencer::rattle1(), and recvEnableEarlyExit(). 01019 {
01020 if ( CkMyPe() ) {
01021 sendEnableEarlyExit();
01022 } else {
01023 CkStartQD(CkIndex_Node::earlyExit((CkQdMsg*)0),&thishandle);
01024 }
01025 }
|
|
|
Definition at line 994 of file Node.C. References sendEnableExitScheduler(). Referenced by BackEnd::awaken(), and recvEnableExitScheduler(). 00994 {
00995 if ( CkMyPe() ) {
00996 sendEnableExitScheduler();
00997 } else {
00998 CkStartQD(CkIndex_Node::exitScheduler((CkQdMsg*)0),&thishandle);
00999 }
01000 }
|
|
|
Definition at line 881 of file Node.C. 00881 {
00882 CkStartQD(CkIndex_Node::scriptBarrier((CkQdMsg*)0),&thishandle);
00883 }
|
|
|
Definition at line 1002 of file Node.C. 01002 {
01003 //CmiPrintf("exitScheduler %d\n",CkMyPe());
01004 CsdExitScheduler();
01005 delete msg;
01006 }
|
|
|
Definition at line 178 of file Node.h. Referenced by Output::coordinate(), and Controller::printEnergies(). 00178 { return script; }
|
|
|
Definition at line 269 of file Node.C. References NAMD_die(). 00269 {
00270 int MB = 1024*1024;
00271 int size = 100;
00272 char* foo = (char*) malloc(size*MB);
00273 if ( ! foo ) {
00274 char buf[256];
00275 sprintf(buf,"Malloc fails on Pe %d at %d MB.\n",CkMyPe(),step*size);
00276 NAMD_die(buf);
00277 }
00278 memset(foo,0,size*MB*sizeof(char));
00279 }
|
|
|
Definition at line 281 of file Node.C. References mallocTest_size. 00281 {
00282 delete qmsg;
00283 if ( mallocTest_size ) {
00284 CkPrintf("All PEs successfully allocated %d MB.\n", 100*mallocTest_size);
00285 } else {
00286 CkPrintf("Starting malloc test on all PEs.\n");
00287 }
00288 fflush(stdout);
00289 ++mallocTest_size;
00290 CkStartQD(CkIndex_Node::mallocTestQd((CkQdMsg*)0),&thishandle);
00291 (CProxy_Node(CkpvAccess(BOCclass_group).node)).mallocTest(mallocTest_size);
00292 }
|
|
|
|
|
|
|
|
|
Definition at line 837 of file Node.C. Referenced by startup(). 00837 {
00838 (CProxy_Node(CkpvAccess(BOCclass_group).node)).run();
00839 }
|
|
|
Definition at line 297 of file Node.C. 00297 {
00298 (CProxy_Node(CkpvAccess(BOCclass_group).node)).startup();
00299 }
|
|
|
Definition at line 174 of file Node.h. Referenced by ComputeMgr::createComputes(), WorkDistrib::distributeHomePatches(), and LdbCoordinator::initialize(). 00174 { return CkMyPe(); }
|
|
|
Definition at line 175 of file Node.h. Referenced by WorkDistrib::assignNodeToPatch(), and LdbCoordinator::initialize(). 00175 { return CkNumPes(); }
|
|
|
||||||||||||
|
Definition at line 1133 of file Node.C. References Patch::getNumAtoms(), gNAMDBinaryName, PatchMap::gridsize_a(), PatchMap::gridsize_b(), PatchMap::gridsize_c(), NAMD_die(), ComputeMap::node(), PatchMap::node(), ComputeMap::numComputes(), PatchMap::numPatches(), ComputeMap::Object(), PatchMap::Object(), SimParameters::outputMaps, PatchMap::patch(), ComputeMap::pid(), simParameters, SimParameters::simulatedNodeSize, SimParameters::simulatedPEs, SimParameters::simulateInitialMapping, and ComputeMap::type(). Referenced by Controller::rebalanceLoad(), and startup(). 01133 {
01134 if(!simParameters->outputMaps && !simParameters->simulateInitialMapping) return;
01135
01136 int numpes = CkNumPes();
01137 int nodesize = CkMyNodeSize();
01138 if(simParameters->simulateInitialMapping) {
01139 numpes = simParameters->simulatedPEs;
01140 nodesize = simParameters->simulatedNodeSize;
01141 }
01142
01143 char fname[128];
01144 sprintf(fname, "mapdump_%s.%d_%d_%d_%s", filename, numpes, nodesize, tag, gNAMDBinaryName);
01145
01146 FILE *fp = fopen(fname, "w");
01147 if(fp == NULL) {
01148 NAMD_die("Error in outputing PatchMap and ComputeMap info!\n");
01149 return;
01150 }
01151 PatchMap *pMap = PatchMap::Object();
01152 ComputeMap *cMap = ComputeMap::Object();
01153 int numPatches = pMap->numPatches();
01154 int numComputes = cMap->numComputes();
01155 fprintf(fp, "%d %d %d %d %d %d %d\n", numpes, nodesize, numPatches, numComputes,
01156 pMap->gridsize_a(), pMap->gridsize_b(), pMap->gridsize_c());
01157 //output PatchMap info
01158 for(int i=0; i<numPatches; i++) {
01159 #ifdef MEM_OPT_VERSION
01160 fprintf(fp, "%d %d\n", pMap->numAtoms(i), pMap->node(i));
01161 #else
01162 fprintf(fp, "%d %d\n", pMap->patch(i)->getNumAtoms(), pMap->node(i));
01163 #endif
01164 }
01165
01166 //output ComputeMap info
01167 for(int i=0; i<numComputes; i++) {
01168 fprintf(fp, "%d %d %d %d\n", cMap->node(i), cMap->type(i), cMap->pid(i,0), cMap->pid(i,1));
01169 }
01170 }
|
|
||||||||||||
|
Definition at line 1084 of file Node.C. References curMFlopStep. 01084 {
01085 #ifdef MEASURE_NAMD_WITH_PAPI
01086 curMFlopStep = step;
01087 double results[NUM_PAPI_EVENTS];
01088
01089 if(turnOnMeasure){
01090 PAPI_start_counters(CkpvAccess(papiEvents), NUM_PAPI_EVENTS);
01091 }else{
01092 long long counters[NUM_PAPI_EVENTS];
01093 PAPI_read_counters(counters, NUM_PAPI_EVENTS);
01094 results[0] = (double)counters[0]/1e6;
01095 results[1] = (double)counters[1]/1e6;
01096 PAPI_stop_counters(counters, NUM_PAPI_EVENTS);
01097 }
01098 //CkPrintf("traceBarrier (%d) at step %d called on proc %d\n", turnOnTrace, step, CkMyPe());
01099 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
01100 CkCallback cb(CkIndex_Node::resumeAfterPapiMeasureBarrier(NULL), nd[0]);
01101 contribute(sizeof(double)*NUM_PAPI_EVENTS, &results, CkReduction::sum_double, cb);
01102 #endif
01103 }
|
|
|
Definition at line 1014 of file Node.C. References enableEarlyExit(). 01014 {
01015 delete msg;
01016 enableEarlyExit();
01017 }
|
|
|
Definition at line 988 of file Node.C. References enableExitScheduler(). 00988 {
00989 //CmiPrintf("recvEnableExitScheduler\n");
00990 delete msg;
00991 enableExitScheduler();
00992 }
|
|
||||||||||||
|
Definition at line 912 of file Node.C. References molecule, and Molecule::reloadCharges(). 00912 {
00913 molecule->reloadCharges(charge,n);
00914 }
|
|
|
Definition at line 895 of file Node.C. References molecule, NAMD_die(), Molecule::numAtoms, and Molecule::reloadCharges(). 00895 {
00896 FILE *file = fopen(filename,"r");
00897 if ( ! file ) NAMD_die("node::reloadCharges():Error opening charge file.");
00898
00899 int n = molecule->numAtoms;
00900 float *charge = new float[n];
00901
00902 for ( int i = 0; i < n; ++i ) {
00903 if ( ! fscanf(file,"%f",&charge[i]) )
00904 NAMD_die("Node::reloadCharges():Not enough numbers in charge file.");
00905 }
00906
00907 fclose(file);
00908 CProxy_Node(thisgroup).reloadCharges(charge,n);
00909 delete [] charge;
00910 }
|
|
|
Definition at line 946 of file Node.C. References ALLBUTME, BUFSIZE, DebugM, MOStream::end(), endi(), Molecule::get_gridfrc_grid(), GRIDFORCEGRIDTAG, molecule, NAMD_bug(), GridforceGrid::pack_grid(), Molecule::set_gridfrc_grid(), and GridforceGrid::unpack_grid(). 00946 {
00947 DebugM(4, "reloadGridforceGrid(int) called on node " << CkMyPe() << "\n" << endi);
00948
00949 GridforceGrid *grid = molecule->get_gridfrc_grid(gridnum);
00950 if (grid == NULL) {
00951 NAMD_bug("Node::reloadGridforceGrid(int):grid not found");
00952 }
00953
00954 if (CkMyPe()) {
00955 // not node 0 -> receive grid
00956 if (CmiMyRank()) return;
00957
00958 DebugM(4, "Receiving grid\n");
00959
00960 delete grid;
00961
00962 MIStream *msg = CkpvAccess(comm)->newInputStream(0, GRIDFORCEGRIDTAG);
00963 grid = GridforceGrid::unpack_grid(gridnum, msg);
00964 molecule->set_gridfrc_grid(gridnum, grid);
00965 delete msg;
00966 } else {
00967 // node 0 -> send grid
00968 DebugM(4, "Sending grid\n");
00969
00970 MOStream *msg = CkpvAccess(comm)->newOutputStream(ALLBUTME, GRIDFORCEGRIDTAG, BUFSIZE);
00971 GridforceGrid::pack_grid(grid, msg);
00972 msg->end();
00973 delete msg;
00974 }
00975
00976 DebugM(4, "reloadGridforceGrid(int) finished\n" << endi);
00977 }
|
|
|
Definition at line 918 of file Node.C. References DebugM, endi(), MGridforceParamsList::find_key(), Molecule::get_gridfrc_grid(), MGridforceParamsList::index_for_key(), SimParameters::mgridforcelist, MGRIDFORCEPARAMS_DEFAULTKEY, molecule, NAMD_bug(), NAMD_die(), GridforceGrid::reinitialize(), and simParameters. 00918 {
00919 DebugM(4, "reloadGridforceGrid(const char*) called on node " << CkMyPe() << "\n" << endi);
00920
00921 int gridnum;
00922 MGridforceParams *mgridParams;
00923 if (key == NULL) {
00924 gridnum = simParameters->mgridforcelist.index_for_key(MGRIDFORCEPARAMS_DEFAULTKEY);
00925 mgridParams = simParameters->mgridforcelist.find_key(MGRIDFORCEPARAMS_DEFAULTKEY);
00926 } else {
00927 gridnum = simParameters->mgridforcelist.index_for_key(key);
00928 mgridParams = simParameters->mgridforcelist.find_key(key);
00929 }
00930
00931 if (gridnum < 0 || mgridParams == NULL) {
00932 NAMD_die("Node::reloadGridforceGrid(const char*):Could not find grid.");
00933 }
00934
00935 GridforceGrid *grid = molecule->get_gridfrc_grid(gridnum);
00936 if (grid == NULL) {
00937 NAMD_bug("Node::reloadGridforceGrid(const char*):grid not found");
00938 }
00939 grid->reinitialize(simParameters, mgridParams);
00940
00941 CProxy_Node(thisgroup).reloadGridforceGrid(gridnum);
00942
00943 DebugM(4, "reloadGridforceGrid(const char*) finished\n" << endi);
00944 }
|
|
|
Definition at line 1105 of file Node.C. References NamdState::controller, curMFlopStep, simParameters, and state. 01105 {
01106 #ifdef MEASURE_NAMD_WITH_PAPI
01107 if(simParameters->papiMeasureStartStep != curMFlopStep) {
01108 double *results = (double *)msg->getData();
01109 int bstep = simParameters->papiMeasureStartStep;
01110 int estep = bstep + simParameters->numPapiMeasureSteps;
01111 if(CkpvAccess(papiEvents)[0] == PAPI_FP_INS){
01112 double totalFPIns = results[0];
01113 if(CkpvAccess(papiEvents)[1] == PAPI_FMA_INS) totalFPIns += (results[1]*2);
01114 CkPrintf("FLOPS INFO: from timestep %d to %d, the total FP instruction of NAMD is %lf(x1e6) per processor\n",
01115 bstep, estep, totalFPIns/CkNumPes());
01116 }else{
01117 char nameBuf[PAPI_MAX_STR_LEN];
01118 CkPrintf("PAPI COUNTERS INFO: from timestep %d to %d, ",
01119 bstep, estep);
01120 for(int i=0; i<NUM_PAPI_EVENTS; i++) {
01121 PAPI_event_code_to_name(CkpvAccess(papiEvents)[i], nameBuf);
01122 CkPrintf("%s is %lf(x1e6), ", nameBuf, results[i]/CkNumPes());
01123 }
01124 CkPrintf("per processor\n");
01125 }
01126 }
01127 delete msg;
01128 state->controller->resumeAfterPapiMeasureBarrier(curMFlopStep);
01129 #endif
01130 }
|
|
|
Definition at line 1078 of file Node.C. References NamdState::controller, curTimeStep, Controller::resumeAfterTraceBarrier(), and state. 01078 {
01079 CmiAssert(CmiMyPe()==0);
01080 delete msg;
01081 state->controller->resumeAfterTraceBarrier(curTimeStep);
01082 }
|
|
|
Definition at line 846 of file Node.C. References ResizeArrayIter< T >::begin(), DebugM, ResizeArrayIter< T >::end(), PatchMap::homePatchList(), HomePatchList, iINFO(), iout, memusage_MB(), PatchMap::Object(), NamdState::runController(), HomePatch::runSequencer(), startupTime, and state. 00847 {
00848 // Start Controller (aka scalar Sequencer) on Pe(0)
00849 // printf("\n\n I am in Node.C in run method about to call state->runController\n\n");
00850 if ( ! CkMyPe() ) {
00851 state->runController();
00852 }
00853
00854 DebugM(4, "Starting Sequencers\n");
00855 // Run Sequencer on each HomePatch - i.e. start simulation
00856 HomePatchList *hpl = PatchMap::Object()->homePatchList();
00857 ResizeArrayIter<HomePatchElem> ai(*hpl);
00858 for (ai=ai.begin(); ai != ai.end(); ai++) {
00859 HomePatch *patch = (*ai).patch;
00860 //CkPrintf("Proc#%d in Node calling Sequencer ",CkMyPe());
00861 patch->runSequencer();
00862 }
00863
00864 if (!CkMyPe()) {
00865 double newTime = CmiWallTimer();
00866 iout << iINFO << "Startup phase " << startupPhase-1 << " took "
00867 << newTime - startupTime << " s, "
00868 << memusage_MB() << " MB of memory in use\n";
00869 iout << iINFO << "Finished startup at " << newTime << " s, "
00870 << memusage_MB() << " MB of memory in use\n\n" << endi;
00871 fflush(stdout);
00872 }
00873
00874 }
|
|
|
Definition at line 1037 of file Node.C. References NamdState::configList, configList, NamdState::molecule, molecule, NamdState::parameters, parameters, NamdState::pdb, pdb, NamdState::simParameters, and simParameters. 01038 {
01039 this->molecule = state->molecule;
01040 this->parameters = state->parameters;
01041 this->simParameters = state->simParameters;
01042 this->configList = state->configList;
01043 this->pdb = state->pdb;
01044 this->state = state;
01045 }
|
|
|
Definition at line 885 of file Node.C. 00885 {
00886 delete qmsg;
00887 //script->awaken();
00888 }
|
|
|
Definition at line 890 of file Node.C. References ScriptParamMsg::param, SimParameters::scriptSet(), simParameters, and ScriptParamMsg::value. 00890 {
00891 simParameters->scriptSet(msg->param,msg->value);
00892 delete msg;
00893 }
|
|
|
Definition at line 1008 of file Node.C. Referenced by enableEarlyExit(). 01008 {
01009 CkQdMsg *msg = new CkQdMsg;
01010 CProxy_Node nodeProxy(thisgroup);
01011 nodeProxy[0].recvEnableEarlyExit(msg);
01012 }
|
|
|
Definition at line 981 of file Node.C. Referenced by enableExitScheduler(). 00981 {
00982 //CmiPrintf("sendEnableExitScheduler\n");
00983 CkQdMsg *msg = new CkQdMsg;
00984 CProxy_Node nodeProxy(thisgroup);
00985 nodeProxy[0].recvEnableExitScheduler(msg);
00986 }
|
|
|
Definition at line 177 of file Node.h. Referenced by after_backend_init(). 00177 { script = s; }
|
|
|
Definition at line 1048 of file Node.C. 01048 {
01049 #if USE_HPM
01050 HPM_Start("500 steps", localRankOnNode);
01051 #endif
01052 }
|
|
|
Definition at line 301 of file Node.C. 00301 {
00302 delete qmsg;
00303 (CProxy_Node(CkpvAccess(BOCclass_group).node)).startup();
00304 }
|
|
|
Definition at line 312 of file Node.C. References Lattice::a_p(), AtomMap::allocateMap(), WorkDistrib::assignNodeToPatch(), Lattice::b_p(), ProxyMgr::buildProxySpanningTree(), Lattice::c_p(), computeMap, computeMgr, ComputeMgr::createComputes(), WorkDistrib::createHomePatches(), LdbCoordinator::createLoadBalancer(), ProxyMgr::createProxies(), DebugM, WorkDistrib::distributeHomePatches(), PDB::get_extremes(), ProxyMgr::getRecvSpanning(), ProxyMgr::getSendSpanning(), iINFO(), LdbCoordinator::initialize(), iout, SimParameters::isRecvSpanningTreeOn(), SimParameters::isSendSpanningTreeOn(), SimParameters::lattice, SimParameters::mallocTest, mallocTest_size, WorkDistrib::mapComputes(), memusage_MB(), messageRun(), molecule, SimParameters::MSMOn, SimParameters::MsmSerialOn, NAMD_bug(), Molecule::numAtoms, ComputeMap::numComputes(), Sync::Object(), LdbCoordinator::Object(), ProxyMgr::Object(), AtomMap::Object(), ComputeMap::Object(), Sync::openSync(), output, outputPatchComputeMaps(), parameters, WorkDistrib::patchMapInit(), pdb, SimParameters::PMEOn, proxySendSpanning, SimParameters::proxyTreeBranchFactor, rand, SimParameters::randomSeed, registerUserEventsForAllComputeObjs(), ScaledPosition, WorkDistrib::sendComputeMap(), WorkDistrib::sendPatchMap(), WorkDistrib::setPatchMapArrived(), ProxyMgr::setProxyTreeBranchFactor(), ProxyMgr::setRecvSpanning(), ProxyMgr::setSendSpanning(), simParameters, SimParameters::simulatedNodeSize, SimParameters::simulatedPEs, SimParameters::simulateInitialMapping, MsmInitMsg::smax, MsmInitMsg::smin, Random::split(), startupTime, SimParameters::useNodeHelper, SimParameters::useOptPME, and workDistrib. 00312 {
00313 int gotoRun = false;
00314 double newTime;
00315
00316 if (!CkMyPe()) {
00317 if (!startupPhase) {
00318 iout << iINFO << "\n";
00319 startupTime = CmiWallTimer();
00320 iout << iINFO << "Entering startup at " << startupTime << " s, ";
00321 } else {
00322 newTime = CmiWallTimer();
00323 iout << iINFO << "Startup phase " << startupPhase-1 << " took "
00324 << newTime - startupTime << " s, ";
00325 startupTime = newTime;
00326 }
00327 iout << memusage_MB() << " MB of memory in use\n" << endi;
00328 fflush(stdout);
00329 }
00330
00331 switch (startupPhase) {
00332
00333 case 0:
00334 computeMap = ComputeMap::Object();
00335
00336 namdOneCommInit(); // Namd1.X style
00337 break;
00338
00339 case 1:
00340 bindBocVars();
00341
00342 // send & receive molecule, simparameters... (Namd1.X style)
00343 if (CkMyPe()) {
00344 namdOneRecv();
00345 } else {
00346 namdOneSend();
00347 }
00348 break;
00349
00350 case 2:
00351 // fix up one-per-node objects (for SMP version)
00352 simParameters = node_simParameters;
00353 parameters = node_parameters;
00354 molecule = node_molecule;
00355
00356 #if !CMK_SMP || ! USE_NODEHELPER
00357 //the NodeHelper library should be only used in SMP mode
00358 simParameters->useNodeHelper = 0;
00359 #endif
00360
00361
00362 if ( simParameters->mallocTest ) {
00363 if (!CkMyPe()) {
00364 mallocTest_size = 0;
00365 CkStartQD(CkIndex_Node::mallocTestQd((CkQdMsg*)0),&thishandle);
00366 }
00367 return;
00368 }
00369
00370
00371 #ifdef MEASURE_NAMD_WITH_PAPI
00372 if(simParameters->papiMeasure) namdInitPapiCounters();
00373 #endif
00374
00375 #ifdef MEM_OPT_VERSION
00376 //At this point, each Node object has received the simParameters,
00377 //parameters and the atom signatures info from the master Node
00378 //(proc 0). It's time to initialize the parallel IO manager and
00379 //read the binary per-atom file --Chao Mei
00380
00381 //Step 1: initialize the parallel IO manager per Node
00382 ioMgr->initialize(this);
00383
00384 //Step 2: read the binary per-atom files (signater index, coordinates etc.)
00385 ioMgr->readPerAtomInfo();
00386
00387 //Step 3: update counters of tuples and exclusions inside Molecule object
00388 ioMgr->updateMolInfo();
00389
00390 //Step 4: prepare distributing the atoms to neighboring procs if necessary
00391 ioMgr->migrateAtomsMGrp();
00392
00393 //step 5: initialize patchMap and send it to every other processors
00394 //to decide atoms to patch distribution on every input processor
00395 if(!CkMyPe()) {
00396 workDistrib->patchMapInit(); // create space division
00397 workDistrib->sendPatchMap();
00398 }
00399 #endif
00400
00401 #if USE_HPM
00402 HPM_Init(localRankOnNode);
00403 #endif
00404
00405 // take care of inital thread setting
00406 threadInit();
00407
00408 // create blank AtomMap
00409 AtomMap::Object()->allocateMap(molecule->numAtoms);
00410
00411 if (!CkMyPe()) {
00412 if (simParameters->useOptPME)
00413 CkpvAccess(BOCclass_group).computePmeMgr = CProxy_OptPmeMgr::ckNew();
00414 else
00415 CkpvAccess(BOCclass_group).computePmeMgr = CProxy_ComputePmeMgr::ckNew();
00416 #ifdef OPENATOM_VERSION
00417 if ( simParameters->openatomOn ) {
00418 CkpvAccess(BOCclass_group).computeMoaMgr = CProxy_ComputeMoaMgr::ckNew();
00419 }
00420 #endif // OPENATOM_VERSION
00421 }
00422
00423 #ifdef OPENATOM_VERSION
00424 if ( simParameters->openatomOn ) {
00425 // if ( ! CkMyPe() ) {
00426 CkCallback doneMoaStart(CkIndexmain::doneMoaSetup(), thishandle);
00427 startOA(simParameters->moaDriverFile, simParameters->moaPhysicsFile, doneMoaStart);
00428 // }
00429 }
00430 #endif // OPENATOM_VERSION
00431
00432 // BEGIN LA
00433 rand = new Random(simParameters->randomSeed);
00434 rand->split(CkMyPe(), CkNumPes());
00435 // END LA
00436
00437 break;
00438
00439 case 3:
00440 #ifdef MEM_OPT_VERSION
00441 //Now, every input proc has received all the atoms necessary
00442 //to decide the patches those atoms belong to
00443
00444 //step 1: integrate the migrated atoms into the atom list that
00445 //contains the initally distributed atoms, and sort the atoms
00446 //based on hydrogenList value
00447 ioMgr->integrateMigratedAtoms();
00448
00449 //step 2: integrate the cluster size of each atom on each output proc
00450 ioMgr->integrateClusterSize();
00451
00452 //step 3: calculate the number of atoms in each patch on every
00453 //input procs (atoms belonging to a patch may lie on different
00454 //procs), and reduce such info on proc 0. Such info is required
00455 //for determing which node a particular patch is assigned to.
00456 ioMgr->calcAtomsInEachPatch();
00457
00458 //set to false to re-send PatchMap later
00459 workDistrib->setPatchMapArrived(false);
00460 #endif
00461 break;
00462 case 4:
00463 if(simParameters->isSendSpanningTreeOn()) {
00464 ProxyMgr::Object()->setSendSpanning();
00465 ProxyMgr::Object()->setProxyTreeBranchFactor(simParameters->proxyTreeBranchFactor);
00466 }
00467 if(simParameters->isRecvSpanningTreeOn()) {
00468 ProxyMgr::Object()->setRecvSpanning();
00469 ProxyMgr::Object()->setProxyTreeBranchFactor(simParameters->proxyTreeBranchFactor);
00470 }
00471 #ifdef PROCTRACE_DEBUG
00472 DebugFileTrace::Instance("procTrace");
00473 #endif
00474
00475 if (!CkMyPe()) {
00476 output = new Output; // create output object just on PE(0)
00477
00478 #ifndef MEM_OPT_VERSION
00479 workDistrib->patchMapInit(); // create space division
00480 workDistrib->createHomePatches(); // load atoms into HomePatch(es)
00481 #endif
00482
00483 workDistrib->assignNodeToPatch();
00484 workDistrib->mapComputes();
00485 //ComputeMap::Object()->printComputeMap();
00486
00487 if(simParameters->simulateInitialMapping) {
00488 iout << iINFO << "Simulating initial mapping with " << simParameters->simulatedPEs
00489 << " PEs with " << simParameters->simulatedNodeSize << " PEs per node\n" << endi;
00490 outputPatchComputeMaps("init_mapping", 0);
00491 iout << iINFO << "Simulating initial mapping is done, now NAMD exits\n" << endi;
00492 CkExit();
00493 }
00494
00495 registerUserEventsForAllComputeObjs();
00496
00497 //in MEM_OPT_VERSION, patchMap is resent
00498 //because they have been updated since creation including
00499 //#atoms per patch, the proc a patch should stay etc. --Chao Mei
00500 workDistrib->sendPatchMap();
00501 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
00502 CProxy_NodeProxyMgr npm(CkpvAccess(BOCclass_group).nodeProxyMgr);
00503 //a node broadcast
00504 npm.createProxyInfo(PatchMap::Object()->numPatches());
00505 #endif
00506 }
00507 {
00508 #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
00509 CProxy_NodeProxyMgr npm(CkpvAccess(BOCclass_group).nodeProxyMgr);
00510 if(CkMyRank()==0) {
00511 //just need to register once
00512 npm[CkMyNode()].ckLocalBranch()->registerLocalProxyMgr(CkpvAccess(BOCclass_group).proxyMgr);
00513 }
00514 npm[CkMyNode()].ckLocalBranch()->registerLocalPatchMap(CkMyRank(), PatchMap::Object());
00515 #endif
00516 }
00517 break;
00518
00519 case 5:
00520 if ( simParameters->PMEOn ) {
00521 if ( simParameters->useOptPME ) {
00522 CProxy_OptPmeMgr pme(CkpvAccess(BOCclass_group).computePmeMgr);
00523 pme[CkMyPe()].initialize(new CkQdMsg);
00524 }
00525 else {
00526 #ifdef OPENATOM_VERSION
00527 if ( simParameters->openatomOn ) {
00528 CProxy_ComputeMoaMgr moa(CkpvAccess(BOCclass_group).computeMoaMgr);
00529 moa[CkMyPe()].initialize(new CkQdMsg);
00530 }
00531 #endif // OPENATOM_VERSION
00532 CProxy_ComputePmeMgr pme(CkpvAccess(BOCclass_group).computePmeMgr);
00533 pme[CkMyPe()].initialize(new CkQdMsg);
00534 }
00535 }
00536 #ifdef CHARM_HAS_MSA
00537 else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
00538 CProxy_ComputeMsmMsaMgr msm(CkpvAccess(BOCclass_group).computeMsmMsaMgr);
00539 msm[CkMyPe()].initialize(new CkQdMsg);
00540 }
00541 #else
00542 else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
00543 CProxy_ComputeMsmMgr msm(CkpvAccess(BOCclass_group).computeMsmMgr);
00544 MsmInitMsg *msg = new MsmInitMsg;
00545 Lattice lattice = simParameters->lattice; // system lattice vectors
00546 ScaledPosition smin=0, smax=0;
00547 if (lattice.a_p() && lattice.b_p() && lattice.c_p()) {
00548 msg->smin = smin;
00549 msg->smax = smax;
00550 msm[CkMyPe()].initialize(msg); // call from my own PE
00551 }
00552 else if ( ! CkMyPe() ) {
00553 pdb->get_extremes(smin, smax); // only available on PE 0
00554 msg->smin = smin;
00555 msg->smax = smax;
00556 msm.initialize(msg); // broadcast to chare group
00557 }
00558
00559 /*
00560 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
00561 Node *node = nd.ckLocalBranch();
00562 ScaledPosition smin, smax;
00563 node->pdb->get_extremes(smin, smax);
00564 msg->smin = smin; // extreme positions in system
00565 msg->smax = smax;
00566 msm[CkMyPe()].initialize(msg);
00567 */
00568 }
00569 #endif
00570
00571 if (!CkMyPe()) {
00572 workDistrib->sendComputeMap();
00573 }
00574
00575 #ifdef MEM_OPT_VERSION
00576 //migrate atoms to HomePatch processors
00577 ioMgr->sendAtomsToHomePatchProcs();
00578 #endif
00579 break;
00580
00581 case 6:
00582 if ( simParameters->PMEOn ) {
00583 if ( simParameters->useOptPME ) {
00584 CProxy_OptPmeMgr pme(CkpvAccess(BOCclass_group).computePmeMgr);
00585 pme[CkMyPe()].initialize_pencils(new CkQdMsg);
00586 }
00587 else {
00588 #ifdef OPENATOM_VERSION
00589 if ( simParameters->openatomOn ) {
00590 CProxy_ComputeMoaMgr moa(CkpvAccess(BOCclass_group).computeMoaMgr);
00591 moa[CkMyPe()].initWorkers(new CkQdMsg);
00592 }
00593 #endif // OPENATOM_VERSION
00594 CProxy_ComputePmeMgr pme(CkpvAccess(BOCclass_group).computePmeMgr);
00595 pme[CkMyPe()].initialize_pencils(new CkQdMsg);
00596 }
00597 }
00598 #ifdef CHARM_HAS_MSA
00599 else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
00600 CProxy_ComputeMsmMsaMgr msm(CkpvAccess(BOCclass_group).computeMsmMsaMgr);
00601 msm[CkMyPe()].initWorkers(new CkQdMsg);
00602 }
00603 #else
00604 else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
00605 CProxy_ComputeMsmMgr msm(CkpvAccess(BOCclass_group).computeMsmMgr);
00606 msm[CkMyPe()].update(new CkQdMsg);
00607 }
00608 #endif
00609
00610 #ifdef MEM_OPT_VERSION
00611 //Now every processor has all the atoms it needs to create the HomePatches.
00612 //The HomePatches are created in parallel on every home patch procs.
00613 ioMgr->createHomePatches();
00614 #else
00615 if (!CkMyPe()) {
00616 workDistrib->distributeHomePatches();
00617 }
00618 #endif
00619 break;
00620
00621 case 7:
00622 if ( simParameters->PMEOn ) {
00623 if ( simParameters->useOptPME ) {
00624 CProxy_OptPmeMgr pme(CkpvAccess(BOCclass_group).computePmeMgr);
00625 pme[CkMyPe()].activate_pencils(new CkQdMsg);
00626 }
00627 else {
00628 #ifdef OPENATOM_VERSION
00629 if ( simParameters->openatomOn ) {
00630 CProxy_ComputeMoaMgr moa(CkpvAccess(BOCclass_group).computeMoaMgr);
00631 moa[CkMyPe()].startWorkers(new CkQdMsg);
00632 }
00633 #endif // OPENATOM_VERSION
00634 CProxy_ComputePmeMgr pme(CkpvAccess(BOCclass_group).computePmeMgr);
00635 pme[CkMyPe()].activate_pencils(new CkQdMsg);
00636 }
00637 }
00638 #ifdef CHARM_HAS_MSA
00639 else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
00640 CProxy_ComputeMsmMsaMgr msm(CkpvAccess(BOCclass_group).computeMsmMsaMgr);
00641 msm[CkMyPe()].startWorkers(new CkQdMsg);
00642 }
00643 #else
00644 /*
00645 else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
00646 CProxy_ComputeMsmMgr msm(CkpvAccess(BOCclass_group).computeMsmMgr);
00647 //msm[CkMyPe()].startWorkers(new CkQdMsg);
00648 }
00649 */
00650 #endif
00651
00652 proxyMgr->createProxies(); // need Home patches before this
00653 if (!CkMyPe()) LdbCoordinator::Object()->createLoadBalancer();
00654
00655 #ifdef USE_NODEPATCHMGR
00656 //at this point, PatchMap info has been recved on PEs. It is time to create
00657 //the home patch spanning tree for receiving proxy list info
00658 if(proxyMgr->getSendSpanning() || proxyMgr->getRecvSpanning()) {
00659 if(CkMyRank()==0) {
00660 CProxy_NodeProxyMgr npm(CkpvAccess(BOCclass_group).nodeProxyMgr);
00661 npm[CkMyNode()].ckLocalBranch()->createSTForHomePatches(PatchMap::Object());
00662 }
00663 }
00664 #endif
00665
00666 break;
00667
00668 case 8:
00669 if (!CkMyPe()) {
00670 iout << iINFO << "CREATING " << ComputeMap::Object()->numComputes()
00671 << " COMPUTE OBJECTS\n" << endi;
00672 }
00673 DebugM(4,"Creating Computes\n");
00674 computeMgr->createComputes(ComputeMap::Object());
00675 DebugM(4,"Building Sequencers\n");
00676 buildSequencers();
00677 DebugM(4,"Initializing LDB\n");
00678 LdbCoordinator::Object()->initialize(PatchMap::Object(),ComputeMap::Object());
00679 break;
00680
00681 case 9:
00682 // computes may create proxies on the fly so put these in separate phase
00683 Sync::Object()->openSync(); // decide if to open local Sync
00684 if (proxySendSpanning || proxyRecvSpanning ) proxyMgr->buildProxySpanningTree();
00685 break;
00686
00687 case 10:
00688 {
00689 //For debugging
00690 /*if(!CkMyPe()){
00691 FILE *dumpFile = fopen("/tmp/NAMD_Bench.dump", "w");
00692 dumpbench(dumpFile);
00693 NAMD_die("Normal execution\n");
00694 }*/
00695 }
00696 #ifdef MEM_OPT_VERSION
00697 //free space in the Molecule object that are not used anymore
00698 ioMgr->freeMolSpace();
00699 #endif
00700 gotoRun = true;
00701 break;
00702
00703 default:
00704 NAMD_bug("Startup Phase has a bug - check case statement");
00705 break;
00706
00707 }
00708
00709 startupPhase++;
00710 if (!CkMyPe()) {
00711 if (!gotoRun) {
00712 CkStartQD(CkIndex_Node::startUp((CkQdMsg*)0),&thishandle);
00713 } else {
00714 Node::messageRun();
00715 }
00716 }
00717 }
|
|
|
Definition at line 1054 of file Node.C. 01054 {
01055 #if USE_HPM
01056 HPM_Stop("500 steps", localRankOnNode);
01057 HPM_Print(CkMyPe(), localRankOnNode);
01058 #endif
01059 }
|
|
||||||||||||
|
Definition at line 1061 of file Node.C. References curTimeStep. 01061 {
01062 curTimeStep = step;
01063 if(turnOnTrace) traceBegin();
01064 else traceEnd();
01065
01066 #if CHARM_VERSION > 60400
01067 if(turnOnTrace) CmiTurnOnStats();
01068 else CmiTurnOffStats();
01069 #endif
01070
01071 //CkPrintf("traceBarrier (%d) at step %d called on proc %d\n", turnOnTrace, step, CkMyPe());
01072 CProxy_Node nd(CkpvAccess(BOCclass_group).node);
01073 CkCallback cb(CkIndex_Node::resumeAfterTraceBarrier(NULL), nd[0]);
01074 contribute(0, NULL, CkReduction::sum_int, cb);
01075
01076 }
|
|
|
Definition at line 186 of file Node.h. Referenced by Node(). |
|
|
Definition at line 170 of file Node.h. Referenced by colvarproxy_namd::colvarproxy_namd(), and Node(). |
|
|
Definition at line 188 of file Node.h. Referenced by startup(). |
|
|
Definition at line 155 of file Node.h. Referenced by Sequencer::integrate(), and startup(). |
|
|
Definition at line 165 of file Node.h. Referenced by colvarproxy_namd::colvarproxy_namd(), WorkDistrib::createAtomLists(), GlobalMasterSymmetry::GlobalMasterSymmetry(), Node(), and saveMolDataPointers(). |
|
|
Definition at line 171 of file Node.h. Referenced by ScriptTcl::measure(), Tcl_centerOfMass(), Tcl_centerOfNumber(), Tcl_loadCoords(), and Tcl_radiusOfGyration(). |
|
|
Definition at line 142 of file Node.h. Referenced by papiMeasureBarrier(), and resumeAfterPapiMeasureBarrier(). |
|
|
Definition at line 137 of file Node.h. Referenced by resumeAfterTraceBarrier(), and traceBarrier(). |
|
|
Definition at line 169 of file Node.h. Referenced by Output::coordinate(), GlobalMasterIMD::get_vmd_forces(), GlobalMasterIMD::GlobalMasterIMD(), Node(), and Controller::printEnergies(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 115 of file Node.h. Referenced by mallocTestQd(), and startup(). |
|
|
|
Definition at line 168 of file Node.h. Referenced by CollectionMaster::disposeForces(), CollectionMaster::disposePositions(), CollectionMaster::disposeVelocities(), Node(), and startup(). |
|
|
Definition at line 163 of file Node.h. Referenced by ComputeNonbondedCUDA::doWork(), LJTable::LJTable(), ComputeHomeTuples< TholeElem, Thole, TholeValue >::loadTuples(), Node(), saveMolDataPointers(), ComputeNonbondedUtil::select(), and startup(). |
|
|
Definition at line 187 of file Node.h. Referenced by Node(). |
|
|
Definition at line 166 of file Node.h. Referenced by WorkDistrib::createAtomLists(), Node(), WorkDistrib::patchMapInit(), saveMolDataPointers(), and startup(). |
|
|
Definition at line 158 of file Node.h. Referenced by startup(). |
|
|
|
Definition at line 149 of file Node.h. Referenced by Sequencer::integrate(), Controller::integrate(), and Node(). |
|
|
Definition at line 167 of file Node.h. Referenced by Node(), resumeAfterPapiMeasureBarrier(), resumeAfterTraceBarrier(), and run(). |
|
|
Definition at line 152 of file Node.h. Referenced by ParallelIOMgr::createHomePatches(), and startup(). |
1.3.9.1