NAMD
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
Node Class Reference

#include <Node.h>

Inheritance diagram for Node:

Public Member Functions

 Node (GroupInitMsg *msg)
 
 ~Node (void)
 
void run ()
 
void enableScriptBarrier ()
 
void scriptBarrier (void)
 
void scriptParam (ScriptParamMsg *)
 
void reloadCharges (const char *filename)
 
void reloadCharges (float charge[], int n)
 
void reloadGridforceGrid (const char *key)
 
void reloadGridforceGrid (int gridnum)
 
void updateGridScale (const char *key, Vector scale)
 
void updateGridScale (int gridnum, float sx, float sy, float sz)
 
void reloadStructure (const char *, const char *)
 
void resendMolecule ()
 
void resendMolecule2 ()
 
void sendCheckpointReq (int remote, const char *key, int task, Lattice &lat, ControllerState &cs)
 
void recvCheckpointReq (CheckpointMsg *)
 
void recvCheckpointAck (CheckpointMsg *)
 
void sendEnableExitScheduler (void)
 
void recvEnableExitScheduler (void)
 
void enableExitScheduler (void)
 
void exitScheduler (void)
 
void sendEnableEarlyExit (void)
 
void recvEnableEarlyExit (void)
 
void enableEarlyExit (void)
 
void earlyExit (void)
 
void startup ()
 
void mallocTest (int)
 
void mallocTestQd (void)
 
float measureMemory ()
 
void BOCCheckIn ()
 
void awaitBOCCheckIn ()
 
void saveMolDataPointers (NamdState *)
 
void startHPM ()
 
void stopHPM ()
 
void traceBarrier (int turnOnTrace, int step)
 
void resumeAfterTraceBarrier (CkReductionMsg *msg)
 
void papiMeasureBarrier (int turnOnMeasure, int step)
 
void resumeAfterPapiMeasureBarrier (CkReductionMsg *msg)
 
void outputPatchComputeMaps (const char *filename, int tag)
 
ScriptTclgetScript ()
 
int myid ()
 
int numNodes ()
 
void setScript (ScriptTcl *s)
 

Static Public Member Functions

static NodeObject ()
 
static NodeObjectOnPe (int pe)
 
static void messageRun ()
 
static void messageStartUp ()
 
static void messageBOCCheckIn ()
 

Public Attributes

int mallocTest_size
 
float initVM
 
float initRSS
 
int curTimeStep
 
int curMFlopStep
 
bool specialTracing
 
WorkDistribworkDistrib
 
ComputeMgrcomputeMgr
 
Randomrand
 
Moleculemolecule
 
Parametersparameters
 
SimParameterssimParameters
 
ConfigListconfigList
 
PDBpdb
 
NamdStatestate
 
Outputoutput
 
IMDOutputimd
 
colvarmodule * colvars
 
Vectorcoords
 

Protected Attributes

AtomMapatomMap
 
PatchMappatchMap
 
ComputeMapcomputeMap
 
LdbCoordinatorldbCoordinator
 

Detailed Description

Definition at line 78 of file Node.h.

Constructor & Destructor Documentation

◆ Node()

Node::Node ( GroupInitMsg msg)

Definition at line 298 of file Node.C.

References atomMap, colvars, configList, DebugM, eventEndOfTimeStep, GroupInitMsg::group, imd, PatchMap::Instance(), AtomMap::Instance(), ComputeMap::Instance(), molecule, NAMD_bug(), output, parameters, patchMap, pdb, recvCheckpointCAck_handler(), recvCheckpointCReq_handler(), simParameters, specialTracing, and state.

299 {
300  DebugM(4,"Creating Node\n");
301 #if(CMK_CCS_AVAILABLE && CMK_WEB_MODE)
302  CApplicationInit();
303 #endif
304  if (CkpvAccess(Node_instance) == 0) {
305  CkpvAccess(Node_instance) = this;
306  eventEndOfTimeStep = traceRegisterUserEvent("EndOfTimeStep", 135);
307  } else {
308  NAMD_bug("Node::Node() - another instance of Node exists!");
309  }
310 
311  CkpvAccess(BOCclass_group) = msg->group;
312  delete msg;
313 
314  CkpvAccess(BOCclass_group).node = thisgroup;
315 
316  recvCheckpointCReq_index = CmiRegisterHandler((CmiHandler)recvCheckpointCReq_handler);
317  recvCheckpointCAck_index = CmiRegisterHandler((CmiHandler)recvCheckpointCAck_handler);
318 
319  startupPhase = 0;
320 
321  molecule = NULL;
322  parameters = NULL;
323  simParameters = NULL;
324  configList = NULL;
325  pdb = NULL;
326  state = NULL;
327  output = NULL;
328  imd = new IMDOutput;
329  colvars = 0;
330 
331 #if USE_HPM
332  // assumes that this will be done only on BG/P
333  TopoManager *tmgr = new TopoManager();
334  int x, y, z;
335  tmgr->rankToCoordinates(CkMyPe(), x, y, z, localRankOnNode);
336  delete tmgr;
337 #endif
338 
339  specialTracing = traceAvailable() && (traceIsOn()==0);
340 
341  DebugM(4,"Creating PatchMap, AtomMap, ComputeMap\n");
344  if ( CkMyRank() == 0 ) ComputeMap::Instance();
345 
346  //Note: Binding BOC vars such as workDistrib has been moved
347  //to the 1st phase of startup because the in-order message delivery
348  //is not always guaranteed --Chao Mei
349 #if defined(CMK_BALANCED_INJECTION_API) && CMK_BALANCED_INJECTION_API != 0
350  if(CkMyRank() == 0){
351  balancedInjectionLevel=ck_get_GNI_BIConfig();
352  // CkPrintf("[%d] get retrieved BI=%d\n",CkMyPe(),balancedInjectionLevel);
353  ck_set_GNI_BIConfig(20);
354  // CkPrintf("[%d] set retrieved BI=%d\n",CkMyPe(),ck_get_GNI_BIConfig());
355  }
356 #endif
357 
358 }
bool specialTracing
Definition: Node.h:166
void recvCheckpointCReq_handler(envelope *)
Definition: Node.C:1337
BOCgroup group
Definition: Node.h:68
IMDOutput * imd
Definition: Node.h:186
static AtomMap * Instance()
Definition: AtomMap.C:125
Output * output
Definition: Node.h:185
SimParameters * simParameters
Definition: Node.h:181
#define DebugM(x, y)
Definition: Debug.h:75
void NAMD_bug(const char *err_msg)
Definition: common.C:195
NamdState * state
Definition: Node.h:184
AtomMap * atomMap
Definition: Node.h:202
PDB * pdb
Definition: Node.h:183
ConfigList * configList
Definition: Node.h:182
Parameters * parameters
Definition: Node.h:180
static ComputeMap * Instance()
Definition: ComputeMap.C:24
void recvCheckpointCAck_handler(envelope *)
Definition: Node.C:1359
PatchMap * patchMap
Definition: Node.h:203
colvarmodule * colvars
Definition: Node.h:187
int eventEndOfTimeStep
Definition: Node.C:293
static PatchMap * Instance()
Definition: PatchMap.C:32
Molecule * molecule
Definition: Node.h:179

◆ ~Node()

Node::~Node ( void  )

Definition at line 363 of file Node.C.

References atomMap, computeMap, imd, output, patchMap, and rand.

364 {
365  delete imd;
366  delete output;
367  delete computeMap;
368  delete atomMap;
369  delete patchMap;
370  delete CkpvAccess(comm);
371  // BEGIN LA
372  delete rand;
373  // END LA
374 #ifdef MEASURE_NAMD_WITH_PAPI
375  delete CkpvAccess(papiEvents);
376 #endif
377 }
IMDOutput * imd
Definition: Node.h:186
Output * output
Definition: Node.h:185
ComputeMap * computeMap
Definition: Node.h:204
AtomMap * atomMap
Definition: Node.h:202
Random * rand
Definition: Node.h:175
PatchMap * patchMap
Definition: Node.h:203

Member Function Documentation

◆ awaitBOCCheckIn()

void Node::awaitBOCCheckIn ( )

◆ BOCCheckIn()

void Node::BOCCheckIn ( )

◆ earlyExit()

void Node::earlyExit ( void  )

Definition at line 1412 of file Node.C.

References NAMD_die().

1412  {
1413  NAMD_die("Exiting prematurely; see error messages above.");
1414 }
void NAMD_die(const char *err_msg)
Definition: common.C:147

◆ enableEarlyExit()

void Node::enableEarlyExit ( void  )

Definition at line 1404 of file Node.C.

References sendEnableEarlyExit().

Referenced by Sequencer::hardWallDrude(), Sequencer::maximumMove(), Sequencer::maximumMove_SOA(), Sequencer::rattle1(), Sequencer::rattle1_SOA(), and recvEnableEarlyExit().

1404  {
1405  if ( CkMyPe() ) {
1407  } else {
1408  CkStartQD(CkIndex_Node::earlyExit(),&thishandle);
1409  }
1410 }
void sendEnableEarlyExit(void)
Definition: Node.C:1395

◆ enableExitScheduler()

void Node::enableExitScheduler ( void  )

Definition at line 1382 of file Node.C.

References sendEnableExitScheduler().

Referenced by BackEnd::awaken(), and recvEnableExitScheduler().

1382  {
1383  if ( CkMyPe() ) {
1385  } else {
1386  CkStartQD(CkIndex_Node::exitScheduler(), &thishandle);
1387  }
1388 }
void sendEnableExitScheduler(void)
Definition: Node.C:1371

◆ enableScriptBarrier()

void Node::enableScriptBarrier ( )

Definition at line 1154 of file Node.C.

1154  {
1155  CkStartQD(CkIndex_Node::scriptBarrier(), &thishandle);
1156 }

◆ exitScheduler()

void Node::exitScheduler ( void  )

Definition at line 1390 of file Node.C.

1390  {
1391  //CmiPrintf("exitScheduler %d\n",CkMyPe());
1392  CsdExitScheduler();
1393 }

◆ getScript()

ScriptTcl * Node::getScript ( void  )

Definition at line 1599 of file Node.C.

References PatchData::script.

Referenced by Output::coordinate(), and Controller::printEnergies().

1599  {
1600 #ifndef NODEGROUP_FORCE_REGISTER
1601  return script;
1602 #else
1603  if(script == NULL){
1604  CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1605  PatchData* patchData = cpdata.ckLocalBranch();
1606  return patchData->script;
1607  }else{
1608  return script;
1609  }
1610 #endif
1611 }
ScriptTcl * script
Definition: PatchData.h:154

◆ mallocTest()

void Node::mallocTest ( int  step)

Definition at line 400 of file Node.C.

References NAMD_die().

Referenced by mallocTestQd().

400  {
401  int MB = 1024*1024;
402  int size = 100;
403  char* foo = (char*) malloc(size*MB);
404  if ( ! foo ) {
405  char buf[256];
406  sprintf(buf,"Malloc fails on Pe %d at %d MB.\n",CkMyPe(),step*size);
407  NAMD_die(buf);
408  }
409  memset(foo,0,size*MB*sizeof(char));
410 }
void NAMD_die(const char *err_msg)
Definition: common.C:147

◆ mallocTestQd()

void Node::mallocTestQd ( void  )

Definition at line 412 of file Node.C.

References mallocTest(), and mallocTest_size.

412  {
413  if ( mallocTest_size ) {
414  CkPrintf("All PEs successfully allocated %d MB.\n", 100*mallocTest_size);
415  } else {
416  CkPrintf("Starting malloc test on all PEs.\n");
417  }
418  fflush(stdout);
419  ++mallocTest_size;
420  CkStartQD(CkIndex_Node::mallocTestQd(), &thishandle);
421  (CProxy_Node(CkpvAccess(BOCclass_group).node)).mallocTest(mallocTest_size);
422 }
void mallocTest(int)
Definition: Node.C:400
int mallocTest_size
Definition: Node.h:130

◆ measureMemory()

float Node::measureMemory ( )

◆ messageBOCCheckIn()

static void Node::messageBOCCheckIn ( )
static

◆ messageRun()

void Node::messageRun ( )
static

Definition at line 1107 of file Node.C.

References run().

Referenced by startup().

1107  {
1108  (CProxy_Node(CkpvAccess(BOCclass_group).node)).run();
1109 }
void run()
Definition: Node.C:1116

◆ messageStartUp()

void Node::messageStartUp ( )
static

Definition at line 427 of file Node.C.

References startup().

427  {
428  (CProxy_Node(CkpvAccess(BOCclass_group).node)).startup();
429 }
void startup()
Definition: Node.C:437

◆ myid()

int Node::myid ( )
inline

Definition at line 191 of file Node.h.

Referenced by ComputeMgr::createComputes(), WorkDistrib::distributeHomePatches(), and LdbCoordinator::initialize().

191 { return CkMyPe(); }

◆ numNodes()

int Node::numNodes ( )
inline

Definition at line 192 of file Node.h.

Referenced by WorkDistrib::assignNodeToPatch(), and LdbCoordinator::initialize().

192 { return CkNumPes(); }

◆ Object()

static Node* Node::Object ( )
inlinestatic

Definition at line 86 of file Node.h.

Referenced by HomePatch::addForceToMomentum(), HomePatch::addForceToMomentum3(), Sequencer::addMovDragToPosition(), Sequencer::addRotDragToPosition(), HomePatch::addVelocityToPosition(), after_backend_init(), Controller::algorithm(), CollectionMaster::CollectVectorInstanceDcdSelection::append(), WorkDistrib::assignNodeToPatch(), BackEnd::awaken(), PmeZPencil::backward_fft(), PmeYPencil::backward_fft(), PmeXPencil::backward_fft(), HomePatch::boxClosed(), HomePatch::buildRattleList(), HomePatch::buildRattleList_SOA(), ComputeQMMgr::calcMOPAC(), ComputeQMMgr::calcORCA(), Controller::calcPressure(), colvarproxy_namd::calculate(), ComputeQMMgr::calcUSR(), ComputePmeMgr::chargeGridSubmitted(), colvarproxy_namd::check_atom_id(), colvarproxy_namd::check_volmap_by_id(), ComputeGridForce::checkGridForceRatio(), CudaPmeOneDevice::checkPatchLevelLatticeCompatibilityAndComputeOffsets(), SimParameters::close_dcdfile(), SimParameters::close_veldcdfile(), colvarproxy_namd::colvarproxy_namd(), Controller::compareChecksums(), CudaPmeOneDevice::compute(), colvarproxy_namd::compute_volmap(), ComputeCylindricalBC::ComputeCylindricalBC(), ComputeEwald::ComputeEwald(), AngleElem::computeForce(), ImproperElem::computeForce(), CrosstermElem::computeForce(), DihedralElem::computeForce(), TholeElem::computeForce(), AnisoElem::computeForce(), BondElem::computeForce(), ExclElem::computeForce(), GromacsPairElem::computeForce(), ComputeFullDirect::ComputeFullDirect(), ComputeGlobal::ComputeGlobal(), ComputeHomeTuples< TholeElem, Thole, TholeValue >::ComputeHomeTuples(), ComputeLCPO::ComputeLCPO(), ComputeMsm::ComputeMsm(), LjPmeCompute::computeNonbonded(), ComputeNonbondedPair::ComputeNonbondedPair(), ComputeNonbondedSelf::ComputeNonbondedSelf(), ComputePme::ComputePme(), ComputeRestraints::ComputeRestraints(), ComputeSphericalBC::ComputeSphericalBC(), ComputeStir::ComputeStir(), ComputeTclBC::ComputeTclBC(), Controller::Controller(), Output::coordinate(), Output::coordinateNeeded(), ComputeMgr::createComputes(), ComputeCUDAMgr::createCudaComputeNonbonded(), ComputeCUDAMgr::createCudaGlobalMaster(), ComputeCUDAMgr::createCudaPmeOneDevice(), ComputeGridForce::createGridForcedIdxList(), ParallelIOMgr::createHomePatches(), LdbCoordinator::createLoadBalancer(), CudaComputeNonbonded::CudaComputeNonbonded(), CudaPmeOneDevice::CudaPmeOneDevice(), HomePatch::depositMigration(), CollectionMaster::disposeForces(), CollectionMaster::disposePositions(), CollectionMaster::disposeVelocities(), ComputeConsForce::doForce(), ComputeEField::doForce(), ComputeConsTorque::doForce(), ComputeStir::doForce(), ComputeNonbondedPair::doForce(), ComputeNonbondedSelf::doForce(), ComputeGridForce::doForce(), ComputeRestraints::doForce(), HomePatch::doGroupSizeCheck(), HomePatch::doGroupSizeCheck_SOA(), HomePatch::doMarginCheck(), HomePatch::doMarginCheck_SOA(), HomePatch::doPairlistCheck(), ComputePme::doQMWork(), ComputeTclBC::doWork(), ComputeGBISser::doWork(), ComputeGlobal::doWork(), CudaComputeNonbonded::doWork(), ComputeHomeTuples< TholeElem, Thole, TholeValue >::doWork(), dumpbench(), HomePatch::exchangeAtoms(), HomePatch::exchangeCheckpoint(), CudaPmeOneDevice::finishReduction(), Output::force(), Patch::forceBoxClosed(), Output::forceNeeded(), PmeZPencil::forward_fft(), PmeYPencil::forward_fft(), PmeXPencil::forward_fft(), ComputePmeCUDADevice::gatherForce(), ComputePmeCUDADevice::gatherForceDone(), HomePatch::gbisComputeAfterP1(), HomePatch::gbisComputeAfterP2(), GlobalMasterIMD::get_vmd_forces(), ComputeLjPmeSerialMgr::getLJparameters(), Controller::getTotalPotentialEnergy(), GlobalMasterEasy::GlobalMasterEasy(), GlobalMasterFreeEnergy::GlobalMasterFreeEnergy(), GlobalMasterIMD::GlobalMasterIMD(), GlobalMasterServer::GlobalMasterServer(), GlobalMasterSymmetry::GlobalMasterSymmetry(), GlobalMasterTMD::GlobalMasterTMD(), ComputePmeMgr::gridCalc2R(), Sequencer::hardWallDrude(), HomePatch::hardWallDrude(), colvarproxy_namd::init_atom_group(), colvarproxy_namd::init_atoms_map(), colvarproxy_namd::init_tcl_pointers(), colvarproxy_namd::init_volmap_by_name(), ComputePmeCUDA::initialize(), LjPmeCompute::initialize(), LdbCoordinator::initialize(), ComputeQM::initialize(), CudaComputeNonbonded::initialize(), ComputeMsmMgr::initialize(), ComputePmeMgr::initialize(), ComputePmeCUDADevice::initialize(), ComputePmeMgr::initialize_computes(), ComputePmeMgr::initialize_pencils(), Controller::integrate(), Sequencer::integrate(), Sequencer::integrate_SOA(), isPmeProcessor(), Sequencer::langevinPiston(), Sequencer::langevinVelocities(), Sequencer::langevinVelocitiesBBK1(), Sequencer::langevinVelocitiesBBK2(), CudaComputeNonbonded::launchWork(), LJTable::LJTable(), ComputeHomeTuples< TholeElem, Thole, TholeValue >::loadTuples(), HomePatch::loweAndersenVelocities(), WorkDistrib::mapComputes(), Sequencer::maximumMove(), Sequencer::maximumMove_SOA(), ScriptTcl::measure(), ComputePmeCUDADevice::mergeForcesOnPatch(), Sequencer::minimize(), HomePatch::minimize_rattle2(), HomePatch::mollyAverage(), HomePatch::mollyMollify(), Controller::monteCarloPressure_accept(), Controller::multigatorCalcEnthalpy(), NAMD_bug(), NAMD_die(), NAMD_err(), NAMD_quit(), NamdHybridLB::NamdHybridLB(), CudaComputeNonbonded::openBoxesOnPe(), PmePencil< CBase_PmeZPencil >::order_init(), Patch::Patch(), PatchDataSOA_set_buffer(), PatchDataSOA_set_size(), WorkDistrib::patchMapInit(), Compute::patchReady(), PmeXPencil::pme_kspace(), Patch::positionsReady(), HomePatch::positionsReady(), HomePatch::positionsReady_SOA(), Controller::printEnergies(), Controller::printMinimizeEnergies(), HomePatch::qmSwapAtoms(), Sequencer::rattle1(), HomePatch::rattle1(), Sequencer::rattle1_SOA(), HomePatch::rattle1_SOA(), HomePatch::rattle1old(), HomePatch::rattle2(), LdbCoordinator::rebalance(), Controller::rebalanceLoad(), ProxyPatch::receiveAll(), ProxyPatch::receiveData(), CollectionMaster::receiveDataStream(), CollectionMaster::receiveForces(), CollectionMaster::receivePositions(), CollectionMaster::receivePositionsDcdSelection(), Controller::receivePressure(), CollectionMaster::receiveVelocities(), recursive_bisect_with_curve(), ComputePmeCUDADevice::recvAtoms(), ParallelIOMgr::recvAtomsCntPerPatch(), ComputePmeCUDADevice::recvAtomsFromNeighbor(), recvCheckpointCAck_handler(), recvCheckpointCReq_handler(), HomePatch::recvCheckpointLoad(), ComputeMgr::recvComputeConsForceMsg(), ComputeMsmSerialMgr::recvCoord(), ComputeExtMgr::recvCoord(), ComputeLjPmeSerialMgr::recvCoord(), ComputeFmmSerialMgr::recvCoord(), ComputeGBISserMgr::recvCoord(), ComputeMgr::recvCudaGlobalMasterCreateMsg(), ComputeMgr::recvCudaGlobalMasterRemoveMsg(), ComputeMgr::recvCudaGlobalMasterUpdateMsg(), HomePatch::recvExchangeMsg(), ComputeQMMgr::recvPartQM(), ComputeQMMgr::recvPntChrg(), recvReplicaDcdData(), recvReplicaDcdInit(), ComputeGlobal::recvResults(), Sequencer::reloadCharges(), Controller::rescaleaccelMD(), Sequencer::rescaleSoluteCharges(), CudaComputeNonbonded::reSortTileLists(), HomePatch::revert(), ScriptTcl::run(), ComputeQM::saveResults(), ComputeGlobal::saveTotalForces(), ComputePmeUtil::select(), ComputeNonbondedUtil::select(), PmeZPencil::send_all_ungrid(), PmeZPencil::send_trans(), PmeYPencil::send_trans(), PmeYPencil::send_untrans(), PmeXPencil::send_untrans(), ComputePmeCUDADevice::sendAtomsToNeighbor(), ComputeMgr::sendComputeGlobalData(), ComputeMgr::sendComputeGlobalResults(), ComputePmeCUDADevice::sendForcesToNeighbors(), ComputePmeMgr::sendTrans(), ComputePmeMgr::sendUngrid(), ComputePmeMgr::sendUntrans(), HomePatch::setGBISIntrinsicRadii(), PatchMgr::setLattice(), HomePatch::setLcpoType(), ComputeLjPmeSerialMgr::setLJparameters(), ComputePmeCUDAMgr::setupPencils(), NamdHybridLB::splitComputes(), ComputePmeCUDADevice::spreadCharge(), CollectionMaster::startNextRoundOutputForce(), CollectionMaster::startNextRoundOutputPos(), CollectionMaster::startNextRoundOutputVel(), NamdCentLB::Strategy(), CollectionMgr::submitForces(), CollectionMgr::submitPositions(), PmePencilXYZ::submitReductions(), PmePencilZ::submitReductions(), ComputePmeMgr::submitReductions(), CollectionMgr::submitVelocities(), Tcl_centerOfMass(), Tcl_centerOfNumber(), Tcl_loadCoords(), Tcl_radiusOfGyration(), Sequencer::tcoupleVelocities(), ComputePme::ungridForces(), colvarproxy_namd::update_accelMD_info(), colvarproxy_namd::update_atom_properties(), colvarproxy_namd::update_atoms_map(), colvarproxy_namd::update_group_properties(), ComputeLonepairsCUDA::updateAtoms(), ComputeMgr::updateLocalComputes4(), Output::velocity(), Output::velocityNeeded(), wrap_coor_int(), wrap_coor_int_dcd_selection(), and CollectionMaster::wrapCoorFinished().

86 {return CkpvAccess(Node_instance);}

◆ ObjectOnPe()

static Node* Node::ObjectOnPe ( int  pe)
inlinestatic

Definition at line 87 of file Node.h.

87 {return CkpvAccessOther(Node_instance, CmiRankOf(pe));}

◆ outputPatchComputeMaps()

void Node::outputPatchComputeMaps ( const char *  filename,
int  tag 
)

Definition at line 1560 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(), PatchMap::Object(), ComputeMap::Object(), SimParameters::outputMaps, PatchMap::patch(), ComputeMap::pid(), simParameters, SimParameters::simulatedNodeSize, SimParameters::simulatedPEs, SimParameters::simulateInitialMapping, and ComputeMap::type().

Referenced by Controller::rebalanceLoad(), and startup().

1560  {
1562 
1563  int numpes = CkNumPes();
1564  int nodesize = CkMyNodeSize();
1566  numpes = simParameters->simulatedPEs;
1567  nodesize = simParameters->simulatedNodeSize;
1568  }
1569 
1570  char fname[128];
1571  sprintf(fname, "mapdump_%s.%d_%d_%d_%s", filename, numpes, nodesize, tag, gNAMDBinaryName);
1572 
1573  FILE *fp = fopen(fname, "w");
1574  if(fp == NULL) {
1575  NAMD_die("Error in outputing PatchMap and ComputeMap info!\n");
1576  return;
1577  }
1578  PatchMap *pMap = PatchMap::Object();
1579  ComputeMap *cMap = ComputeMap::Object();
1580  int numPatches = pMap->numPatches();
1581  int numComputes = cMap->numComputes();
1582  fprintf(fp, "%d %d %d %d %d %d %d\n", numpes, nodesize, numPatches, numComputes,
1583  pMap->gridsize_a(), pMap->gridsize_b(), pMap->gridsize_c());
1584  //output PatchMap info
1585  for(int i=0; i<numPatches; i++) {
1586  #ifdef MEM_OPT_VERSION
1587  fprintf(fp, "%d %d\n", pMap->numAtoms(i), pMap->node(i));
1588  #else
1589  fprintf(fp, "%d %d\n", pMap->patch(i)->getNumAtoms(), pMap->node(i));
1590  #endif
1591  }
1592 
1593  //output ComputeMap info
1594  for(int i=0; i<numComputes; i++) {
1595  fprintf(fp, "%d %d %d %d\n", cMap->node(i), cMap->type(i), cMap->pid(i,0), cMap->pid(i,1));
1596  }
1597 }
Bool simulateInitialMapping
int getNumAtoms() const
Definition: Patch.h:105
int numComputes(void)
Definition: ComputeMap.h:101
static PatchMap * Object()
Definition: PatchMap.h:27
SimParameters * simParameters
Definition: Node.h:181
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
int gridsize_c(void) const
Definition: PatchMap.h:66
int gridsize_a(void) const
Definition: PatchMap.h:64
int numPatches(void) const
Definition: PatchMap.h:59
char * gNAMDBinaryName
Definition: BackEnd.C:240
ComputeType type(ComputeID cid)
Definition: ComputeMap.C:118
void NAMD_die(const char *err_msg)
Definition: common.C:147
static ComputeMap * Object()
Definition: ComputeMap.h:89
int node(ComputeID cid)
Definition: ComputeMap.h:106
int gridsize_b(void) const
Definition: PatchMap.h:65
int pid(ComputeID cid, int i)
Definition: ComputeMap.C:107
int node(int pid) const
Definition: PatchMap.h:114

◆ papiMeasureBarrier()

void Node::papiMeasureBarrier ( int  turnOnMeasure,
int  step 
)

Definition at line 1465 of file Node.C.

References curMFlopStep.

1465  {
1466 #ifdef MEASURE_NAMD_WITH_PAPI
1467  curMFlopStep = step;
1468  double results[NUM_PAPI_EVENTS+1];
1469 
1470  if(turnOnMeasure){
1471  CkpvAccess(papiEvents)[NUM_PAPI_EVENTS]=CmiWallTimer();
1472 
1473  long long counters[NUM_PAPI_EVENTS+1];
1474  int ret=PAPI_start_counters(CkpvAccess(papiEvents), NUM_PAPI_EVENTS);
1475  if(ret==PAPI_OK)
1476  {
1477  // CkPrintf("traceBarrier start counters (%d) at step %d called on proc %d\n", turnOnMeasure, step, CkMyPe());
1478  }
1479  else
1480  {
1481  CkPrintf("error PAPI_start_counters (%d) at step %d called on proc %d\n",ret , step, CkMyPe());
1482  }
1483  if(PAPI_read_counters(counters, NUM_PAPI_EVENTS)!=PAPI_OK)
1484  {
1485  CkPrintf("error PAPI_read_counters %d\n",PAPI_read_counters(counters, NUM_PAPI_EVENTS));
1486  };
1487  }else{
1488  long long counters[NUM_PAPI_EVENTS+1];
1489  for(int i=0;i<NUM_PAPI_EVENTS;i++) counters[i]=0LL;
1490  if(PAPI_read_counters(counters, NUM_PAPI_EVENTS)==PAPI_OK)
1491  {
1492 #if !MEASURE_PAPI_SPP
1493  results[0] = (double)counters[0]/1e6;
1494  results[1] = (double)counters[1]/1e6;
1495 #else
1496  for(int i=0;i<NUM_PAPI_EVENTS;i++) results[i] = counters[i]/1e6;
1497 #endif
1498  // for(int i=0;i<NUM_PAPI_EVENTS;i++) CkPrintf("[%d] counter %d is %ld\n",CkMyPe(),i,counters[i]);
1499  }
1500  else
1501  {
1502  // CkPrintf("error PAPI_read_counters %d\n",PAPI_read_counters(counters, NUM_PAPI_EVENTS));
1503  }
1504  // CkPrintf("traceBarrier stop counters (%d) at step %d called on proc %d\n", turnOnMeasure, step, CkMyPe());
1505 
1506  PAPI_stop_counters(counters, NUM_PAPI_EVENTS);
1507  }
1508  if(CkMyPe()==0)
1509  // CkPrintf("traceBarrier (%d) at step %d called on proc %d\n", turnOnMeasure, step, CkMyPe());
1510  results[NUM_PAPI_EVENTS]=CkpvAccess(papiEvents)[NUM_PAPI_EVENTS]; //starttime
1511  CProxy_Node nd(CkpvAccess(BOCclass_group).node);
1512  CkCallback cb(CkIndex_Node::resumeAfterPapiMeasureBarrier(NULL), nd[0]);
1513  contribute(sizeof(double)*(NUM_PAPI_EVENTS+1), &results, CkReduction::sum_double, cb);
1514 #endif
1515 }
int curMFlopStep
Definition: Node.h:157

◆ recvCheckpointAck()

void Node::recvCheckpointAck ( CheckpointMsg msg)

Definition at line 1365 of file Node.C.

References CheckpointMsg::checkpoint, Controller::recvCheckpointAck(), and state.

Referenced by recvCheckpointCAck_handler().

1365  {
1366  state->controller->recvCheckpointAck(msg->checkpoint);
1367  delete msg;
1368 }
Controller::checkpoint checkpoint
Definition: Node.C:96
NamdState * state
Definition: Node.h:184
void recvCheckpointAck(checkpoint &cp)
Definition: Controller.C:5191

◆ recvCheckpointReq()

void Node::recvCheckpointReq ( CheckpointMsg msg)

Definition at line 1343 of file Node.C.

References CheckpointMsg::checkpoint, CheckpointMsg::key, Controller::recvCheckpointReq(), CheckpointMsg::replica, state, and CheckpointMsg::task.

Referenced by recvCheckpointCReq_handler().

1343  {
1344  state->controller->recvCheckpointReq(msg->key,msg->task,msg->checkpoint);
1345 
1346  int remote = msg->replica;
1347  msg->replica = CmiMyPartition();
1348  envelope *env = UsrToEnv(CheckpointMsg::pack(msg));
1349  CmiSetHandler(env,recvCheckpointCAck_index);
1350 #if CMK_HAS_PARTITION
1351  CmiInterSyncSendAndFree(CkMyPe(),remote,env->getTotalsize(),(char*)env);
1352 #else
1353  CmiSyncSendAndFree(CkMyPe(),env->getTotalsize(),(char*)env);
1354 #endif
1355 }
void recvCheckpointReq(const char *key, int task, checkpoint &cp)
Definition: Controller.C:5161
int task
Definition: Node.C:94
int replica
Definition: Node.C:95
Controller::checkpoint checkpoint
Definition: Node.C:96
NamdState * state
Definition: Node.h:184
char * key
Definition: Node.C:97

◆ recvEnableEarlyExit()

void Node::recvEnableEarlyExit ( void  )

Definition at line 1400 of file Node.C.

References enableEarlyExit().

1400  {
1401  enableEarlyExit();
1402 }
void enableEarlyExit(void)
Definition: Node.C:1404

◆ recvEnableExitScheduler()

void Node::recvEnableExitScheduler ( void  )

Definition at line 1377 of file Node.C.

References enableExitScheduler().

1377  {
1378  //CmiPrintf("recvEnableExitScheduler\n");
1380 }
void enableExitScheduler(void)
Definition: Node.C:1382

◆ reloadCharges() [1/2]

void Node::reloadCharges ( const char *  filename)

Definition at line 1167 of file Node.C.

References molecule, NAMD_die(), and Molecule::numAtoms.

1167  {
1168  FILE *file = fopen(filename,"r");
1169  if ( ! file ) NAMD_die("node::reloadCharges():Error opening charge file.");
1170 
1171  int n = molecule->numAtoms;
1172  float *charge = new float[n];
1173 
1174  for ( int i = 0; i < n; ++i ) {
1175  if ( ! fscanf(file,"%f",&charge[i]) )
1176  NAMD_die("Node::reloadCharges():Not enough numbers in charge file.");
1177  }
1178 
1179  fclose(file);
1180  CProxy_Node(thisgroup).reloadCharges(charge,n);
1181 #ifdef NODEGROUP_FORCE_REGISTER
1182  if(CkMyPe()==0)
1183  {
1184  CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1185  cpdata.setDeviceKernelUpdateCounter();
1186  }
1187 #endif
1188  delete [] charge;
1189 }
int numAtoms
Definition: Molecule.h:585
void NAMD_die(const char *err_msg)
Definition: common.C:147
Molecule * molecule
Definition: Node.h:179

◆ reloadCharges() [2/2]

void Node::reloadCharges ( float  charge[],
int  n 
)

Definition at line 1191 of file Node.C.

References molecule, and Molecule::reloadCharges().

1191  {
1192  molecule->reloadCharges(charge,n);
1193 }
void reloadCharges(float charge[], int n)
Molecule * molecule
Definition: Node.h:179

◆ reloadGridforceGrid() [1/2]

void Node::reloadGridforceGrid ( const char *  key)

Definition at line 1197 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.

1197  {
1198  DebugM(4, "reloadGridforceGrid(const char*) called on node " << CkMyPe() << "\n" << endi);
1199 
1200  int gridnum;
1201  MGridforceParams *mgridParams;
1202  if (key == NULL) {
1205  } else {
1206  gridnum = simParameters->mgridforcelist.index_for_key(key);
1207  mgridParams = simParameters->mgridforcelist.find_key(key);
1208  }
1209 
1210  if (gridnum < 0 || mgridParams == NULL) {
1211  NAMD_die("Node::reloadGridforceGrid(const char*):Could not find grid.");
1212  }
1213 
1214  GridforceGrid *grid = molecule->get_gridfrc_grid(gridnum);
1215  if (grid == NULL) {
1216  NAMD_bug("Node::reloadGridforceGrid(const char*):grid not found");
1217  }
1218  grid->reinitialize(simParameters, mgridParams);
1219 
1220  CProxy_Node(thisgroup).reloadGridforceGrid(gridnum);
1221 #ifdef NODEGROUP_FORCE_REGISTER
1222  if(CkMyPe()==0)
1223  {
1224  CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1225  cpdata.setDeviceKernelUpdateCounter();
1226  }
1227 #endif
1228  DebugM(4, "reloadGridforceGrid(const char*) finished\n" << endi);
1229 }
GridforceGrid * get_gridfrc_grid(int gridnum) const
Definition: Molecule.h:1363
SimParameters * simParameters
Definition: Node.h:181
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
virtual void reinitialize(SimParameters *simParams, MGridforceParams *mgridParams)=0
int index_for_key(const char *key)
void NAMD_bug(const char *err_msg)
Definition: common.C:195
#define MGRIDFORCEPARAMS_DEFAULTKEY
MGridforceParams * find_key(const char *key)
void NAMD_die(const char *err_msg)
Definition: common.C:147
MGridforceParamsList mgridforcelist
Molecule * molecule
Definition: Node.h:179

◆ reloadGridforceGrid() [2/2]

void Node::reloadGridforceGrid ( int  gridnum)

Definition at line 1278 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().

1278  {
1279  if (CmiMyRank()) return;
1280  DebugM(4, "reloadGridforceGrid(int) called on node " << CkMyPe() << "\n" << endi);
1281 
1282  GridforceGrid *grid = molecule->get_gridfrc_grid(gridnum);
1283  if (grid == NULL) {
1284  NAMD_bug("Node::reloadGridforceGrid(int):grid not found");
1285  }
1286 
1287  if (CkMyPe()) {
1288  // not node 0 -> receive grid
1289  DebugM(4, "Receiving grid\n");
1290 
1291  delete grid;
1292 
1293  MIStream *msg = CkpvAccess(comm)->newInputStream(0, GRIDFORCEGRIDTAG);
1294  grid = GridforceGrid::unpack_grid(gridnum, msg);
1295  molecule->set_gridfrc_grid(gridnum, grid);
1296  delete msg;
1297  } else {
1298  // node 0 -> send grid
1299  DebugM(4, "Sending grid\n");
1300 
1301  MOStream *msg = CkpvAccess(comm)->newOutputStream(ALLBUTME, GRIDFORCEGRIDTAG, BUFSIZE);
1302  GridforceGrid::pack_grid(grid, msg);
1303  msg->end();
1304  delete msg;
1305  }
1306 #ifdef NODEGROUP_FORCE_REGISTER
1307  if(CkMyPe()==0)
1308  {
1309  CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1310  cpdata.setDeviceKernelUpdateCounter();
1311  }
1312 #endif
1313  DebugM(4, "reloadGridforceGrid(int) finished\n" << endi);
1314 }
#define GRIDFORCEGRIDTAG
Definition: common.h:183
GridforceGrid * get_gridfrc_grid(int gridnum) const
Definition: Molecule.h:1363
void end(void)
Definition: MStream.C:176
static void pack_grid(GridforceGrid *grid, MOStream *msg)
Definition: GridForceGrid.C:50
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
#define ALLBUTME
Definition: Communicate.h:14
void NAMD_bug(const char *err_msg)
Definition: common.C:195
#define BUFSIZE
Definition: Communicate.h:15
static GridforceGrid * unpack_grid(int gridnum, MIStream *msg)
Definition: GridForceGrid.C:60
int set_gridfrc_grid(int gridnum, GridforceGrid *grid)
Definition: Molecule.h:1372
Molecule * molecule
Definition: Node.h:179

◆ reloadStructure()

void Node::reloadStructure ( const char *  fname,
const char *  pdbname 
)

Definition at line 1011 of file Node.C.

References NamdState::loadStructure(), molecule, pdb, and state.

1011  {
1012  delete molecule;
1013  molecule = state->molecule = 0;
1014  delete pdb;
1015  pdb = state->pdb = 0;
1016  state->loadStructure(fname,pdbname,1);
1017  this->molecule = state->molecule;
1018  this->pdb = state->pdb;
1019  CProxy_Node nodeProxy(thisgroup);
1020  nodeProxy.resendMolecule();
1021 }
int loadStructure(const char *, const char *, int)
Definition: NamdState.C:163
NamdState * state
Definition: Node.h:184
PDB * pdb
Definition: Node.h:183
Molecule * molecule
Definition: Node.h:179

◆ resendMolecule()

void Node::resendMolecule ( )

Definition at line 1024 of file Node.C.

References ALLBUTME, BUFSIZE, molecule, MOLECULETAG, node_molecule, node_parameters, SimParameters::nonbonded_select(), Molecule::numAtoms, parameters, SimParameters::pme_select(), SimParameters::PMEOn, Molecule::receive_Molecule(), Parameters::receive_Parameters(), Molecule::send_Molecule(), Parameters::send_Parameters(), simParameters, and STATICPARAMSTAG.

1024  {
1025  if ( CmiMyRank() ) {
1026  return;
1027  }
1028  if ( CmiMyPe() == 0 ) {
1029  int bufSize = BUFSIZE;
1030  MOStream *conv_msg;
1031  conv_msg = CkpvAccess(comm)->newOutputStream(ALLBUTME, STATICPARAMSTAG, bufSize);
1032  parameters->send_Parameters(conv_msg);
1033  if(molecule->numAtoms>=1000000) bufSize = 16*BUFSIZE;
1034  conv_msg = CkpvAccess(comm)->newOutputStream(ALLBUTME, MOLECULETAG, bufSize);
1035  molecule->send_Molecule(conv_msg);
1036  } else {
1037  MIStream *conv_msg;
1038  delete parameters;
1039  parameters = new Parameters;
1040  conv_msg = CkpvAccess(comm)->newInputStream(0, STATICPARAMSTAG);
1041  parameters->receive_Parameters(conv_msg);
1042  delete molecule;
1044  conv_msg = CkpvAccess(comm)->newInputStream(0, MOLECULETAG);
1045  molecule->receive_Molecule(conv_msg);
1046  }
1051  CProxy_Node nodeProxy(thisgroup);
1052  for ( int i=0; i<CmiMyNodeSize(); ++i ) {
1053  nodeProxy[CmiMyPe()+i].resendMolecule2();
1054  }
1055 }
void send_Molecule(MOStream *)
Definition: Molecule.C:5589
SimParameters * simParameters
Definition: Node.h:181
#define ALLBUTME
Definition: Communicate.h:14
#define STATICPARAMSTAG
Definition: common.h:178
Molecule * node_molecule
Definition: Node.C:433
Molecule stores the structural information for the system.
Definition: Molecule.h:175
static void pme_select()
int numAtoms
Definition: Molecule.h:585
#define BUFSIZE
Definition: Communicate.h:15
static void nonbonded_select()
void send_Parameters(MOStream *)
Definition: Parameters.C:6560
Parameters * parameters
Definition: Node.h:180
Parameters * node_parameters
Definition: Node.C:432
#define MOLECULETAG
Definition: common.h:179
void receive_Molecule(MIStream *)
Definition: Molecule.C:5955
Molecule * molecule
Definition: Node.h:179
void receive_Parameters(MIStream *)
Definition: Parameters.C:6936

◆ resendMolecule2()

void Node::resendMolecule2 ( )

Definition at line 1057 of file Node.C.

References AtomMap::allocateMap(), molecule, node_molecule, node_parameters, Molecule::numAtoms, AtomMap::Object(), and parameters.

1057  {
1061 }
void allocateMap(int nAtomIDs)
Definition: AtomMap.C:161
Molecule * node_molecule
Definition: Node.C:433
int numAtoms
Definition: Molecule.h:585
static AtomMap * Object()
Definition: AtomMap.h:37
Parameters * parameters
Definition: Node.h:180
Parameters * node_parameters
Definition: Node.C:432
Molecule * molecule
Definition: Node.h:179

◆ resumeAfterPapiMeasureBarrier()

void Node::resumeAfterPapiMeasureBarrier ( CkReductionMsg *  msg)

Definition at line 1517 of file Node.C.

References curMFlopStep, simParameters, and state.

1517  {
1518 #ifdef MEASURE_NAMD_WITH_PAPI
1519 
1520  if(simParameters->papiMeasureStartStep != curMFlopStep) {
1521  double *results = (double *)msg->getData();
1522  double endtime=CmiWallTimer();
1523  int bstep = simParameters->papiMeasureStartStep;
1524  int estep = bstep + simParameters->numPapiMeasureSteps;
1525 #if MEASURE_PAPI_SPP
1526  CkPrintf("SPP INFO: PAPI_FP_OPS timestep %d to %d is %lf(1e6)\n", bstep,estep,results[0]);
1527  CkPrintf("SPP INFO: PAPI_TOT_INS timestep %d to %d is %lf(1e6)\n", bstep,estep,results[1]);
1528  CkPrintf("SPP INFO: perf::PERF_COUNT_HW_CACHE_LL:MISS timestep %d to %d is %lf(1e6)\n", bstep,estep,results[2]);
1529  CkPrintf("SPP INFO: DATA_PREFETCHER:ALL timestep %d to %d is %lf(1e6)\n", bstep,estep,results[3]);
1530  CkPrintf("SPP INFO: PAPI_L1_DCA timestep %d to %d is %lf(1e6)\n", bstep,estep,results[4]);
1531  CkPrintf("SPP INFO: PAPI_TOT_CYC timestep %d to % is %lf(1e6)\n", bstep,estep,results[5]);
1532  // CkPrintf("SPP INFO: INSTRUCTION_FETCH_STALL timestep %d to %d is %lf(1e6)\n", bstep,estep,results[6]);
1533  // CkPrintf("SPP INFO: WALLtime timestep %d to %d is %lf\n", bstep,estep,endtime-results[NUM_PAPI_EVENTS]/CkNumPes());
1534  CkPrintf("SPP INFO: WALLtime timestep %d to %d is %lf\n", bstep,estep,endtime-results[NUM_PAPI_EVENTS]);
1535  CkPrintf("SPP INFO: endtime %lf avgtime %lf tottime %lf\n", endtime,results[NUM_PAPI_EVENTS]/CkNumPes(),results[NUM_PAPI_EVENTS] );
1536 #else
1537  if(CkpvAccess(papiEvents)[0] == PAPI_FP_INS){
1538  double totalFPIns = results[0];
1539  if(CkpvAccess(papiEvents)[1] == PAPI_FMA_INS) totalFPIns += (results[1]*2);
1540  CkPrintf("FLOPS INFO: from timestep %d to %d, the total FP instruction of NAMD is %lf(x1e6) per processor\n",
1541  bstep, estep, totalFPIns/CkNumPes());
1542  }else{
1543  char nameBuf[PAPI_MAX_STR_LEN];
1544  CkPrintf("PAPI COUNTERS INFO: from timestep %d to %d, ",
1545  bstep, estep);
1546  for(int i=0; i<NUM_PAPI_EVENTS; i++) {
1547  PAPI_event_code_to_name(CkpvAccess(papiEvents)[i], nameBuf);
1548  CkPrintf("%s is %lf(x1e6), ", nameBuf, results[i]/CkNumPes());
1549  }
1550  CkPrintf("per processor\n");
1551  }
1552 #endif
1553  }
1554  delete msg;
1555  state->controller->resumeAfterPapiMeasureBarrier(curMFlopStep);
1556 #endif
1557 }
SimParameters * simParameters
Definition: Node.h:181
int curMFlopStep
Definition: Node.h:157
NamdState * state
Definition: Node.h:184

◆ resumeAfterTraceBarrier()

void Node::resumeAfterTraceBarrier ( CkReductionMsg *  msg)

Definition at line 1459 of file Node.C.

References curTimeStep, Controller::resumeAfterTraceBarrier(), and state.

1459  {
1460  CmiAssert(CmiMyPe()==0);
1461  delete msg;
1463 }
int curTimeStep
Definition: Node.h:152
NamdState * state
Definition: Node.h:184
void resumeAfterTraceBarrier(int)
Definition: Controller.C:5231

◆ run()

void Node::run ( void  )

Definition at line 1116 of file Node.C.

References ResizeArrayIter< T >::begin(), DebugM, ResizeArrayIter< T >::end(), endi(), PatchMap::homePatchList(), iINFO(), iout, memusage_MB(), PatchMap::Object(), NamdState::runController(), HomePatch::runSequencer(), startupTime, and state.

Referenced by messageRun().

1117 {
1118 // NAMD_EVENT_START(1, NamdProfileEvent::NODE_RUN);
1119 
1120  // Start Controller (aka scalar Sequencer) on Pe(0)
1121 // printf("\n\n I am in Node.C in run method about to call state->runController\n\n");
1122  if ( ! CkMyPe() ) {
1123  state->runController();
1124  }
1125 
1126  DebugM(4, "Starting Sequencers\n");
1127  // Run Sequencer on each HomePatch - i.e. start simulation
1130  for (ai=ai.begin(); ai != ai.end(); ai++) {
1131  HomePatch *patch = (*ai).patch;
1132 //CkPrintf("Proc#%d in Node calling Sequencer ",CkMyPe());
1133  patch->runSequencer();
1134  }
1135 
1136  if (!CkMyPe()) {
1137  double newTime = CmiWallTimer();
1138  iout << iINFO << "Startup phase " << startupPhase-1 << " took "
1139  << newTime - startupTime << " s, "
1140  << memusage_MB() << " MB of memory in use\n";
1141  iout << iINFO << "Finished startup at " << newTime << " s, "
1142  << memusage_MB() << " MB of memory in use\n\n" << endi;
1143  fflush(stdout);
1144  }
1145 
1146 // NAMD_EVENT_STOP(1, NamdProfileEvent::NODE_RUN);
1147 }
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
void runSequencer(void)
Definition: HomePatch.C:305
static PatchMap * Object()
Definition: PatchMap.h:27
#define DebugM(x, y)
Definition: Debug.h:75
double startupTime
Definition: Node.C:294
HomePatchList * homePatchList()
Definition: PatchMap.C:438
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
#define iout
Definition: InfoStream.h:51
void runController(void)
Definition: NamdState.C:83
double memusage_MB()
Definition: memusage.h:13
NamdState * state
Definition: Node.h:184

◆ saveMolDataPointers()

void Node::saveMolDataPointers ( NamdState state)

Definition at line 1420 of file Node.C.

References configList, molecule, parameters, pdb, simParameters, and state.

1421 {
1422  this->molecule = state->molecule;
1423  this->parameters = state->parameters;
1424  this->simParameters = state->simParameters;
1425  this->configList = state->configList;
1426  this->pdb = state->pdb;
1427  this->state = state;
1428 }
SimParameters * simParameters
Definition: Node.h:181
NamdState * state
Definition: Node.h:184
PDB * pdb
Definition: Node.h:183
ConfigList * configList
Definition: Node.h:182
Parameters * parameters
Definition: Node.h:180
Molecule * molecule
Definition: Node.h:179

◆ scriptBarrier()

void Node::scriptBarrier ( void  )

Definition at line 1158 of file Node.C.

1158  {
1159  //script->awaken();
1160 }

◆ scriptParam()

void Node::scriptParam ( ScriptParamMsg msg)

Definition at line 1162 of file Node.C.

References ScriptParamMsg::param, SimParameters::scriptSet(), simParameters, and ScriptParamMsg::value.

1162  {
1163  simParameters->scriptSet(msg->param,msg->value);
1164  delete msg;
1165 }
SimParameters * simParameters
Definition: Node.h:181
void scriptSet(const char *, const char *)
char value[MAX_SCRIPT_PARAM_SIZE]
Definition: Node.h:75
char param[MAX_SCRIPT_PARAM_SIZE]
Definition: Node.h:74

◆ sendCheckpointReq()

void Node::sendCheckpointReq ( int  remote,
const char *  key,
int  task,
Lattice lat,
ControllerState cs 
)

Definition at line 1319 of file Node.C.

References CheckpointMsg::checkpoint, CheckpointMsg::key, Controller::checkpoint::lattice, CheckpointMsg::replica, Controller::checkpoint::state, and CheckpointMsg::task.

Referenced by Controller::algorithm().

1319  {
1320  CheckpointMsg *msg = new (1+strlen(key),0) CheckpointMsg;
1321  msg->replica = CmiMyPartition();
1322  msg->task = task;
1323  msg->checkpoint.lattice = lat;
1324  msg->checkpoint.state = cs;
1325  strcpy(msg->key,key);
1326  envelope *env = UsrToEnv(CheckpointMsg::pack(msg));
1327  CmiSetHandler(env,recvCheckpointCReq_index);
1328 #if CMK_HAS_PARTITION
1329  CmiInterSyncSendAndFree(CkMyPe(),remote,env->getTotalsize(),(char*)env);
1330 #else
1331  CmiSyncSendAndFree(CkMyPe(),env->getTotalsize(),(char*)env);
1332 #endif
1333 }
ControllerState state
Definition: Controller.h:388
int task
Definition: Node.C:94
int replica
Definition: Node.C:95
Controller::checkpoint checkpoint
Definition: Node.C:96
char * key
Definition: Node.C:97

◆ sendEnableEarlyExit()

void Node::sendEnableEarlyExit ( void  )

Definition at line 1395 of file Node.C.

Referenced by enableEarlyExit().

1395  {
1396  CProxy_Node nodeProxy(thisgroup);
1397  nodeProxy[0].recvEnableEarlyExit();
1398 }

◆ sendEnableExitScheduler()

void Node::sendEnableExitScheduler ( void  )

Definition at line 1371 of file Node.C.

Referenced by enableExitScheduler().

1371  {
1372  //CmiPrintf("sendEnableExitScheduler\n");
1373  CProxy_Node nodeProxy(thisgroup);
1374  nodeProxy[0].recvEnableExitScheduler();
1375 }

◆ setScript()

void Node::setScript ( ScriptTcl s)
inline

Definition at line 194 of file Node.h.

Referenced by after_backend_init().

194 { script = s; }

◆ startHPM()

void Node::startHPM ( )

Definition at line 1431 of file Node.C.

1431  {
1432 #if USE_HPM
1433  HPM_Start("500 steps", localRankOnNode);
1434 #endif
1435 }

◆ startup()

void Node::startup ( )

Definition at line 437 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(), endi(), BackEnd::exit(), 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(), NAMD_EVENT_START, NAMD_EVENT_STOP, node_molecule, node_parameters, node_simParameters, SimParameters::nonbonded_select(), Molecule::numAtoms, ComputeMap::numComputes(), PatchMap::Object(), AtomMap::Object(), Sync::Object(), ComputeMap::Object(), LdbCoordinator::Object(), ProxyMgr::Object(), Sync::openSync(), output, outputPatchComputeMaps(), parameters, WorkDistrib::patchMapInit(), pdb, SimParameters::pme_select(), SimParameters::PMEOn, proxyRecvSpanning, proxySendSpanning, SimParameters::proxyTreeBranchFactor, rand, SimParameters::randomSeed, registerUserEventsForAllComputeObjs(), 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::useCkLoop, SimParameters::usePMECUDA, and workDistrib.

Referenced by messageStartUp().

437  {
438  NAMD_EVENT_START(1, NamdProfileEvent::NAMD_STARTUP);
439 
440  int gotoRun = false;
441  double newTime;
442 
443  if (!CkMyPe()) {
444  if (!startupPhase) {
445  iout << iINFO << "\n";
446  startupTime = CmiWallTimer();
447  iout << iINFO << "Entering startup at " << startupTime << " s, ";
448  } else {
449  newTime = CmiWallTimer();
450  iout << iINFO << "Startup phase " << startupPhase-1 << " took "
451  << newTime - startupTime << " s, ";
452  startupTime = newTime;
453  }
454  iout << memusage_MB() << " MB of memory in use\n" << endi;
455  fflush(stdout);
456  }
457  switch (startupPhase) {
458 
459  case 0:
461  namdOneCommInit(); // Namd1.X style
462  break;
463 
464  case 1:
465  bindBocVars();
466 
467  // send & receive molecule, simparameters... (Namd1.X style)
468  if (CkMyPe()) {
469  namdOneRecv();
470  } else {
471  namdOneSend();
472  }
473  break;
474 
475  case 2:
476  // fix up one-per-node objects (for SMP version)
480 
483 
484  #if !CMK_SMP || ! USE_CKLOOP
485  //the CkLoop library should be only used in SMP mode
487  #else
488  if ( CkNumPes() < 2 * CkNumNodes() ) simParameters->useCkLoop = 0;
489  #endif
490 
491 
492  if ( simParameters->mallocTest ) {
493  if (!CkMyPe()) {
494  mallocTest_size = 0;
495  CkStartQD(CkIndex_Node::mallocTestQd(), &thishandle);
496  }
497  return;
498  }
499 
500 
501  #ifdef MEASURE_NAMD_WITH_PAPI
502  if(simParameters->papiMeasure) namdInitPapiCounters();
503  #endif
504 
505  #ifdef MEM_OPT_VERSION
506  //At this point, each Node object has received the simParameters,
507  //parameters and the atom signatures info from the master Node
508  //(proc 0). It's time to initialize the parallel IO manager and
509  //read the binary per-atom file --Chao Mei
510 
511  //Step 1: initialize the parallel IO manager per Node
512  ioMgr->initialize(this);
513  #endif
514 
515  break;
516 
517  case 3:
518 
519  #ifdef MEM_OPT_VERSION
520  //Step 2: read the binary per-atom files (signater index, coordinates etc.)
521  ioMgr->readPerAtomInfo();
522  #endif
523 
524  break;
525 
526  case 4:
527 
528  #ifdef MEM_OPT_VERSION
529  //Step 3: update counters of tuples and exclusions inside Molecule object
530  ioMgr->updateMolInfo();
531 
532  //Step 4: prepare distributing the atoms to neighboring procs if necessary
533  ioMgr->migrateAtomsMGrp();
534 
535  //step 5: initialize patchMap and send it to every other processors
536  //to decide atoms to patch distribution on every input processor
537  if(!CkMyPe()) {
538  workDistrib->patchMapInit(); // create space division
540  }
541  #endif
542 
543  #if USE_HPM
544  HPM_Init(localRankOnNode);
545  #endif
546 
547  // take care of inital thread setting
548  threadInit();
549 
550  // create blank AtomMap
552 
553  if (!CkMyPe()) {
554 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
555  if (simParameters->usePMECUDA) {
556  // computePmeCUDAMgr was created in BackEnd.C
557  // This empty branch is to avoid initializing ComputePmeMgr
558  } else
559 #endif
560  if (simParameters->PMEOn) {
561  CkpvAccess(BOCclass_group).computePmeMgr = CProxy_ComputePmeMgr::ckNew();
562  }
563  #ifdef OPENATOM_VERSION
564  if ( simParameters->openatomOn ) {
565  CkpvAccess(BOCclass_group).computeMoaMgr = CProxy_ComputeMoaMgr::ckNew();
566  }
567  #endif // OPENATOM_VERSION
568 
569  }
570 
571  #ifdef OPENATOM_VERSION
572  if ( simParameters->openatomOn ) {
573  // if ( ! CkMyPe() ) {
574  CkCallback doneMoaStart(CkIndexmain::doneMoaSetup(), thishandle);
575  startOA(simParameters->moaDriverFile, simParameters->moaPhysicsFile, doneMoaStart);
576  // }
577  }
578  #endif // OPENATOM_VERSION
579 
580  // BEGIN LA
582  rand->split(CkMyPe(), CkNumPes());
583  // END LA
584 
585  break;
586 
587  case 5:
588  #ifdef MEM_OPT_VERSION
589  //Now, every input proc has received all the atoms necessary
590  //to decide the patches those atoms belong to
591 
592  //step 1: integrate the migrated atoms into the atom list that
593  //contains the initally distributed atoms, and sort the atoms
594  //based on hydrogenList value
595  ioMgr->integrateMigratedAtoms();
596 
597  //step 2: integrate the cluster size of each atom on each output proc
598  ioMgr->integrateClusterSize();
599 
600  //step 3: calculate the number of atoms in each patch on every
601  //input procs (atoms belonging to a patch may lie on different
602  //procs), and reduce such info on proc 0. Such info is required
603  //for determing which node a particular patch is assigned to.
604  ioMgr->calcAtomsInEachPatch();
605 
606  //set to false to re-send PatchMap later
608  #endif
609  break;
610  case 6:
613  }
616  }
619  }
620  #ifdef PROCTRACE_DEBUG
621  DebugFileTrace::Instance("procTrace");
622  #endif
623 
624  if (!CkMyPe()) {
625  output = new Output; // create output object just on PE(0)
626 
627  #ifndef MEM_OPT_VERSION
628  workDistrib->patchMapInit(); // create space division
629  workDistrib->createHomePatches(); // load atoms into HomePatch(es)
630  #endif
631 
634  //ComputeMap::Object()->printComputeMap();
635 
636  // For MIC runs, take the additional step after the compute map has been created to
637  // assign the various computes to either the host or the device. This info will
638  // be distributed across the PEs.
639  #if defined(NAMD_MIC)
640  mic_initHostDeviceLDB();
641  #endif
642 
644  iout << iINFO << "Simulating initial mapping with " << simParameters->simulatedPEs
645  << " PEs with " << simParameters->simulatedNodeSize << " PEs per node\n" << endi;
646  outputPatchComputeMaps("init_mapping", 0);
647  iout << iINFO << "Simulating initial mapping is done, now NAMD exits\n" << endi;
648  BackEnd::exit();
649  }
650 
652 
653  //in MEM_OPT_VERSION, patchMap is resent
654  //because they have been updated since creation including
655  //#atoms per patch, the proc a patch should stay etc. --Chao Mei
657  #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
658  CProxy_NodeProxyMgr npm(CkpvAccess(BOCclass_group).nodeProxyMgr);
659  //a node broadcast
660  npm.createProxyInfo(PatchMap::Object()->numPatches());
661  #endif
662  }
663  {
664  #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
665  CProxy_NodeProxyMgr npm(CkpvAccess(BOCclass_group).nodeProxyMgr);
666  if(CkMyRank()==0) {
667  //just need to register once
668  npm[CkMyNode()].ckLocalBranch()->registerLocalProxyMgr(CkpvAccess(BOCclass_group).proxyMgr);
669  }
670  npm[CkMyNode()].ckLocalBranch()->registerLocalPatchMap(CkMyRank(), PatchMap::Object());
671  #endif
672  }
673  break;
674 
675  case 7:
676 #ifdef CHARM_HAS_MSA
678  CProxy_ComputeMsmMsaMgr msm(CkpvAccess(BOCclass_group).computeMsmMsaMgr);
679  msm[CkMyPe()].initialize(new CkQdMsg);
680  }
681 #else
683  CProxy_ComputeMsmMgr msm(CkpvAccess(BOCclass_group).computeMsmMgr);
684  MsmInitMsg *msg = new MsmInitMsg;
685  Lattice lattice = simParameters->lattice; // system lattice vectors
686  ScaledPosition smin=0, smax=0;
687  if (lattice.a_p() && lattice.b_p() && lattice.c_p()) {
688  msg->smin = smin;
689  msg->smax = smax;
690  msm[CkMyPe()].initialize(msg); // call from my own PE
691  }
692  else if ( ! CkMyPe() ) {
693  pdb->get_extremes(smin, smax); // only available on PE 0
694  msg->smin = smin;
695  msg->smax = smax;
696  msm.initialize(msg); // broadcast to chare group
697  }
698 
699  /*
700  CProxy_Node nd(CkpvAccess(BOCclass_group).node);
701  Node *node = nd.ckLocalBranch();
702  ScaledPosition smin, smax;
703  node->pdb->get_extremes(smin, smax);
704  msg->smin = smin; // extreme positions in system
705  msg->smax = smax;
706  msm[CkMyPe()].initialize(msg);
707  */
708  }
709 #endif
710 
711  if ( simParameters->PMEOn ) {
712  #ifdef OPENATOM_VERSION
713  if ( simParameters->openatomOn ) {
714  CProxy_ComputeMoaMgr moa(CkpvAccess(BOCclass_group).computeMoaMgr);
715  moa[CkMyPe()].initialize(new CkQdMsg);
716  }
717  #endif // OPENATOM_VERSION
718 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
719  if ( simParameters->usePMECUDA ) {
720  if(CkMyRank()==0) {
721  CProxy_ComputePmeCUDAMgr pme(CkpvAccess(BOCclass_group).computePmeCUDAMgr);
722  pme.ckLocalBranch()->initialize(new CkQdMsg); // must run on pe 0 to call ckNew
723  }
724  } else
725 #endif
726  {
727  CProxy_ComputePmeMgr pme(CkpvAccess(BOCclass_group).computePmeMgr);
728  pme[CkMyPe()].initialize(new CkQdMsg);
729  }
730  }
731  break;
732 
733  case 8:
734 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
735  if ( CkMyRank()==0 ) {
736  CProxy_ComputeCUDAMgr nb(CkpvAccess(BOCclass_group).computeCUDAMgr);
737  nb.ckLocalBranch()->initialize(new CkQdMsg);
738  }
739 #endif
740  break;
741 
742  case 9:
744  break;
745 
746  case 10:
747  #ifdef MEM_OPT_VERSION
748  //migrate atoms to HomePatch processors
749  ioMgr->sendAtomsToHomePatchProcs();
750  #endif
751  break;
752 
753  case 11:
754  // part 2 of MSM init
756  CProxy_ComputeMsmMgr msm(CkpvAccess(BOCclass_group).computeMsmMgr);
757  msm[CkMyPe()].initialize_create(); // call from my own PE
758  }
759 
760  if ( simParameters->PMEOn ) {
761  #ifdef OPENATOM_VERSION
762  if ( simParameters->openatomOn ) {
763  CProxy_ComputeMoaMgr moa(CkpvAccess(BOCclass_group).computeMoaMgr);
764  moa[CkMyPe()].initWorkers(new CkQdMsg);
765  }
766  #endif // OPENATOM_VERSION
767 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
768  if ( simParameters->usePMECUDA ) {
769  if(CkMyRank()==0) {
770  CProxy_ComputePmeCUDAMgr pme(CkpvAccess(BOCclass_group).computePmeCUDAMgr);
771  pme[CkMyNode()].initialize_pencils(new CkQdMsg);
772  }
773  } else
774 #endif
775  {
776  CProxy_ComputePmeMgr pme(CkpvAccess(BOCclass_group).computePmeMgr);
777  pme[CkMyPe()].initialize_pencils(new CkQdMsg);
778  }
779  }
780 #ifdef CHARM_HAS_MSA
781  else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
782  CProxy_ComputeMsmMsaMgr msm(CkpvAccess(BOCclass_group).computeMsmMsaMgr);
783  msm[CkMyPe()].initWorkers(new CkQdMsg);
784  }
785 #else
786  else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
787  CProxy_ComputeMsmMgr msm(CkpvAccess(BOCclass_group).computeMsmMgr);
788  msm[CkMyPe()].update(new CkQdMsg);
789  }
790 #endif
791 
792  #ifdef MEM_OPT_VERSION
793  //Now every processor has all the atoms it needs to create the HomePatches.
794  //The HomePatches are created in parallel on every home patch procs.
795  ioMgr->createHomePatches();
796  #else
797  if (!CkMyPe()) {
799  }
800  #endif
801  break;
802 
803  case 12:
804  if ( simParameters->PMEOn ) {
805  #ifdef OPENATOM_VERSION
806  if ( simParameters->openatomOn ) {
807  CProxy_ComputeMoaMgr moa(CkpvAccess(BOCclass_group).computeMoaMgr);
808  moa[CkMyPe()].startWorkers(new CkQdMsg);
809  }
810  #endif // OPENATOM_VERSION
811 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
812  if ( simParameters->usePMECUDA ) {
813  if(CkMyRank()==0) {
814  CProxy_ComputePmeCUDAMgr pme(CkpvAccess(BOCclass_group).computePmeCUDAMgr);
815  pme[CkMyNode()].activate_pencils(new CkQdMsg);
816  }
817  } else
818 #endif
819  {
820  CProxy_ComputePmeMgr pme(CkpvAccess(BOCclass_group).computePmeMgr);
821  pme[CkMyPe()].activate_pencils(new CkQdMsg);
822  }
823  }
824 #ifdef CHARM_HAS_MSA
825  else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
826  CProxy_ComputeMsmMsaMgr msm(CkpvAccess(BOCclass_group).computeMsmMsaMgr);
827  msm[CkMyPe()].startWorkers(new CkQdMsg);
828  }
829 #else
830  /*
831  else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
832  CProxy_ComputeMsmMgr msm(CkpvAccess(BOCclass_group).computeMsmMgr);
833  //msm[CkMyPe()].startWorkers(new CkQdMsg);
834  }
835  */
836 #endif
837 
838  proxyMgr->createProxies(); // need Home patches before this
839  if (!CkMyPe()) LdbCoordinator::Object()->createLoadBalancer();
840 
841 #ifdef NAMD_TCL
842  // TclInitSubsystems() has a race condition so we create one interp per node here
843  if (CkMyPe() && CkMyNodeSize() > 1 && ! CkMyRank()) Tcl_DeleteInterp(Tcl_CreateInterp());
844 #endif
845 
846 #ifdef USE_NODEPATCHMGR
847  //at this point, PatchMap info has been recved on PEs. It is time to create
848  //the home patch spanning tree for receiving proxy list info
849  if(proxyMgr->getSendSpanning() || proxyMgr->getRecvSpanning()) {
850  if(CkMyRank()==0) {
851  CProxy_NodeProxyMgr npm(CkpvAccess(BOCclass_group).nodeProxyMgr);
852  npm[CkMyNode()].ckLocalBranch()->createSTForHomePatches(PatchMap::Object());
853  }
854  }
855 #endif
856 
857  break;
858 
859  case 13:
860 
861  // DMK - DEBUG - If, in MIC runs, the debug option to dump all the compute maps to files
862  // for debugging/verification purposes has been enabled, have each PE do so now.
863  #if defined(NAMD_MIC)
864  mic_dumpHostDeviceComputeMap();
865  #endif
866 
867  if (!CkMyPe()) {
868  iout << iINFO << "CREATING " << ComputeMap::Object()->numComputes()
869  << " COMPUTE OBJECTS\n" << endi;
870  }
871  DebugM(4,"Creating Computes\n");
873  DebugM(4,"Building Sequencers\n");
874  buildSequencers();
875  DebugM(4,"Initializing LDB\n");
877  break;
878 
879  case 14:
880  // computes may create proxies on the fly so put these in separate phase
881  Sync::Object()->openSync(); // decide if to open local Sync
883 #if defined(CMK_BALANCED_INJECTION_API) && CMK_BALANCED_INJECTION_API != 0
884  if(CkMyRank() == 0){
885  // CkPrintf("[%d] get retrieved BI=%d\n",CkMyPe(),balancedInjectionLevel);
886  ck_set_GNI_BIConfig(balancedInjectionLevel);
887  // CkPrintf("[%d] set retrieved BI=%d\n",CkMyPe(),ck_get_GNI_BIConfig());
888  }
889 #endif
890 
891  break;
892 
893  case 15:
894  {
895  //For debugging
896  /*if(!CkMyPe()){
897  FILE *dumpFile = fopen("/tmp/NAMD_Bench.dump", "w");
898  dumpbench(dumpFile);
899  NAMD_die("Normal execution\n");
900  }*/
901  }
902  #ifdef MEM_OPT_VERSION
903  //free space in the Molecule object that are not used anymore
904  ioMgr->freeMolSpace();
905  #endif
906  gotoRun = true;
907  break;
908 
909  default:
910  NAMD_bug("Startup Phase has a bug - check case statement");
911  break;
912 
913  }
914 
915  startupPhase++;
916  if (!CkMyPe()) {
917  if (!gotoRun) {
918  CkStartQD(CkCallback(CkIndex_Node::startup(), thisgroup));
919  } else {
921  }
922  }
923 
924  NAMD_EVENT_STOP(1, NamdProfileEvent::NAMD_STARTUP);
925 }
void allocateMap(int nAtomIDs)
Definition: AtomMap.C:161
#define NAMD_EVENT_STOP(eon, id)
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:81
Bool simulateInitialMapping
void setPatchMapArrived(bool s)
Definition: WorkDistrib.h:107
void createProxies(void)
Definition: ProxyMgr.C:416
void setRecvSpanning()
Definition: ProxyMgr.C:370
int proxyRecvSpanning
Definition: ProxyMgr.C:45
int numComputes(void)
Definition: ComputeMap.h:101
int getRecvSpanning()
Definition: ProxyMgr.C:375
static ProxyMgr * Object()
Definition: ProxyMgr.h:394
NAMD_HOST_DEVICE int c_p() const
Definition: Lattice.h:291
static PatchMap * Object()
Definition: PatchMap.h:27
static void exit(int status=0)
Definition: BackEnd.C:277
Definition: Vector.h:72
Output * output
Definition: Node.h:185
SimParameters * simParameters
Definition: Node.h:181
void setSendSpanning()
Definition: ProxyMgr.C:361
#define DebugM(x, y)
Definition: Debug.h:75
void createLoadBalancer()
double startupTime
Definition: Node.C:294
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
int getSendSpanning()
Definition: ProxyMgr.C:366
#define iout
Definition: InfoStream.h:51
Molecule * node_molecule
Definition: Node.C:433
void outputPatchComputeMaps(const char *filename, int tag)
Definition: Node.C:1560
void createComputes(ComputeMap *map)
Definition: ComputeMgr.C:973
NAMD_HOST_DEVICE int b_p() const
Definition: Lattice.h:290
void split(int iStream, int numStreams)
Definition: Random.h:77
void patchMapInit(void)
Definition: WorkDistrib.C:1226
void openSync()
Definition: Sync.C:63
ComputeMap * computeMap
Definition: Node.h:204
double memusage_MB()
Definition: memusage.h:13
void sendComputeMap(void)
Definition: WorkDistrib.C:1199
Definition: Output.h:35
void initialize(PatchMap *pmap, ComputeMap *cmap, int reinit=0)
Definition: Random.h:37
#define NAMD_EVENT_START(eon, id)
void buildProxySpanningTree()
Definition: ProxyMgr.C:558
void createHomePatches(void)
Definition: WorkDistrib.C:977
void NAMD_bug(const char *err_msg)
Definition: common.C:195
ScaledPosition smax
Definition: ComputeMsm.h:21
static void pme_select()
static void messageRun()
Definition: Node.C:1107
static Sync * Object()
Definition: Sync.h:52
void get_extremes(ScaledPosition &xmin, ScaledPosition &xmax) const
Definition: PDB.h:104
NAMD_HOST_DEVICE int a_p() const
Definition: Lattice.h:289
int numAtoms
Definition: Molecule.h:585
PDB * pdb
Definition: Node.h:183
static LdbCoordinator * Object()
static AtomMap * Object()
Definition: AtomMap.h:37
static void nonbonded_select()
void sendPatchMap(void)
Definition: WorkDistrib.C:1099
int isRecvSpanningTreeOn()
Parameters * parameters
Definition: Node.h:180
unsigned int randomSeed
WorkDistrib * workDistrib
Definition: Node.h:169
Parameters * node_parameters
Definition: Node.C:432
SimParameters * node_simParameters
Definition: Node.C:431
Random * rand
Definition: Node.h:175
void mapComputes(void)
Definition: WorkDistrib.C:2395
void registerUserEventsForAllComputeObjs(void)
Definition: ComputeMgr.C:794
static ComputeMap * Object()
Definition: ComputeMap.h:89
ScaledPosition smin
Definition: ComputeMsm.h:21
void distributeHomePatches(void)
Definition: WorkDistrib.C:1051
void setProxyTreeBranchFactor(int dim)
Definition: ProxyMgr.C:379
int isSendSpanningTreeOn()
ComputeMgr * computeMgr
Definition: Node.h:172
int mallocTest_size
Definition: Node.h:130
Molecule * molecule
Definition: Node.h:179
void assignNodeToPatch(void)
Definition: WorkDistrib.C:1444
int proxySendSpanning
Definition: ProxyMgr.C:44

◆ stopHPM()

void Node::stopHPM ( )

Definition at line 1437 of file Node.C.

1437  {
1438 #if USE_HPM
1439  HPM_Stop("500 steps", localRankOnNode);
1440  HPM_Print(CkMyPe(), localRankOnNode);
1441 #endif
1442 }

◆ traceBarrier()

void Node::traceBarrier ( int  turnOnTrace,
int  step 
)

Definition at line 1444 of file Node.C.

References curTimeStep.

1444  {
1445  curTimeStep = step;
1446  if(turnOnTrace) traceBegin();
1447  else traceEnd();
1448 
1449  if(turnOnTrace) CmiTurnOnStats();
1450  else CmiTurnOffStats();
1451 
1452  //CkPrintf("traceBarrier (%d) at step %d called on proc %d\n", turnOnTrace, step, CkMyPe());
1453  CProxy_Node nd(CkpvAccess(BOCclass_group).node);
1454  CkCallback cb(CkIndex_Node::resumeAfterTraceBarrier(NULL), nd[0]);
1455  contribute(0, NULL, CkReduction::sum_int, cb);
1456 
1457 }
int curTimeStep
Definition: Node.h:152

◆ updateGridScale() [1/2]

void Node::updateGridScale ( const char *  key,
Vector  scale 
)

Definition at line 1231 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(), simParameters, Vector::x, Vector::y, and Vector::z.

1231  {
1232  DebugM(4, "updateGridScale(char*, Vector) called on node " << CkMyPe() << "\n" << endi);
1233 
1234  int gridnum;
1235  MGridforceParams* mgridParams;
1236  if (key == NULL) {
1239  } else {
1240  gridnum = simParameters->mgridforcelist.index_for_key(key);
1241  mgridParams = simParameters->mgridforcelist.find_key(key);
1242  }
1243 
1244  if (gridnum < 0 || mgridParams == NULL) {
1245  NAMD_die("Node::updateGridScale(char*, Vector): Could not find grid.");
1246  }
1247 
1248  GridforceGrid* grid = molecule->get_gridfrc_grid(gridnum);
1249  if (grid == NULL) {
1250  NAMD_bug("Node::updateGridScale(char*, Vector): grid not found");
1251  }
1252  CProxy_Node(thisgroup).updateGridScale(gridnum, scale.x, scale.y, scale.z);
1253 
1254  DebugM(4, "updateGridScale(char*, Vector) finished\n" << endi);
1255 }
GridforceGrid * get_gridfrc_grid(int gridnum) const
Definition: Molecule.h:1363
SimParameters * simParameters
Definition: Node.h:181
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
BigReal z
Definition: Vector.h:74
int index_for_key(const char *key)
void NAMD_bug(const char *err_msg)
Definition: common.C:195
#define MGRIDFORCEPARAMS_DEFAULTKEY
MGridforceParams * find_key(const char *key)
BigReal x
Definition: Vector.h:74
void NAMD_die(const char *err_msg)
Definition: common.C:147
MGridforceParamsList mgridforcelist
BigReal y
Definition: Vector.h:74
Molecule * molecule
Definition: Node.h:179

◆ updateGridScale() [2/2]

void Node::updateGridScale ( int  gridnum,
float  sx,
float  sy,
float  sz 
)

Definition at line 1256 of file Node.C.

References MGridforceParamsList::at_index(), DebugM, endi(), Molecule::get_gridfrc_grid(), MGridforceParams::gridforceScale, SimParameters::mgridforcelist, molecule, NAMD_bug(), GridforceGrid::set_scale(), and simParameters.

1256  {
1257  if (CmiMyRank()) return;
1258  DebugM(4, "updateGridScale(char*, int, float, float, float) called on node " << CkMyPe() << "\n" << endi);
1259 
1260  GridforceGrid *grid = molecule->get_gridfrc_grid(gridnum);
1261  if (grid == NULL) {
1262  NAMD_bug("Node::updateGridScale(char*, int, float, float, float):grid not found");
1263  }
1264 
1265  Vector scale(sx,sy,sz);
1267  grid->set_scale( scale );
1268 #ifdef NODEGROUP_FORCE_REGISTER
1269  if(CkMyPe()==0)
1270  {
1271  CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1272  cpdata.setDeviceKernelUpdateCounter();
1273  }
1274 #endif
1275  DebugM(4, "updateGridScale(char*, int, float, float, float) finished\n" << endi);
1276 }
GridforceGrid * get_gridfrc_grid(int gridnum) const
Definition: Molecule.h:1363
Definition: Vector.h:72
SimParameters * simParameters
Definition: Node.h:181
#define DebugM(x, y)
Definition: Debug.h:75
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
void NAMD_bug(const char *err_msg)
Definition: common.C:195
MGridforceParamsList mgridforcelist
MGridforceParams * at_index(int idx)
Molecule * molecule
Definition: Node.h:179
virtual void set_scale(Vector s)=0

Member Data Documentation

◆ atomMap

AtomMap* Node::atomMap
protected

Definition at line 202 of file Node.h.

Referenced by Node(), and ~Node().

◆ colvars

colvarmodule* Node::colvars

Definition at line 187 of file Node.h.

Referenced by colvarproxy_namd::colvarproxy_namd(), and Node().

◆ computeMap

ComputeMap* Node::computeMap
protected

Definition at line 204 of file Node.h.

Referenced by startup(), and ~Node().

◆ computeMgr

ComputeMgr* Node::computeMgr

◆ configList

ConfigList* Node::configList

◆ coords

Vector* Node::coords

◆ curMFlopStep

int Node::curMFlopStep

Definition at line 157 of file Node.h.

Referenced by papiMeasureBarrier(), and resumeAfterPapiMeasureBarrier().

◆ curTimeStep

int Node::curTimeStep

Definition at line 152 of file Node.h.

Referenced by resumeAfterTraceBarrier(), and traceBarrier().

◆ imd

IMDOutput* Node::imd

◆ initRSS

float Node::initRSS

Definition at line 136 of file Node.h.

◆ initVM

float Node::initVM

Definition at line 136 of file Node.h.

◆ ldbCoordinator

LdbCoordinator* Node::ldbCoordinator
protected

Definition at line 205 of file Node.h.

◆ mallocTest_size

int Node::mallocTest_size

Definition at line 130 of file Node.h.

Referenced by mallocTestQd(), and startup().

◆ molecule

Molecule* Node::molecule

Definition at line 179 of file Node.h.

Referenced by Sequencer::addMovDragToPosition(), Sequencer::addRotDragToPosition(), CollectionMaster::CollectVectorInstanceDcdSelection::append(), WorkDistrib::assignNodeToPatch(), ComputeQMMgr::calcMOPAC(), ComputeQMMgr::calcORCA(), colvarproxy_namd::calculate(), ComputeQMMgr::calcUSR(), colvarproxy_namd::check_atom_id(), colvarproxy_namd::check_volmap_by_id(), ComputeGridForce::checkGridForceRatio(), SimParameters::close_dcdfile(), Controller::compareChecksums(), colvarproxy_namd::compute_volmap(), AngleElem::computeForce(), CrosstermElem::computeForce(), DihedralElem::computeForce(), ImproperElem::computeForce(), TholeElem::computeForce(), AnisoElem::computeForce(), BondElem::computeForce(), LjPmeCompute::computeNonbonded(), Controller::Controller(), Output::coordinate(), Output::coordinateNeeded(), WorkDistrib::createAtomLists(), ComputeMgr::createComputes(), ComputeGridForce::createGridForcedIdxList(), CudaPmeOneDevice::CudaPmeOneDevice(), ComputeConsForce::doForce(), ComputeConsTorque::doForce(), ComputeStir::doForce(), ComputeGridForce::doForce(), ComputeRestraints::doForce(), ComputePme::doQMWork(), dumpbench(), ComputeLjPmeSerialMgr::getLJparameters(), Controller::getTotalPotentialEnergy(), GlobalMasterEasy::GlobalMasterEasy(), GlobalMasterFreeEnergy::GlobalMasterFreeEnergy(), GlobalMasterSymmetry::GlobalMasterSymmetry(), GlobalMasterTMD::GlobalMasterTMD(), HomePatch::hardWallDrude(), colvarproxy_namd::init_atom_group(), colvarproxy_namd::init_atoms_map(), colvarproxy_namd::init_volmap_by_name(), ComputeQM::initialize(), ParallelIOMgr::initialize(), Sequencer::integrate_SOA(), Sequencer::langevinPiston(), Sequencer::langevinVelocities(), Sequencer::langevinVelocitiesBBK1(), Sequencer::langevinVelocitiesBBK2(), LJTable::LJTable(), ComputeHomeTuples< TholeElem, Thole, TholeValue >::loadTuples(), HomePatch::loweAndersenVelocities(), HomePatch::minimize_rattle2(), HomePatch::mollyAverage(), HomePatch::mollyMollify(), Controller::monteCarloPressure_accept(), Controller::multigatorCalcEnthalpy(), Node(), WorkDistrib::patchMapInit(), Controller::printEnergies(), Controller::printMinimizeEnergies(), HomePatch::qmSwapAtoms(), HomePatch::rattle1old(), HomePatch::rattle2(), Controller::receivePressure(), ComputeMgr::recvComputeConsForceMsg(), ComputeMsmSerialMgr::recvCoord(), ComputeExtMgr::recvCoord(), ComputeLjPmeSerialMgr::recvCoord(), ComputeFmmSerialMgr::recvCoord(), ComputeGBISserMgr::recvCoord(), ComputeQMMgr::recvPartQM(), reloadCharges(), Sequencer::reloadCharges(), reloadGridforceGrid(), reloadStructure(), Controller::rescaleaccelMD(), Sequencer::rescaleSoluteCharges(), resendMolecule(), resendMolecule2(), saveMolDataPointers(), ComputeQM::saveResults(), ComputeNonbondedUtil::select(), HomePatch::setGBISIntrinsicRadii(), HomePatch::setLcpoType(), startup(), Tcl_centerOfMass(), Tcl_centerOfNumber(), Tcl_loadCoords(), Tcl_radiusOfGyration(), Sequencer::tcoupleVelocities(), colvarproxy_namd::update_atom_properties(), colvarproxy_namd::update_atoms_map(), colvarproxy_namd::update_group_properties(), ComputeLonepairsCUDA::updateAtoms(), updateGridScale(), wrap_coor_int(), and wrap_coor_int_dcd_selection().

◆ output

Output* Node::output

◆ parameters

Parameters* Node::parameters

◆ patchMap

PatchMap* Node::patchMap
protected

Definition at line 203 of file Node.h.

Referenced by Node(), and ~Node().

◆ pdb

PDB* Node::pdb

◆ rand

Random* Node::rand

◆ simParameters

SimParameters* Node::simParameters

Definition at line 181 of file Node.h.

Referenced by HomePatch::addForceToMomentum(), HomePatch::addForceToMomentum3(), HomePatch::addVelocityToPosition(), WorkDistrib::assignNodeToPatch(), PmeZPencil::backward_fft(), PmeYPencil::backward_fft(), PmeXPencil::backward_fft(), HomePatch::boxClosed(), HomePatch::buildRattleList(), HomePatch::buildRattleList_SOA(), ComputePmeMgr::chargeGridSubmitted(), CudaPmeOneDevice::checkPatchLevelLatticeCompatibilityAndComputeOffsets(), colvarproxy_namd::colvarproxy_namd(), CudaPmeOneDevice::compute(), ComputeCylindricalBC::ComputeCylindricalBC(), ComputeEwald::ComputeEwald(), AngleElem::computeForce(), CrosstermElem::computeForce(), DihedralElem::computeForce(), ImproperElem::computeForce(), TholeElem::computeForce(), AnisoElem::computeForce(), BondElem::computeForce(), ExclElem::computeForce(), GromacsPairElem::computeForce(), ComputeFullDirect::ComputeFullDirect(), ComputeGlobal::ComputeGlobal(), ComputeHomeTuples< TholeElem, Thole, TholeValue >::ComputeHomeTuples(), ComputeLCPO::ComputeLCPO(), ComputeMsm::ComputeMsm(), ComputeNonbondedPair::ComputeNonbondedPair(), ComputeNonbondedSelf::ComputeNonbondedSelf(), ComputePme::ComputePme(), ComputeRestraints::ComputeRestraints(), ComputeSphericalBC::ComputeSphericalBC(), ComputeStir::ComputeStir(), ComputeTclBC::ComputeTclBC(), Output::coordinate(), Output::coordinateNeeded(), WorkDistrib::createAtomLists(), ComputeMgr::createComputes(), ComputeCUDAMgr::createCudaComputeNonbonded(), ComputeCUDAMgr::createCudaGlobalMaster(), ComputeCUDAMgr::createCudaPmeOneDevice(), LdbCoordinator::createLoadBalancer(), CudaComputeNonbonded::CudaComputeNonbonded(), CudaPmeOneDevice::CudaPmeOneDevice(), HomePatch::depositMigration(), ComputeConsForce::doForce(), ComputeEField::doForce(), ComputeConsTorque::doForce(), ComputeStir::doForce(), ComputeNonbondedPair::doForce(), ComputeNonbondedSelf::doForce(), ComputeGridForce::doForce(), ComputeRestraints::doForce(), HomePatch::doGroupSizeCheck(), HomePatch::doGroupSizeCheck_SOA(), HomePatch::doMarginCheck(), HomePatch::doMarginCheck_SOA(), HomePatch::doPairlistCheck(), ComputeTclBC::doWork(), ComputeGBISser::doWork(), ComputeGlobal::doWork(), CudaComputeNonbonded::doWork(), dumpbench(), HomePatch::exchangeAtoms(), HomePatch::exchangeCheckpoint(), PmeZPencil::fft_init(), PmeYPencil::fft_init(), PmeXPencil::fft_init(), CudaPmeOneDevice::finishReduction(), Output::force(), Output::forceNeeded(), PmeZPencil::forward_fft(), PmeYPencil::forward_fft(), PmeXPencil::forward_fft(), ComputePmeCUDADevice::gatherForce(), ComputePmeCUDADevice::gatherForceDone(), HomePatch::gbisComputeAfterP1(), HomePatch::gbisComputeAfterP2(), GlobalMasterIMD::get_vmd_forces(), ComputeLjPmeSerialMgr::getLJparameters(), GlobalMasterFreeEnergy::GlobalMasterFreeEnergy(), GlobalMasterIMD::GlobalMasterIMD(), GlobalMasterServer::GlobalMasterServer(), GlobalMasterSymmetry::GlobalMasterSymmetry(), GlobalMasterTMD::GlobalMasterTMD(), HomePatch::hardWallDrude(), ComputePmeCUDA::initialize(), LjPmeCompute::initialize(), LdbCoordinator::initialize(), ComputeQM::initialize(), CudaComputeNonbonded::initialize(), ParallelIOMgr::initialize(), ComputeMsmMgr::initialize(), ComputePmeMgr::initialize(), ComputePmeCUDADevice::initialize(), ComputePmeMgr::initialize_computes(), ComputePmeMgr::initialize_pencils(), isPmeProcessor(), CudaComputeNonbonded::launchWork(), LJTable::LJTable(), ComputeHomeTuples< TholeElem, Thole, TholeValue >::loadTuples(), HomePatch::loweAndersenVelocities(), WorkDistrib::mapComputes(), ComputePmeCUDADevice::mergeForcesOnPatch(), HomePatch::minimize_rattle2(), HomePatch::mollyAverage(), HomePatch::mollyMollify(), Controller::multigatorCalcEnthalpy(), NamdHybridLB::NamdHybridLB(), Node(), PmePencil< CBase_PmeZPencil >::order_init(), outputPatchComputeMaps(), Patch::Patch(), PatchDataSOA_set_buffer(), PatchDataSOA_set_size(), WorkDistrib::patchMapInit(), Compute::patchReady(), Patch::positionsReady(), HomePatch::positionsReady(), HomePatch::positionsReady_SOA(), HomePatch::qmSwapAtoms(), HomePatch::rattle1(), HomePatch::rattle1_SOA(), HomePatch::rattle1old(), HomePatch::rattle2(), ProxyPatch::receiveAll(), ProxyPatch::receiveData(), CollectionMaster::receiveDataStream(), recursive_bisect_with_curve(), ComputePmeCUDADevice::recvAtoms(), ComputePmeCUDADevice::recvAtomsFromNeighbor(), HomePatch::recvCheckpointLoad(), ComputeMsmSerialMgr::recvCoord(), ComputeExtMgr::recvCoord(), ComputeLjPmeSerialMgr::recvCoord(), ComputeFmmSerialMgr::recvCoord(), ComputeMgr::recvCudaGlobalMasterCreateMsg(), ComputeMgr::recvCudaGlobalMasterRemoveMsg(), ComputeMgr::recvCudaGlobalMasterUpdateMsg(), HomePatch::recvExchangeMsg(), ComputeQMMgr::recvPartQM(), ComputeGlobal::recvResults(), reloadGridforceGrid(), resendMolecule(), CudaComputeNonbonded::reSortTileLists(), resumeAfterPapiMeasureBarrier(), HomePatch::revert(), ScriptTcl::run(), saveMolDataPointers(), WorkDistrib::savePatchMap(), ComputeGlobal::saveTotalForces(), scriptParam(), ComputePmeUtil::select(), ComputeNonbondedUtil::select(), PmeZPencil::send_all_ungrid(), PmeZPencil::send_trans(), PmeYPencil::send_trans(), PmeYPencil::send_untrans(), PmeXPencil::send_untrans(), ComputePmeCUDADevice::sendAtomsToNeighbor(), ComputeMgr::sendComputeGlobalData(), ComputeMgr::sendComputeGlobalResults(), ComputePmeCUDADevice::sendForcesToNeighbors(), WorkDistrib::sendPatchMap(), ComputePmeMgr::sendTrans(), ComputePmeMgr::sendUngrid(), ComputePmeMgr::sendUntrans(), HomePatch::setGBISIntrinsicRadii(), PatchMgr::setLattice(), ComputeLjPmeSerialMgr::setLJparameters(), ComputePmeCUDAMgr::setupPencils(), NamdHybridLB::splitComputes(), ComputePmeCUDADevice::spreadCharge(), startup(), NamdCentLB::Strategy(), CollectionMgr::submitForces(), PmePencilXYZ::submitReductions(), PmePencilZ::submitReductions(), ComputePmeMgr::submitReductions(), ComputePme::ungridForces(), updateGridScale(), ComputeMgr::updateLocalComputes4(), Output::velocity(), Output::velocityNeeded(), wrap_coor_int(), and wrap_coor_int_dcd_selection().

◆ specialTracing

bool Node::specialTracing

Definition at line 166 of file Node.h.

Referenced by Node().

◆ state

NamdState* Node::state

◆ workDistrib

WorkDistrib* Node::workDistrib

Definition at line 169 of file Node.h.

Referenced by ParallelIOMgr::createHomePatches(), and startup().


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