NAMD
Node.C
Go to the documentation of this file.
1 
7 /*
8  Toplevel routines for initializing a Node for a simulation
9  one Node per Pe (processor element).
10 */
11 
12 #if !defined(WIN32) || defined(__CYGWIN__)
13 #include <unistd.h>
14 #endif
15 #include "InfoStream.h"
16 #include "Node.decl.h"
17 #include "Node.h"
18 #ifdef DPMTA
19 #include <pvm3.h>
20 #endif
21 
22 #include "ProcessorPrivate.h"
23 
24 #define MIN_DEBUG_LEVEL 3
25 //#define DEBUGM
26 #include "Debug.h"
27 
28 #include <stdio.h>
29 #include <converse.h>
30 #include "memusage.h"
31 #include "IMDOutput.h"
32 #include "Lattice.h"
33 #include "ComputeMsmMsa.h" // needed for MsmMsaData definition
34 #include "ComputeMsm.h" // needed for MsmInitMsg definition
35 #include "main.decl.h"
36 #include "main.h"
37 #include "WorkDistrib.h"
38 #include "PatchMgr.h"
39 #include "Patch.h"
40 #include "Compute.h"
41 #include "ComputeMap.h"
42 #include "ComputeMgr.h"
43 #include "Molecule.h"
44 #include "HomePatchList.h"
45 #include "AtomMap.h"
46 #include "Sequencer.h"
47 #include "Controller.h"
48 #include "NamdState.h"
49 #include "Output.h"
50 #include "ProxyMgr.h"
51 #include "PatchMap.h"
52 #include "PatchMap.inl"
53 #include "Parameters.h"
54 #include "SimParameters.h"
55 #include "Communicate.h"
56 #include "LdbCoordinator.h"
57 #include "ScriptTcl.h"
58 #include "ComputeMgr.decl.h"
59 #include "ComputePmeMgr.decl.h"
60 // #ifdef NAMD_CUDA
61 #include "ComputeCUDAMgr.decl.h"
62 #include "ComputeCUDAMgr.h"
63 #include "ComputePmeCUDAMgr.decl.h"
64 #include "ComputePmeCUDAMgr.h"
65 // #endif
66 #include "ComputeGridForceMgr.decl.h"
67 #include "Sync.h"
68 #include "BackEnd.h"
69 #include "PDB.h"
70 #include "packmsg.h"
71 #include "CollectionMgr.decl.h"
72 #include "ParallelIOMgr.decl.h"
73 #include "Vector.h"
74 // BEGIN LA
75 #include "Random.h"
76 // END LA
77 #include "PatchData.h"
78 #include "DeviceCUDA.h"
79 #include "Thread.h"
80 #include "GlobalGPUMgr.h"
81 #include "SynchronousCollectives.h"
82 
83 #include "NamdEventsProfiling.h"
84 
85 #if(CMK_CCS_AVAILABLE && CMK_WEB_MODE)
86 extern "C" void CApplicationInit();
87 #endif
88 
89 #include "DumpBench.h"
90 
91 #ifdef NAMD_CUDA
92 extern __thread DeviceCUDA *deviceCUDA;
93 #endif
94 
95 class CheckpointMsg : public CMessage_CheckpointMsg {
96 public:
97  int task;
98  int replica;
100  char *key;
101 };
102 
103 extern "C" {
104  void recvCheckpointCReq_handler(envelope*);
105  void recvCheckpointCAck_handler(envelope*);
106 }
107 
108 #if defined(CMK_BALANCED_INJECTION_API) && CMK_BALANCED_INJECTION_API != 0
109 #include "ckBIconfig.h"
110 #endif
111 
112 #include "CollectionMgr.h"
113 #include "CollectionMaster.h"
114 #include "CollectionMgr.decl.h"
115 #include "CollectionMaster.decl.h"
116 
117 #if USE_HPM
118 extern "C" void HPM_Init(int);
119 extern "C" void HPM_Start(char *label, int);
120 extern "C" void HPM_Stop(char *label, int);
121 extern "C" void HPM_Print(int, int);
122 #endif
123 
124 #if defined(NAMD_MIC)
125  extern void mic_dumpHostDeviceComputeMap();
126  extern void mic_initHostDeviceLDB();
127 #endif
128 
129 #ifdef MEASURE_NAMD_WITH_PAPI
130 #include "papi.h"
131 #if CMK_SMP
132 #include <pthread.h>
133 #endif
134 #define NUM_PAPI_EVENTS 6
135 CkpvDeclare(int *, papiEvents);
136 
137 #define MEASURE_PAPI_SPP 1
138 #define MEASURE_PAPI_CACHE 0
139 #define MEASURE_PAPI_FLOPS 0
140 
141 static void namdInitPapiCounters(){
142  if(CkMyRank()==0){
143  //only initialize per OS process (i.e. a charm node)
144  int retval = PAPI_library_init(PAPI_VER_CURRENT);
145  if(retval != PAPI_VER_CURRENT) {
146  if(CkMyPe()==0){
147  NAMD_die("PAPI library is not compatitible!");
148  }
149  }
150  #if CMK_SMP
151  //now only consider systems that are compatible with POSIX
152  if(PAPI_thread_init(pthread_self)!=PAPI_OK) {
153  if(CkMyPe()==0){
154  NAMD_die("Multi-thread mode in PAPI could not be initialized!");
155  }
156  }
157  #endif
158  }
159  CkpvInitialize(int *, papiEvents);
160  CkpvAccess(papiEvents) = new int[NUM_PAPI_EVENTS+1];
161 
162 #if MEASURE_PAPI_CACHE
163  if(PAPI_query_event(PAPI_L1_DCM)==PAPI_OK) {
164  CkpvAccess(papiEvents)[0] = PAPI_L1_DCM;
165  }else{
166  if(CkMyPe()==0){
167  CkPrintf("WARNING: PAPI_L1_DCM doesn't exsit on this platform!\n");
168  }
169  //if not default to PAPI_TOT_INS
170  CkpvAccess(papiEvents)[0] = PAPI_TOT_INS;
171  }
172 
173  if(PAPI_query_event(PAPI_L2_DCM)==PAPI_OK) {
174  CkpvAccess(papiEvents)[1] = PAPI_L2_DCM;
175  }else{
176  //if not default to PAPI_TOT_CYC
177  CkpvAccess(papiEvents)[1] = PAPI_TOT_CYC;
178  }
179 #elif MEASURE_PAPI_FLOPS
180  if(PAPI_query_event(PAPI_FP_INS)==PAPI_OK) {
181  CkpvAccess(papiEvents)[0] = PAPI_FP_INS;
182  }else{
183  if(CkMyPe()==0){
184  CkPrintf("WARNING: PAPI_FP_INS doesn't exsit on this platform!\n");
185  }
186  //if not default to PAPI_TOT_INS
187  CkpvAccess(papiEvents)[0] = PAPI_TOT_INS;
188  }
189 
190  if(PAPI_query_event(PAPI_FMA_INS)==PAPI_OK) {
191  CkpvAccess(papiEvents)[1] = PAPI_FMA_INS;
192  }else{
193  //if not default to PAPI_TOT_CYC
194  CkpvAccess(papiEvents)[1] = PAPI_TOT_CYC;
195  }
196 #elif MEASURE_PAPI_SPP
197 /* for SPP we record these
198 1) PAPI_FP_OPS
199 2) PAPI_TOT_INS
200 3) perf::PERF_COUNT_HW_CACHE_LL:MISS
201 4) DATA_PREFETCHER:ALL
202 5) PAPI_L1_DCA
203 6) INSTRUCTION_FETCH_STALL
204 7) PAPI_TOT_CYC, and
205 8) real (wall) time
206 */
207  int papiEventSet = PAPI_NULL;
208  if (PAPI_create_eventset(&papiEventSet) != PAPI_OK) {
209  CmiAbort("PAPI failed to create event set!\n");
210  }
211 
212  if(PAPI_query_event(PAPI_FP_OPS)==PAPI_OK) {
213  CkpvAccess(papiEvents)[0] = PAPI_FP_OPS;
214  }else{
215  if(CkMyPe()==0){
216  CkAbort("WARNING: PAPI_FP_OPS doesn't exist on this platform!");
217  }
218  }
219  if(PAPI_query_event(PAPI_TOT_INS)==PAPI_OK) {
220  CkpvAccess(papiEvents)[1] = PAPI_TOT_INS;
221  }else{
222  if(CkMyPe()==0){
223  CkAbort("WARNING: PAPI_TOT_INS doesn't exist on this platform!");
224  }
225  }
226  int EventCode;
227  int ret;
228  ret=PAPI_event_name_to_code("perf::PERF_COUNT_HW_CACHE_LL:MISS",&EventCode);
229  if(ret==PAPI_OK && PAPI_query_event(EventCode)==PAPI_OK) {
230  CkpvAccess(papiEvents)[2] = EventCode;
231  }else{
232  if(CkMyPe()==0){
233  CkAbort("WARNING: perf::PERF_COUNT_HW_CACHE_LL:MISS doesn't exist on this platform!");
234  }
235  }
236  ret=PAPI_event_name_to_code("DATA_PREFETCHER:ALL",&EventCode);
237  if(ret==PAPI_OK && PAPI_query_event(EventCode)==PAPI_OK) {
238  CkpvAccess(papiEvents)[3] = EventCode;
239  }else{
240  if(CkMyPe()==0){
241  CkAbort("WARNING: DATA_PREFETCHER:ALL doesn't exist on this platform!");
242  }
243  }
244  if(PAPI_query_event(PAPI_L1_DCA)==PAPI_OK) {
245  CkpvAccess(papiEvents)[4] = PAPI_L1_DCA;
246  }else{
247  if(CkMyPe()==0){
248  CkAbort("WARNING: PAPI_L1_DCA doesn't exist on this platform!");
249  }
250  }
251  /* ret=PAPI_event_name_to_code("INSTRUCTION_FETCH_STALL",&EventCode);
252  if(ret==PAPI_OK && PAPI_query_event(EventCode)==PAPI_OK) {
253  CkpvAccess(papiEvents)[5] = EventCode;
254  }else{
255  if(CkMyPe()==0){
256  CkAbort("WARNING: INSTRUCTION_FETCH_STALL doesn't exist on this platform!");
257  }
258  }
259  */
260  if(PAPI_query_event(PAPI_TOT_CYC)==PAPI_OK) {
261  CkpvAccess(papiEvents)[5] = PAPI_TOT_CYC;
262  }else{
263  if(CkMyPe()==0){
264  CkAbort("WARNING: PAPI_TOT_CYC doesn't exist on this platform!");
265  }
266  }
267  for(int i=0;i<NUM_PAPI_EVENTS;i++)
268  {
269  int papiRetValue=PAPI_add_events(papiEventSet, &CkpvAccess(papiEvents)[i],1);
270  if (papiRetValue != PAPI_OK) {
271  CkPrintf("failure for event %d\n",i);
272  if (papiRetValue == PAPI_ECNFLCT) {
273  CmiAbort("PAPI events conflict! Please re-assign event types!\n");
274  } else {
275  CmiAbort("PAPI failed to add designated events!\n");
276  }
277  }
278 
279  }
280 #endif
281 }
282 #endif
283 
284 #ifdef OPENATOM_VERSION
285 static void startOA(){(char inDriverFile[1024], char inPhysicsFile[1024], CkCallback doneCB)
286 {
287  CProxy_oaSetup moaInstance = CProxy_oaSetup::ckNew(inDriverFile, inPhysicsFile, doneCB);
288 }
289 #endif //OPENATOM_VERSION
290 
291 //======================================================================
292 // Public Functions
293 
294 //----------------------------------------------------------------------
295 
297 double startupTime;
298 
299 //----------------------------------------------------------------------
300 // BOC constructor
302 {
303  DebugM(4,"Creating Node\n");
304 #if(CMK_CCS_AVAILABLE && CMK_WEB_MODE)
305  CApplicationInit();
306 #endif
307  if (CkpvAccess(Node_instance) == 0) {
308  CkpvAccess(Node_instance) = this;
309  eventEndOfTimeStep = traceRegisterUserEvent("EndOfTimeStep", 135);
310  } else {
311  NAMD_bug("Node::Node() - another instance of Node exists!");
312  }
313 
314  CkpvAccess(BOCclass_group) = msg->group;
315  delete msg;
316 
317  CkpvAccess(BOCclass_group).node = thisgroup;
318 
319  recvCheckpointCReq_index = CmiRegisterHandler((CmiHandler)recvCheckpointCReq_handler);
320  recvCheckpointCAck_index = CmiRegisterHandler((CmiHandler)recvCheckpointCAck_handler);
321 
322  startupPhase = 0;
323 
324  molecule = NULL;
325  parameters = NULL;
326  simParameters = NULL;
327  configList = NULL;
328  pdb = NULL;
329  state = NULL;
330  output = NULL;
331  imd = new IMDOutput;
332  colvars = 0;
333 
334 #if USE_HPM
335  // assumes that this will be done only on BG/P
336  TopoManager *tmgr = new TopoManager();
337  int x, y, z;
338  tmgr->rankToCoordinates(CkMyPe(), x, y, z, localRankOnNode);
339  delete tmgr;
340 #endif
341 
342  specialTracing = traceAvailable() && (traceIsOn()==0);
343 
344  DebugM(4,"Creating PatchMap, AtomMap, ComputeMap\n");
347  if ( CkMyRank() == 0 ) ComputeMap::Instance();
348 
349  //Note: Binding BOC vars such as workDistrib has been moved
350  //to the 1st phase of startup because the in-order message delivery
351  //is not always guaranteed --Chao Mei
352 #if defined(CMK_BALANCED_INJECTION_API) && CMK_BALANCED_INJECTION_API != 0
353  if(CkMyRank() == 0){
354  balancedInjectionLevel=ck_get_GNI_BIConfig();
355  // CkPrintf("[%d] get retrieved BI=%d\n",CkMyPe(),balancedInjectionLevel);
356  ck_set_GNI_BIConfig(20);
357  // CkPrintf("[%d] set retrieved BI=%d\n",CkMyPe(),ck_get_GNI_BIConfig());
358  }
359 #endif
360 
361 }
362 
363 //----------------------------------------------------------------------
364 // ~Node(void) needs to clean up everything.
365 
367 {
368  delete imd;
369  delete output;
370  delete computeMap;
371  delete atomMap;
372  delete patchMap;
373  delete CkpvAccess(comm);
374  // BEGIN LA
375  delete rand;
376  // END LA
377 #ifdef MEASURE_NAMD_WITH_PAPI
378  delete CkpvAccess(papiEvents);
379 #endif
380 }
381 
382 void Node::bindBocVars(){
383  DebugM(4,"Binding to BOC's\n");
384  CProxy_PatchMgr pm(CkpvAccess(BOCclass_group).patchMgr);
385  patchMgr = pm.ckLocalBranch();
386  CProxy_ProxyMgr prm(CkpvAccess(BOCclass_group).proxyMgr);
387  proxyMgr = prm.ckLocalBranch();
388  CProxy_WorkDistrib wd(CkpvAccess(BOCclass_group).workDistrib);
389  workDistrib = wd.ckLocalBranch();
390  CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
391  computeMgr = cm.ckLocalBranch();
392  CProxy_LdbCoordinator lc(CkpvAccess(BOCclass_group).ldbCoordinator);
393  ldbCoordinator = lc.ckLocalBranch();
394  #ifdef MEM_OPT_VERSION
395  CProxy_ParallelIOMgr io(CkpvAccess(BOCclass_group).ioMgr);
396  ioMgr = io.ckLocalBranch();
397  #endif
398 
399 }
400 
401 //----------------------------------------------------------------------
402 // Malloc Test Sequence
403 void Node::mallocTest(int step) {
404  int MB = 1024*1024;
405  int size = 100;
406  char* foo = (char*) malloc(size*MB);
407  if ( ! foo ) {
408  char buf[256];
409  sprintf(buf,"Malloc fails on Pe %d at %d MB.\n",CkMyPe(),step*size);
410  NAMD_die(buf);
411  }
412  memset(foo,0,size*MB*sizeof(char));
413 }
414 
416  if ( mallocTest_size ) {
417  CkPrintf("All PEs successfully allocated %d MB.\n", 100*mallocTest_size);
418  } else {
419  CkPrintf("Starting malloc test on all PEs.\n");
420  }
421  fflush(stdout);
422  ++mallocTest_size;
423  CkStartQD(CkIndex_Node::mallocTestQd(), &thishandle);
424  (CProxy_Node(CkpvAccess(BOCclass_group).node)).mallocTest(mallocTest_size);
425 }
426 
427 //----------------------------------------------------------------------
428 // Startup Sequence
429 
431  (CProxy_Node(CkpvAccess(BOCclass_group).node)).startup();
432 }
433 
437 
438 extern void registerUserEventsForAllComputeObjs(void);
439 
440 
441 /*
442  * This function will initialize the GlobalGPUMgr and finish the initialization
443  * process for SynchronousCollectives. This is executed in a separate converse
444  * thread with high priority and default strategy to avoid hanging
445  */
446 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
449  GlobalGPUMgr* globalGPUMgr = GlobalGPUMgr::Object();
450  syncColl->forceBarrierAll();
451  globalGPUMgr->initialize();
452  syncColl->initMasterScope(
453  globalGPUMgr->getIsMasterPe(), globalGPUMgr->getIsMasterDevice(),
454  globalGPUMgr->getNumDevices(), globalGPUMgr->getDeviceIndex(),
455  globalGPUMgr->getDeviceIndexToPeMap()
456  );
457  globalGPUMgr->initializeBackends();
458  CthFree(CthSelf());
459 }
460 #endif /* defined(NAMD_CUDA) || defined(NAMD_HIP) */
461 
463  NAMD_EVENT_START(1, NamdProfileEvent::NAMD_STARTUP);
464 
465  int gotoRun = false;
466  double newTime;
467 
468  if (!CkMyPe()) {
469  if (!startupPhase) {
470  iout << iINFO << "\n";
471  startupTime = CmiWallTimer();
472  iout << iINFO << "Entering startup at " << startupTime << " s, ";
473  } else {
474  newTime = CmiWallTimer();
475  iout << iINFO << "Startup phase " << startupPhase-1 << " took "
476  << newTime - startupTime << " s, ";
477  startupTime = newTime;
478  }
479  iout << memusage_MB() << " MB of memory in use\n" << endi;
480  fflush(stdout);
481  }
482  switch (startupPhase) {
483 
484  case 0:
486  namdOneCommInit(); // Namd1.X style
487  break;
488 
489  case 1:
490  bindBocVars();
491 
492  // send & receive molecule, simparameters... (Namd1.X style)
493  if (CkMyPe()) {
494  namdOneRecv();
495  } else {
496  namdOneSend();
497  }
498  break;
499 
500  case 2:
501  // fix up one-per-node objects (for SMP version)
505 
508 
509  #if !CMK_SMP || ! USE_CKLOOP
510  //the CkLoop library should be only used in SMP mode
512  #else
513  if ( CkNumPes() < 2 * CkNumNodes() ) simParameters->useCkLoop = 0;
514  #endif
515 
516 
517  if ( simParameters->mallocTest ) {
518  if (!CkMyPe()) {
519  mallocTest_size = 0;
520  CkStartQD(CkIndex_Node::mallocTestQd(), &thishandle);
521  }
522  return;
523  }
524 
525 
526  #ifdef MEASURE_NAMD_WITH_PAPI
527  if(simParameters->papiMeasure) namdInitPapiCounters();
528  #endif
529 
530  #ifdef MEM_OPT_VERSION
531  //At this point, each Node object has received the simParameters,
532  //parameters and the atom signatures info from the master Node
533  //(proc 0). It's time to initialize the parallel IO manager and
534  //read the binary per-atom file --Chao Mei
535 
536  //Step 1: initialize the parallel IO manager per Node
537  ioMgr->initialize(this);
538  #endif
539 
540  break;
541 
542  case 3:
543 
544  #ifdef MEM_OPT_VERSION
545  //Step 2: read the binary per-atom files (signater index, coordinates etc.)
546  ioMgr->readPerAtomInfo();
548  if(!CkMyPe())
549  ioMgr->sendDcdParams();
550  #endif
551 
552  break;
553 
554  case 4:
555 
556  #ifdef MEM_OPT_VERSION
557  //Step 3: update counters of tuples and exclusions inside Molecule object
558  ioMgr->updateMolInfo();
559 
560  //Step 4: prepare distributing the atoms to neighboring procs if necessary
561  ioMgr->migrateAtomsMGrp();
562 
563  //step 5: initialize patchMap and send it to every other processors
564  //to decide atoms to patch distribution on every input processor
565  if(!CkMyPe()) {
566  workDistrib->patchMapInit(); // create space division
568  }
569  #endif
570 
571  #if USE_HPM
572  HPM_Init(localRankOnNode);
573  #endif
574 
575  // take care of inital thread setting
576  threadInit();
577 
578  // create blank AtomMap
580 
581  if (!CkMyPe()) {
582 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
583  if (simParameters->usePMECUDA) {
584  // computePmeCUDAMgr was created in BackEnd.C
585  // This empty branch is to avoid initializing ComputePmeMgr
586  } else
587 #endif
588  if (simParameters->PMEOn) {
589  CkpvAccess(BOCclass_group).computePmeMgr = CProxy_ComputePmeMgr::ckNew();
590  }
591  #ifdef OPENATOM_VERSION
592  if ( simParameters->openatomOn ) {
593  CkpvAccess(BOCclass_group).computeMoaMgr = CProxy_ComputeMoaMgr::ckNew();
594  }
595  #endif // OPENATOM_VERSION
596 
597  }
598 
599  #ifdef OPENATOM_VERSION
600  if ( simParameters->openatomOn ) {
601  // if ( ! CkMyPe() ) {
602  CkCallback doneMoaStart(CkIndexmain::doneMoaSetup(), thishandle);
603  startOA(simParameters->moaDriverFile, simParameters->moaPhysicsFile, doneMoaStart);
604  // }
605  }
606  #endif // OPENATOM_VERSION
607 
608  // BEGIN LA
610  rand->split(CkMyPe(), CkNumPes());
611  // END LA
612 
613  break;
614 
615  case 5:
616  #ifdef MEM_OPT_VERSION
617  //Now, every input proc has received all the atoms necessary
618  //to decide the patches those atoms belong to
619 
620  //step 1: integrate the migrated atoms into the atom list that
621  //contains the initally distributed atoms, and sort the atoms
622  //based on hydrogenList value
623  ioMgr->integrateMigratedAtoms();
624 
625  //step 2: integrate the cluster size of each atom on each output proc
626  ioMgr->integrateClusterSize();
627 
628  //step 3: calculate the number of atoms in each patch on every
629  //input procs (atoms belonging to a patch may lie on different
630  //procs), and reduce such info on proc 0. Such info is required
631  //for determing which node a particular patch is assigned to.
632  ioMgr->calcAtomsInEachPatch();
633 
634  //set to false to re-send PatchMap later
636  #endif
637  break;
638  case 6:
641  }
644  }
647  }
648  #ifdef PROCTRACE_DEBUG
649  DebugFileTrace::Instance("procTrace");
650  #endif
651 
652  if (!CkMyPe()) {
653  output = new Output; // create output object just on PE(0)
654 
655  #ifndef MEM_OPT_VERSION
656  workDistrib->patchMapInit(); // create space division
657  workDistrib->createHomePatches(); // load atoms into HomePatch(es)
658  #endif
659 
662  //ComputeMap::Object()->printComputeMap();
663 
664  // For MIC runs, take the additional step after the compute map has been created to
665  // assign the various computes to either the host or the device. This info will
666  // be distributed across the PEs.
667  #if defined(NAMD_MIC)
668  mic_initHostDeviceLDB();
669  #endif
670 
672  iout << iINFO << "Simulating initial mapping with " << simParameters->simulatedPEs
673  << " PEs with " << simParameters->simulatedNodeSize << " PEs per node\n" << endi;
674  outputPatchComputeMaps("init_mapping", 0);
675  iout << iINFO << "Simulating initial mapping is done, now NAMD exits\n" << endi;
676  BackEnd::exit();
677  }
678 
680 
681  //in MEM_OPT_VERSION, patchMap is resent
682  //because they have been updated since creation including
683  //#atoms per patch, the proc a patch should stay etc. --Chao Mei
685  #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
686  CProxy_NodeProxyMgr npm(CkpvAccess(BOCclass_group).nodeProxyMgr);
687  //a node broadcast
688  npm.createProxyInfo(PatchMap::Object()->numPatches());
689  #endif
690  }
691  {
692  #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
693  CProxy_NodeProxyMgr npm(CkpvAccess(BOCclass_group).nodeProxyMgr);
694  if(CkMyRank()==0) {
695  //just need to register once
696  npm[CkMyNode()].ckLocalBranch()->registerLocalProxyMgr(CkpvAccess(BOCclass_group).proxyMgr);
697  }
698  npm[CkMyNode()].ckLocalBranch()->registerLocalPatchMap(CkMyRank(), PatchMap::Object());
699  #endif
700  }
701  break;
702 
703  case 7:
704 #ifdef CHARM_HAS_MSA
706  CProxy_ComputeMsmMsaMgr msm(CkpvAccess(BOCclass_group).computeMsmMsaMgr);
707  msm[CkMyPe()].initialize(new CkQdMsg);
708  }
709 #else
711  CProxy_ComputeMsmMgr msm(CkpvAccess(BOCclass_group).computeMsmMgr);
712  MsmInitMsg *msg = new MsmInitMsg;
713  Lattice lattice = simParameters->lattice; // system lattice vectors
714  ScaledPosition smin=0, smax=0;
715  if (lattice.a_p() && lattice.b_p() && lattice.c_p()) {
716  msg->smin = smin;
717  msg->smax = smax;
718  msm[CkMyPe()].initialize(msg); // call from my own PE
719  }
720  else if ( ! CkMyPe() ) {
721  pdb->get_extremes(smin, smax); // only available on PE 0
722  msg->smin = smin;
723  msg->smax = smax;
724  msm.initialize(msg); // broadcast to chare group
725  }
726 
727  /*
728  CProxy_Node nd(CkpvAccess(BOCclass_group).node);
729  Node *node = nd.ckLocalBranch();
730  ScaledPosition smin, smax;
731  node->pdb->get_extremes(smin, smax);
732  msg->smin = smin; // extreme positions in system
733  msg->smax = smax;
734  msm[CkMyPe()].initialize(msg);
735  */
736  }
737 #endif
738 
739  if ( simParameters->PMEOn ) {
740  #ifdef OPENATOM_VERSION
741  if ( simParameters->openatomOn ) {
742  CProxy_ComputeMoaMgr moa(CkpvAccess(BOCclass_group).computeMoaMgr);
743  moa[CkMyPe()].initialize(new CkQdMsg);
744  }
745  #endif // OPENATOM_VERSION
746 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
747  if ( simParameters->usePMECUDA ) {
748  if(CkMyRank()==0) {
749  CProxy_ComputePmeCUDAMgr pme(CkpvAccess(BOCclass_group).computePmeCUDAMgr);
750  pme.ckLocalBranch()->initialize(new CkQdMsg); // must run on pe 0 to call ckNew
751  }
752  } else
753 #endif
754  {
755  CProxy_ComputePmeMgr pme(CkpvAccess(BOCclass_group).computePmeMgr);
756  pme[CkMyPe()].initialize(new CkQdMsg);
757  }
758  }
759  break;
760 
761  case 8:
762 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
763  if ( CkMyRank()==0 ) {
764  CProxy_ComputeCUDAMgr nb(CkpvAccess(BOCclass_group).computeCUDAMgr);
765  nb.ckLocalBranch()->initialize(new CkQdMsg);
766  }
767 #endif
768  break;
769 
770  case 9:
772  break;
773 
774  case 10:
775  #ifdef MEM_OPT_VERSION
776  //migrate atoms to HomePatch processors
777  ioMgr->sendAtomsToHomePatchProcs();
778  #endif
779  break;
780 
781  case 11:
782  // part 2 of MSM init
784  CProxy_ComputeMsmMgr msm(CkpvAccess(BOCclass_group).computeMsmMgr);
785  msm[CkMyPe()].initialize_create(); // call from my own PE
786  }
787 
788  if ( simParameters->PMEOn ) {
789  #ifdef OPENATOM_VERSION
790  if ( simParameters->openatomOn ) {
791  CProxy_ComputeMoaMgr moa(CkpvAccess(BOCclass_group).computeMoaMgr);
792  moa[CkMyPe()].initWorkers(new CkQdMsg);
793  }
794  #endif // OPENATOM_VERSION
795 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
796  if ( simParameters->usePMECUDA ) {
797  if(CkMyRank()==0) {
798  CProxy_ComputePmeCUDAMgr pme(CkpvAccess(BOCclass_group).computePmeCUDAMgr);
799  pme[CkMyNode()].initialize_pencils(new CkQdMsg);
800  }
801  } else
802 #endif
803  {
804  CProxy_ComputePmeMgr pme(CkpvAccess(BOCclass_group).computePmeMgr);
805  pme[CkMyPe()].initialize_pencils(new CkQdMsg);
806  }
807  }
808 #ifdef CHARM_HAS_MSA
809  else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
810  CProxy_ComputeMsmMsaMgr msm(CkpvAccess(BOCclass_group).computeMsmMsaMgr);
811  msm[CkMyPe()].initWorkers(new CkQdMsg);
812  }
813 #else
814  else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
815  CProxy_ComputeMsmMgr msm(CkpvAccess(BOCclass_group).computeMsmMgr);
816  msm[CkMyPe()].update(new CkQdMsg);
817  }
818 #endif
819 
820  #ifdef MEM_OPT_VERSION
821  //Now every processor has all the atoms it needs to create the HomePatches.
822  //The HomePatches are created in parallel on every home patch procs.
823  ioMgr->createHomePatches();
824  #else
825  if (!CkMyPe()) {
827  }
828  #endif
829  break;
830 
831  case 12:
832  if ( simParameters->PMEOn ) {
833  #ifdef OPENATOM_VERSION
834  if ( simParameters->openatomOn ) {
835  CProxy_ComputeMoaMgr moa(CkpvAccess(BOCclass_group).computeMoaMgr);
836  moa[CkMyPe()].startWorkers(new CkQdMsg);
837  }
838  #endif // OPENATOM_VERSION
839 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
840  if ( simParameters->usePMECUDA ) {
841  if(CkMyRank()==0) {
842  CProxy_ComputePmeCUDAMgr pme(CkpvAccess(BOCclass_group).computePmeCUDAMgr);
843  pme[CkMyNode()].activate_pencils(new CkQdMsg);
844  }
845  } else
846 #endif
847  {
848  CProxy_ComputePmeMgr pme(CkpvAccess(BOCclass_group).computePmeMgr);
849  pme[CkMyPe()].activate_pencils(new CkQdMsg);
850  }
851  }
852 #ifdef CHARM_HAS_MSA
853  else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
854  CProxy_ComputeMsmMsaMgr msm(CkpvAccess(BOCclass_group).computeMsmMsaMgr);
855  msm[CkMyPe()].startWorkers(new CkQdMsg);
856  }
857 #else
858  /*
859  else if ( simParameters->MSMOn && ! simParameters->MsmSerialOn ) {
860  CProxy_ComputeMsmMgr msm(CkpvAccess(BOCclass_group).computeMsmMgr);
861  //msm[CkMyPe()].startWorkers(new CkQdMsg);
862  }
863  */
864 #endif
865 
866  proxyMgr->createProxies(); // need Home patches before this
867  if (!CkMyPe()) LdbCoordinator::Object()->createLoadBalancer();
868 
869 #ifdef NAMD_TCL
870  // TclInitSubsystems() has a race condition so we create one interp per node here
871  if (CkMyPe() && CkMyNodeSize() > 1 && ! CkMyRank()) Tcl_DeleteInterp(Tcl_CreateInterp());
872 #endif
873 
874 #ifdef USE_NODEPATCHMGR
875  //at this point, PatchMap info has been recved on PEs. It is time to create
876  //the home patch spanning tree for receiving proxy list info
877  if(proxyMgr->getSendSpanning() || proxyMgr->getRecvSpanning()) {
878  if(CkMyRank()==0) {
879  CProxy_NodeProxyMgr npm(CkpvAccess(BOCclass_group).nodeProxyMgr);
880  npm[CkMyNode()].ckLocalBranch()->createSTForHomePatches(PatchMap::Object());
881  }
882  }
883 #endif
884 
885  break;
886 
887  case 13:
888 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
889  // Initialize the collective synchronization object before the sequencers are created
892  syncColl->initAllScope();
893  // Sync between all PEs so that expectedBarrierAll and currentBarrierAll are set
894  }
895 #endif
896  break;
897 
898  case 14:
899 #if defined(NAMD_CUDA) || defined(NAMD_HIP)
901  gpuResInitThread = CthCreate((CthVoidFn) &(initializeGPUResident), nullptr, SEQ_STK_SZ);
902  gpuResInitThreadPriority = 0;
903  CthSetStrategyDefault(gpuResInitThread);
904  CthAwakenPrio(gpuResInitThread, CK_QUEUEING_IFIFO, PRIORITY_SIZE, &gpuResInitThreadPriority);
905  CthSuspend();
906  }
907 #endif
908  break;
909 
910  case 15:
911  // Make sure that the GPU resident initialization threads have finished
912  break;
913 
914  case 16:
915 
916  // DMK - DEBUG - If, in MIC runs, the debug option to dump all the compute maps to files
917  // for debugging/verification purposes has been enabled, have each PE do so now.
918  #if defined(NAMD_MIC)
919  mic_dumpHostDeviceComputeMap();
920  #endif
921 
922  if (!CkMyPe()) {
923  iout << iINFO << "CREATING " << ComputeMap::Object()->numComputes()
924  << " COMPUTE OBJECTS\n" << endi;
925  }
926  DebugM(4,"Creating Computes\n");
928  DebugM(4,"Building Sequencers\n");
929  buildSequencers();
930  DebugM(4,"Initializing LDB\n");
932  break;
933 
934  case 17:
935  // computes may create proxies on the fly so put these in separate phase
936  Sync::Object()->openSync(); // decide if to open local Sync
938 #if defined(CMK_BALANCED_INJECTION_API) && CMK_BALANCED_INJECTION_API != 0
939  if(CkMyRank() == 0){
940  // CkPrintf("[%d] get retrieved BI=%d\n",CkMyPe(),balancedInjectionLevel);
941  ck_set_GNI_BIConfig(balancedInjectionLevel);
942  // CkPrintf("[%d] set retrieved BI=%d\n",CkMyPe(),ck_get_GNI_BIConfig());
943  }
944 #endif
945 
946  break;
947 
948  case 18:
949  {
950  //For debugging
951  /*if(!CkMyPe()){
952  FILE *dumpFile = fopen("/tmp/NAMD_Bench.dump", "w");
953  dumpbench(dumpFile);
954  NAMD_die("Normal execution\n");
955  }*/
956  }
957  #ifdef MEM_OPT_VERSION
959  ioMgr->readInfoForParOutDcdSelection();
960  //free space in the Molecule object that are not used anymore
961  ioMgr->freeMolSpace();
962  #endif
963  gotoRun = true;
964  break;
965 
966  default:
967  NAMD_bug("Startup Phase has a bug - check case statement");
968  break;
969 
970  }
971 
972  startupPhase++;
973  if (!CkMyPe()) {
974  if (!gotoRun) {
975  CkStartQD(CkCallback(CkIndex_Node::startup(), thisgroup));
976  } else {
978  }
979  }
980 
981  NAMD_EVENT_STOP(1, NamdProfileEvent::NAMD_STARTUP);
982 }
983 
984 #ifdef OPENATOM_VERSION
985 void Node::doneMoaStart()
986 {
987 #ifdef OPENATOM_VERSION_DEBUG
988  CkPrintf("doneMoaStart executed on processor %d.\n", CkMyPe() );
989 #endif //OPENATOM_VERSION_DEBUG
990 }
991 #endif //OPENATOM_VERSION
992 
993 void Node::namdOneCommInit()
994 {
995  if (CkpvAccess(comm) == NULL) {
996  CkpvAccess(comm) = new Communicate();
997 #ifdef DPMTA
998  pvmc_init();
999 #endif
1000  }
1001 }
1002 
1003 // Namd 1.X style Send/Recv of simulation information
1004 
1005 void Node::namdOneRecv() {
1006  if ( CmiMyRank() ) return;
1007 
1008  MIStream *conv_msg;
1009 
1010  // Receive molecule and simulation parameter information
1012  //****** BEGIN CHARMM/XPLOR type changes
1014  //****** END CHARMM/XPLOR type changes
1016 
1017  DebugM(4, "Getting SimParameters\n");
1018  conv_msg = CkpvAccess(comm)->newInputStream(0, SIMPARAMSTAG);
1020 
1021  DebugM(4, "Getting Parameters\n");
1022  conv_msg = CkpvAccess(comm)->newInputStream(0, STATICPARAMSTAG);
1023  parameters->receive_Parameters(conv_msg);
1024 
1025  DebugM(4, "Getting Molecule\n");
1026  conv_msg = CkpvAccess(comm)->newInputStream(0, MOLECULETAG);
1027  // Modified by JLai -- 10.21.11
1028  molecule->receive_Molecule(conv_msg);
1029  if(simParameters->goForcesOn) {
1030  iout << iINFO << "Compute Nodes receiving GoMolecule Information" << "\n" << endi;
1031  conv_msg = CkpvAccess(comm)->newInputStream(0, MOLECULETAG);
1032  molecule->receive_GoMolecule(conv_msg);
1033  }
1034  // End of modification
1035  DebugM(4, "Done Receiving\n");
1036 }
1037 
1038 void Node::namdOneSend() {
1042 
1043  MOStream *conv_msg;
1044  // I'm Pe(0) so I send what I know
1045  DebugM(4, "Sending SimParameters\n");
1046  conv_msg = CkpvAccess(comm)->newOutputStream(ALLBUTME, SIMPARAMSTAG, BUFSIZE);
1047  simParameters->send_SimParameters(conv_msg);
1048 
1049  DebugM(4, "Sending Parameters\n");
1050  conv_msg = CkpvAccess(comm)->newOutputStream(ALLBUTME, STATICPARAMSTAG, BUFSIZE);
1051  parameters->send_Parameters(conv_msg);
1052 
1053  DebugM(4, "Sending Molecule\n");
1054  int bufSize = BUFSIZE;
1055  if(molecule->numAtoms>=1000000) bufSize = 16*BUFSIZE;
1056  conv_msg = CkpvAccess(comm)->newOutputStream(ALLBUTME, MOLECULETAG, bufSize);
1057  // Modified by JLai -- 10.21.11
1058  molecule->send_Molecule(conv_msg);
1059 
1060  if(simParameters->goForcesOn) {
1061  iout << iINFO << "Master Node sending GoMolecule Information" << "\n" << endi;
1062  conv_msg = CkpvAccess(comm)->newOutputStream(ALLBUTME, MOLECULETAG, bufSize);
1063  molecule->send_GoMolecule(conv_msg);
1064  } // End of modification
1065 }
1066 
1067 
1068 void Node::reloadStructure(const char *fname, const char *pdbname) {
1069  delete molecule;
1070  molecule = state->molecule = 0;
1071  delete pdb;
1072  pdb = state->pdb = 0;
1073  state->loadStructure(fname,pdbname,1);
1074  this->molecule = state->molecule;
1075  this->pdb = state->pdb;
1076  CProxy_Node nodeProxy(thisgroup);
1077  nodeProxy.resendMolecule();
1078 }
1079 
1080 
1082  if ( CmiMyRank() ) {
1083  return;
1084  }
1085  if ( CmiMyPe() == 0 ) {
1086  int bufSize = BUFSIZE;
1087  MOStream *conv_msg;
1088  conv_msg = CkpvAccess(comm)->newOutputStream(ALLBUTME, STATICPARAMSTAG, bufSize);
1089  parameters->send_Parameters(conv_msg);
1090  if(molecule->numAtoms>=1000000) bufSize = 16*BUFSIZE;
1091  conv_msg = CkpvAccess(comm)->newOutputStream(ALLBUTME, MOLECULETAG, bufSize);
1092  molecule->send_Molecule(conv_msg);
1093  } else {
1094  MIStream *conv_msg;
1095  delete parameters;
1096  parameters = new Parameters;
1097  conv_msg = CkpvAccess(comm)->newInputStream(0, STATICPARAMSTAG);
1098  parameters->receive_Parameters(conv_msg);
1099  delete molecule;
1101  conv_msg = CkpvAccess(comm)->newInputStream(0, MOLECULETAG);
1102  molecule->receive_Molecule(conv_msg);
1103  }
1108  CProxy_Node nodeProxy(thisgroup);
1109  for ( int i=0; i<CmiMyNodeSize(); ++i ) {
1110  nodeProxy[CmiMyPe()+i].resendMolecule2();
1111  }
1112 }
1113 
1118 }
1119 
1120 
1121 // Initial thread setup
1122 
1123 void Node::threadInit() {
1124  // Thread initialization
1125  if (CthImplemented()) {
1126  CthSetStrategyDefault(CthSelf());
1127  } else {
1128  NAMD_bug("Node::startup() Oh no, tiny elvis, threads not implemented");
1129  }
1130 }
1131 
1132 //
1133 void Node::buildSequencers() {
1136 
1137  // Controller object is only on Pe(0)
1138  if ( ! CkMyPe() ) {
1139  Controller *controller = new Controller(state);
1140  state->useController(controller);
1141 #ifdef NODEGROUP_FORCE_REGISTER
1142  CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1143  PatchData *pdata = cpdata.ckLocalBranch();
1144  // OK so I need to wait out here if I want to invoke c_out cm
1145  pdata->c_out = controller;
1146 #endif
1147  }
1148 
1149  CmiNodeBarrier();
1150 
1151  // Assign Sequencer to all HomePatch(es)
1152  for (ai=ai.begin(); ai != ai.end(); ai++) {
1153  HomePatch *patch = (*ai).patch;
1154  Sequencer *sequencer = new Sequencer(patch);
1155  patch->useSequencer(sequencer);
1156  }
1157 }
1158 
1159 
1160 
1161 //-----------------------------------------------------------------------
1162 // Node run() - broadcast to all nodes
1163 //-----------------------------------------------------------------------
1165  (CProxy_Node(CkpvAccess(BOCclass_group).node)).run();
1166 }
1167 
1168 
1169 //-----------------------------------------------------------------------
1170 // run(void) runs the specified simulation for the specified number of
1171 // steps, overriding the contents of the configuration file
1172 //-----------------------------------------------------------------------
1174 {
1175 // NAMD_EVENT_START(1, NamdProfileEvent::NODE_RUN);
1176 
1177  // Start Controller (aka scalar Sequencer) on Pe(0)
1178 // printf("\n\n I am in Node.C in run method about to call state->runController\n\n");
1179  if ( ! CkMyPe() ) {
1180  state->runController();
1181  }
1182 
1183  DebugM(4, "Starting Sequencers\n");
1184  // Run Sequencer on each HomePatch - i.e. start simulation
1187  for (ai=ai.begin(); ai != ai.end(); ai++) {
1188  HomePatch *patch = (*ai).patch;
1189 //CkPrintf("Proc#%d in Node calling Sequencer ",CkMyPe());
1190  patch->runSequencer();
1191  }
1192 
1193  if (!CkMyPe()) {
1194  double newTime = CmiWallTimer();
1195  iout << iINFO << "Startup phase " << startupPhase-1 << " took "
1196  << newTime - startupTime << " s, "
1197  << memusage_MB() << " MB of memory in use\n";
1198  iout << iINFO << "Finished startup at " << newTime << " s, "
1199  << memusage_MB() << " MB of memory in use\n\n" << endi;
1200  fflush(stdout);
1201  }
1202 
1203 // NAMD_EVENT_STOP(1, NamdProfileEvent::NODE_RUN);
1204 }
1205 
1206 
1207 //-----------------------------------------------------------------------
1208 // Node scriptBarrier() - twiddle parameters with simulation halted
1209 //-----------------------------------------------------------------------
1210 
1212  CkStartQD(CkIndex_Node::scriptBarrier(), &thishandle);
1213 }
1214 
1216  //script->awaken();
1217 }
1218 
1220  simParameters->scriptSet(msg->param,msg->value);
1221  delete msg;
1222 }
1223 
1224 void Node::reloadCharges(const char *filename) {
1225  FILE *file = fopen(filename,"r");
1226  if ( ! file ) NAMD_die("node::reloadCharges():Error opening charge file.");
1227 
1228  int n = molecule->numAtoms;
1229  float *charge = new float[n];
1230 
1231  for ( int i = 0; i < n; ++i ) {
1232  if ( ! fscanf(file,"%f",&charge[i]) )
1233  NAMD_die("Node::reloadCharges():Not enough numbers in charge file.");
1234  }
1235 
1236  fclose(file);
1237  CProxy_Node(thisgroup).reloadCharges(charge,n);
1238 #ifdef NODEGROUP_FORCE_REGISTER
1239  if(CkMyPe()==0)
1240  {
1241  CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1242  cpdata.setDeviceKernelUpdateCounter();
1243  }
1244 #endif
1245  delete [] charge;
1246 }
1247 
1248 void Node::reloadCharges(float charge[], int n) {
1249  molecule->reloadCharges(charge,n);
1250 }
1251 
1252 
1253 // BEGIN gf
1254 void Node::reloadGridforceGrid(const char * key) {
1255  DebugM(4, "reloadGridforceGrid(const char*) called on node " << CkMyPe() << "\n" << endi);
1256 
1257  int gridnum;
1258  MGridforceParams *mgridParams;
1259  if (key == NULL) {
1262  } else {
1263  gridnum = simParameters->mgridforcelist.index_for_key(key);
1264  mgridParams = simParameters->mgridforcelist.find_key(key);
1265  }
1266 
1267  if (gridnum < 0 || mgridParams == NULL) {
1268  NAMD_die("Node::reloadGridforceGrid(const char*):Could not find grid.");
1269  }
1270 
1271  GridforceGrid *grid = molecule->get_gridfrc_grid(gridnum);
1272  if (grid == NULL) {
1273  NAMD_bug("Node::reloadGridforceGrid(const char*):grid not found");
1274  }
1275  grid->reinitialize(simParameters, mgridParams);
1276 
1277  CProxy_Node(thisgroup).reloadGridforceGrid(gridnum);
1278 #ifdef NODEGROUP_FORCE_REGISTER
1279  if(CkMyPe()==0)
1280  {
1281  CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1282  cpdata.setDeviceKernelUpdateCounter();
1283  }
1284 #endif
1285  DebugM(4, "reloadGridforceGrid(const char*) finished\n" << endi);
1286 }
1287 
1288 void Node::updateGridScale(const char* key, Vector scale) {
1289  DebugM(4, "updateGridScale(char*, Vector) called on node " << CkMyPe() << "\n" << endi);
1290 
1291  int gridnum;
1292  MGridforceParams* mgridParams;
1293  if (key == NULL) {
1296  } else {
1297  gridnum = simParameters->mgridforcelist.index_for_key(key);
1298  mgridParams = simParameters->mgridforcelist.find_key(key);
1299  }
1300 
1301  if (gridnum < 0 || mgridParams == NULL) {
1302  NAMD_die("Node::updateGridScale(char*, Vector): Could not find grid.");
1303  }
1304 
1305  GridforceGrid* grid = molecule->get_gridfrc_grid(gridnum);
1306  if (grid == NULL) {
1307  NAMD_bug("Node::updateGridScale(char*, Vector): grid not found");
1308  }
1309  CProxy_Node(thisgroup).updateGridScale(gridnum, scale.x, scale.y, scale.z);
1310 
1311  DebugM(4, "updateGridScale(char*, Vector) finished\n" << endi);
1312 }
1313 void Node::updateGridScale(int gridnum, float sx, float sy, float sz) {
1314  if (CmiMyRank()) return;
1315  DebugM(4, "updateGridScale(char*, int, float, float, float) called on node " << CkMyPe() << "\n" << endi);
1316 
1317  GridforceGrid *grid = molecule->get_gridfrc_grid(gridnum);
1318  if (grid == NULL) {
1319  NAMD_bug("Node::updateGridScale(char*, int, float, float, float):grid not found");
1320  }
1321 
1322  Vector scale(sx,sy,sz);
1324  grid->set_scale( scale );
1325 #ifdef NODEGROUP_FORCE_REGISTER
1326  if(CkMyPe()==0)
1327  {
1328  CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1329  cpdata.setDeviceKernelUpdateCounter();
1330  }
1331 #endif
1332  DebugM(4, "updateGridScale(char*, int, float, float, float) finished\n" << endi);
1333 }
1334 
1335 void Node::reloadGridforceGrid(int gridnum) {
1336  if (CmiMyRank()) return;
1337  DebugM(4, "reloadGridforceGrid(int) called on node " << CkMyPe() << "\n" << endi);
1338 
1339  GridforceGrid *grid = molecule->get_gridfrc_grid(gridnum);
1340  if (grid == NULL) {
1341  NAMD_bug("Node::reloadGridforceGrid(int):grid not found");
1342  }
1343 
1344  if (CkMyPe()) {
1345  // not node 0 -> receive grid
1346  DebugM(4, "Receiving grid\n");
1347 
1348  delete grid;
1349 
1350  MIStream *msg = CkpvAccess(comm)->newInputStream(0, GRIDFORCEGRIDTAG);
1351  grid = GridforceGrid::unpack_grid(gridnum, msg);
1352  molecule->set_gridfrc_grid(gridnum, grid);
1353  delete msg;
1354  } else {
1355  // node 0 -> send grid
1356  DebugM(4, "Sending grid\n");
1357 
1358  MOStream *msg = CkpvAccess(comm)->newOutputStream(ALLBUTME, GRIDFORCEGRIDTAG, BUFSIZE);
1359  GridforceGrid::pack_grid(grid, msg);
1360  msg->end();
1361  delete msg;
1362  }
1363 #ifdef NODEGROUP_FORCE_REGISTER
1364  if(CkMyPe()==0)
1365  {
1366  CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1367  cpdata.setDeviceKernelUpdateCounter();
1368  }
1369 #endif
1370  DebugM(4, "reloadGridforceGrid(int) finished\n" << endi);
1371 }
1372 // END gf
1373 
1374 
1375 // initiating replica
1376 void Node::sendCheckpointReq(int remote, const char *key, int task, Lattice &lat, ControllerState &cs) {
1377  CheckpointMsg *msg = new (1+strlen(key),0) CheckpointMsg;
1378  msg->replica = CmiMyPartition();
1379  msg->task = task;
1380  msg->checkpoint.lattice = lat;
1381  msg->checkpoint.state = cs;
1382  strcpy(msg->key,key);
1383  envelope *env = UsrToEnv(CheckpointMsg::pack(msg));
1384  CmiSetHandler(env,recvCheckpointCReq_index);
1385 #if CMK_HAS_PARTITION
1386  CmiInterSyncSendAndFree(CkMyPe(),remote,env->getTotalsize(),(char*)env);
1387 #else
1388  CmiSyncSendAndFree(CkMyPe(),env->getTotalsize(),(char*)env);
1389 #endif
1390 }
1391 
1392 // responding replica
1393 extern "C" {
1394  void recvCheckpointCReq_handler(envelope *env) {
1395  Node::Object()->recvCheckpointReq(CheckpointMsg::unpack(EnvToUsr(env)));
1396  }
1397 }
1398 
1399 // responding replica
1401  state->controller->recvCheckpointReq(msg->key,msg->task,msg->checkpoint);
1402 
1403  int remote = msg->replica;
1404  msg->replica = CmiMyPartition();
1405  envelope *env = UsrToEnv(CheckpointMsg::pack(msg));
1406  CmiSetHandler(env,recvCheckpointCAck_index);
1407 #if CMK_HAS_PARTITION
1408  CmiInterSyncSendAndFree(CkMyPe(),remote,env->getTotalsize(),(char*)env);
1409 #else
1410  CmiSyncSendAndFree(CkMyPe(),env->getTotalsize(),(char*)env);
1411 #endif
1412 }
1413 
1414 // initiating replica
1415 extern "C" {
1416  void recvCheckpointCAck_handler(envelope *env) {
1417  Node::Object()->recvCheckpointAck(CheckpointMsg::unpack(EnvToUsr(env)));
1418  }
1419 }
1420 
1421 // initiating replica
1423  state->controller->recvCheckpointAck(msg->checkpoint);
1424  delete msg;
1425 }
1426 
1427 
1429  //CmiPrintf("sendEnableExitScheduler\n");
1430  CProxy_Node nodeProxy(thisgroup);
1431  nodeProxy[0].recvEnableExitScheduler();
1432 }
1433 
1435  //CmiPrintf("recvEnableExitScheduler\n");
1437 }
1438 
1440  if ( CkMyPe() ) {
1442  } else {
1443  CkStartQD(CkIndex_Node::exitScheduler(), &thishandle);
1444  }
1445 }
1446 
1448  //CmiPrintf("exitScheduler %d\n",CkMyPe());
1449  CsdExitScheduler();
1450 }
1451 
1453  CProxy_Node nodeProxy(thisgroup);
1454  nodeProxy[0].recvEnableEarlyExit();
1455 }
1456 
1458  enableEarlyExit();
1459 }
1460 
1462  if ( CkMyPe() ) {
1464  } else {
1465  CkStartQD(CkIndex_Node::earlyExit(),&thishandle);
1466  }
1467 }
1468 
1469 void Node::earlyExit(void) {
1470  NAMD_die("Exiting prematurely; see error messages above.");
1471 }
1472 
1473 
1474 //------------------------------------------------------------------------
1475 // Some odd utilities
1476 //------------------------------------------------------------------------
1478 {
1479  this->molecule = state->molecule;
1480  this->parameters = state->parameters;
1481  this->simParameters = state->simParameters;
1482  this->configList = state->configList;
1483  this->pdb = state->pdb;
1484  this->state = state;
1485 }
1486 
1487 // entry methods for BG/P HPM (performance counters) library
1489 #if USE_HPM
1490  HPM_Start("500 steps", localRankOnNode);
1491 #endif
1492 }
1493 
1495 #if USE_HPM
1496  HPM_Stop("500 steps", localRankOnNode);
1497  HPM_Print(CkMyPe(), localRankOnNode);
1498 #endif
1499 }
1500 
1501 void Node::traceBarrier(int turnOnTrace, int step){
1502  curTimeStep = step;
1503  if(turnOnTrace) traceBegin();
1504  else traceEnd();
1505 
1506  if(turnOnTrace) CmiTurnOnStats();
1507  else CmiTurnOffStats();
1508 
1509  //CkPrintf("traceBarrier (%d) at step %d called on proc %d\n", turnOnTrace, step, CkMyPe());
1510  CProxy_Node nd(CkpvAccess(BOCclass_group).node);
1511  CkCallback cb(CkIndex_Node::resumeAfterTraceBarrier(NULL), nd[0]);
1512  contribute(0, NULL, CkReduction::sum_int, cb);
1513 
1514 }
1515 
1516 void Node::resumeAfterTraceBarrier(CkReductionMsg *msg){
1517  CmiAssert(CmiMyPe()==0);
1518  delete msg;
1520 }
1521 
1522 void Node::papiMeasureBarrier(int turnOnMeasure, int step){
1523 #ifdef MEASURE_NAMD_WITH_PAPI
1524  curMFlopStep = step;
1525  double results[NUM_PAPI_EVENTS+1];
1526 
1527  if(turnOnMeasure){
1528  CkpvAccess(papiEvents)[NUM_PAPI_EVENTS]=CmiWallTimer();
1529 
1530  long long counters[NUM_PAPI_EVENTS+1];
1531  int ret=PAPI_start_counters(CkpvAccess(papiEvents), NUM_PAPI_EVENTS);
1532  if(ret==PAPI_OK)
1533  {
1534  // CkPrintf("traceBarrier start counters (%d) at step %d called on proc %d\n", turnOnMeasure, step, CkMyPe());
1535  }
1536  else
1537  {
1538  CkPrintf("error PAPI_start_counters (%d) at step %d called on proc %d\n",ret , step, CkMyPe());
1539  }
1540  if(PAPI_read_counters(counters, NUM_PAPI_EVENTS)!=PAPI_OK)
1541  {
1542  CkPrintf("error PAPI_read_counters %d\n",PAPI_read_counters(counters, NUM_PAPI_EVENTS));
1543  };
1544  }else{
1545  long long counters[NUM_PAPI_EVENTS+1];
1546  for(int i=0;i<NUM_PAPI_EVENTS;i++) counters[i]=0LL;
1547  if(PAPI_read_counters(counters, NUM_PAPI_EVENTS)==PAPI_OK)
1548  {
1549 #if !MEASURE_PAPI_SPP
1550  results[0] = (double)counters[0]/1e6;
1551  results[1] = (double)counters[1]/1e6;
1552 #else
1553  for(int i=0;i<NUM_PAPI_EVENTS;i++) results[i] = counters[i]/1e6;
1554 #endif
1555  // for(int i=0;i<NUM_PAPI_EVENTS;i++) CkPrintf("[%d] counter %d is %ld\n",CkMyPe(),i,counters[i]);
1556  }
1557  else
1558  {
1559  // CkPrintf("error PAPI_read_counters %d\n",PAPI_read_counters(counters, NUM_PAPI_EVENTS));
1560  }
1561  // CkPrintf("traceBarrier stop counters (%d) at step %d called on proc %d\n", turnOnMeasure, step, CkMyPe());
1562 
1563  PAPI_stop_counters(counters, NUM_PAPI_EVENTS);
1564  }
1565  if(CkMyPe()==0)
1566  // CkPrintf("traceBarrier (%d) at step %d called on proc %d\n", turnOnMeasure, step, CkMyPe());
1567  results[NUM_PAPI_EVENTS]=CkpvAccess(papiEvents)[NUM_PAPI_EVENTS]; //starttime
1568  CProxy_Node nd(CkpvAccess(BOCclass_group).node);
1569  CkCallback cb(CkIndex_Node::resumeAfterPapiMeasureBarrier(NULL), nd[0]);
1570  contribute(sizeof(double)*(NUM_PAPI_EVENTS+1), &results, CkReduction::sum_double, cb);
1571 #endif
1572 }
1573 
1574 void Node::resumeAfterPapiMeasureBarrier(CkReductionMsg *msg){
1575 #ifdef MEASURE_NAMD_WITH_PAPI
1576 
1577  if(simParameters->papiMeasureStartStep != curMFlopStep) {
1578  double *results = (double *)msg->getData();
1579  double endtime=CmiWallTimer();
1580  int bstep = simParameters->papiMeasureStartStep;
1581  int estep = bstep + simParameters->numPapiMeasureSteps;
1582 #if MEASURE_PAPI_SPP
1583  CkPrintf("SPP INFO: PAPI_FP_OPS timestep %d to %d is %lf(1e6)\n", bstep,estep,results[0]);
1584  CkPrintf("SPP INFO: PAPI_TOT_INS timestep %d to %d is %lf(1e6)\n", bstep,estep,results[1]);
1585  CkPrintf("SPP INFO: perf::PERF_COUNT_HW_CACHE_LL:MISS timestep %d to %d is %lf(1e6)\n", bstep,estep,results[2]);
1586  CkPrintf("SPP INFO: DATA_PREFETCHER:ALL timestep %d to %d is %lf(1e6)\n", bstep,estep,results[3]);
1587  CkPrintf("SPP INFO: PAPI_L1_DCA timestep %d to %d is %lf(1e6)\n", bstep,estep,results[4]);
1588  CkPrintf("SPP INFO: PAPI_TOT_CYC timestep %d to % is %lf(1e6)\n", bstep,estep,results[5]);
1589  // CkPrintf("SPP INFO: INSTRUCTION_FETCH_STALL timestep %d to %d is %lf(1e6)\n", bstep,estep,results[6]);
1590  // CkPrintf("SPP INFO: WALLtime timestep %d to %d is %lf\n", bstep,estep,endtime-results[NUM_PAPI_EVENTS]/CkNumPes());
1591  CkPrintf("SPP INFO: WALLtime timestep %d to %d is %lf\n", bstep,estep,endtime-results[NUM_PAPI_EVENTS]);
1592  CkPrintf("SPP INFO: endtime %lf avgtime %lf tottime %lf\n", endtime,results[NUM_PAPI_EVENTS]/CkNumPes(),results[NUM_PAPI_EVENTS] );
1593 #else
1594  if(CkpvAccess(papiEvents)[0] == PAPI_FP_INS){
1595  double totalFPIns = results[0];
1596  if(CkpvAccess(papiEvents)[1] == PAPI_FMA_INS) totalFPIns += (results[1]*2);
1597  CkPrintf("FLOPS INFO: from timestep %d to %d, the total FP instruction of NAMD is %lf(x1e6) per processor\n",
1598  bstep, estep, totalFPIns/CkNumPes());
1599  }else{
1600  char nameBuf[PAPI_MAX_STR_LEN];
1601  CkPrintf("PAPI COUNTERS INFO: from timestep %d to %d, ",
1602  bstep, estep);
1603  for(int i=0; i<NUM_PAPI_EVENTS; i++) {
1604  PAPI_event_code_to_name(CkpvAccess(papiEvents)[i], nameBuf);
1605  CkPrintf("%s is %lf(x1e6), ", nameBuf, results[i]/CkNumPes());
1606  }
1607  CkPrintf("per processor\n");
1608  }
1609 #endif
1610  }
1611  delete msg;
1612  state->controller->resumeAfterPapiMeasureBarrier(curMFlopStep);
1613 #endif
1614 }
1615 
1616 extern char *gNAMDBinaryName;
1617 void Node::outputPatchComputeMaps(const char *filename, int tag){
1619 
1620  int numpes = CkNumPes();
1621  int nodesize = CkMyNodeSize();
1623  numpes = simParameters->simulatedPEs;
1624  nodesize = simParameters->simulatedNodeSize;
1625  }
1626 
1627  char fname[128];
1628  sprintf(fname, "mapdump_%s.%d_%d_%d_%s", filename, numpes, nodesize, tag, gNAMDBinaryName);
1629 
1630  FILE *fp = fopen(fname, "w");
1631  if(fp == NULL) {
1632  NAMD_die("Error in outputing PatchMap and ComputeMap info!\n");
1633  return;
1634  }
1635  PatchMap *pMap = PatchMap::Object();
1636  ComputeMap *cMap = ComputeMap::Object();
1637  int numPatches = pMap->numPatches();
1638  int numComputes = cMap->numComputes();
1639  fprintf(fp, "%d %d %d %d %d %d %d\n", numpes, nodesize, numPatches, numComputes,
1640  pMap->gridsize_a(), pMap->gridsize_b(), pMap->gridsize_c());
1641  //output PatchMap info
1642  for(int i=0; i<numPatches; i++) {
1643  #ifdef MEM_OPT_VERSION
1644  fprintf(fp, "%d %d\n", pMap->numAtoms(i), pMap->node(i));
1645  #else
1646  fprintf(fp, "%d %d\n", pMap->patch(i)->getNumAtoms(), pMap->node(i));
1647  #endif
1648  }
1649 
1650  //output ComputeMap info
1651  for(int i=0; i<numComputes; i++) {
1652  fprintf(fp, "%d %d %d %d\n", cMap->node(i), cMap->type(i), cMap->pid(i,0), cMap->pid(i,1));
1653  }
1654 }
1655 
1657 #ifndef NODEGROUP_FORCE_REGISTER
1658  return script;
1659 #else
1660  if(script == NULL){
1661  CProxy_PatchData cpdata(CkpvAccess(BOCclass_group).patchData);
1662  PatchData* patchData = cpdata.ckLocalBranch();
1663  return patchData->script;
1664  }else{
1665  return script;
1666  }
1667 #endif
1668 }
1669 
1670 
1671 //======================================================================
1672 // Private functions
1673 
1674 #include "Node.def.h"
1675 
static Node * Object()
Definition: Node.h:86
#define GRIDFORCEGRIDTAG
Definition: common.h:183
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 specialTracing
Definition: Node.h:166
Bool simulateInitialMapping
void recvCheckpointReq(const char *key, int task, checkpoint &cp)
Definition: Controller.C:4914
int getNumAtoms() const
Definition: Patch.h:105
void recvCheckpointCReq_handler(envelope *)
Definition: Node.C:1394
void setPatchMapArrived(bool s)
Definition: WorkDistrib.h:108
void runSequencer(void)
Definition: HomePatch.C:305
void createProxies(void)
Definition: ProxyMgr.C:416
GridforceGrid * get_gridfrc_grid(int gridnum) const
Definition: Molecule.h:1368
void end(void)
Definition: MStream.C:176
ControllerState state
Definition: Controller.h:388
bool getIsMasterDevice()
Definition: GlobalGPUMgr.h:124
void setRecvSpanning()
Definition: ProxyMgr.C:370
void receive_SimParameters(MIStream *)
int proxyRecvSpanning
Definition: ProxyMgr.C:45
BOCgroup group
Definition: Node.h:68
int numComputes(void)
Definition: ComputeMap.h:103
int getRecvSpanning()
Definition: ProxyMgr.C:375
int curTimeStep
Definition: Node.h:152
void send_GoMolecule(MOStream *)
Definition: GoMolecule.C:1636
void mallocTest(int)
Definition: Node.C:403
void startHPM()
Definition: Node.C:1488
static ProxyMgr * Object()
Definition: ProxyMgr.h:394
NAMD_HOST_DEVICE int c_p() const
Definition: Lattice.h:291
void exitScheduler(void)
Definition: Node.C:1447
IMDOutput * imd
Definition: Node.h:186
void saveMolDataPointers(NamdState *)
Definition: Node.C:1477
void receive_GoMolecule(MIStream *)
Definition: GoMolecule.C:1745
LdbCoordinator * ldbCoordinator
Definition: Node.h:205
static PatchMap * Object()
Definition: PatchMap.h:27
void sendEnableEarlyExit(void)
Definition: Node.C:1452
void send_Molecule(MOStream *)
Definition: Molecule.C:5662
static void exit(int status=0)
Definition: BackEnd.C:284
Definition: Vector.h:72
static AtomMap * Instance()
Definition: AtomMap.C:125
Output * output
Definition: Node.h:185
SimParameters * simParameters
Definition: Node.h:181
int task
Definition: Node.C:97
void setSendSpanning()
Definition: ProxyMgr.C:361
static void pack_grid(GridforceGrid *grid, MOStream *msg)
Definition: GridForceGrid.C:50
#define DebugM(x, y)
Definition: Debug.h:75
void createLoadBalancer()
Controller * c_out
Definition: PatchData.h:147
double startupTime
Definition: Node.C:297
HomePatchList * homePatchList()
Definition: PatchMap.C:438
std::ostream & endi(std::ostream &s)
Definition: InfoStream.C:54
#define ALLBUTME
Definition: Communicate.h:14
BigReal z
Definition: Vector.h:74
void enableScriptBarrier()
Definition: Node.C:1211
int getSendSpanning()
Definition: ProxyMgr.C:366
void initMasterScope(const int isMasterPe, const int isMasterDevice, const int numDevices, const int deviceIndex, const std::vector< int > &masterPeList)
void initializeGPUResident()
Definition: Node.C:447
void initialize()
Definition: GlobalGPUMgr.C:58
void scriptSet(const char *, const char *)
char value[MAX_SCRIPT_PARAM_SIZE]
Definition: Node.h:75
void sendEnableExitScheduler(void)
Definition: Node.C:1428
void recvCheckpointReq(CheckpointMsg *)
Definition: Node.C:1400
static void messageStartUp()
Definition: Node.C:430
ResizeArrayIter< T > begin(void) const
void stopHPM()
Definition: Node.C:1494
void reloadCharges(float charge[], int n)
#define iout
Definition: InfoStream.h:51
Patch * patch(PatchID pid)
Definition: PatchMap.h:244
int curMFlopStep
Definition: Node.h:157
#define STATICPARAMSTAG
Definition: common.h:178
Molecule * node_molecule
Definition: Node.C:436
void outputPatchComputeMaps(const char *filename, int tag)
Definition: Node.C:1617
int loadStructure(const char *, const char *, int)
Definition: NamdState.C:163
void createComputes(ComputeMap *map)
Definition: ComputeMgr.C:1037
Molecule stores the structural information for the system.
Definition: Molecule.h:174
NAMD_HOST_DEVICE int b_p() const
Definition: Lattice.h:290
int replica
Definition: Node.C:98
void split(int iStream, int numStreams)
Definition: Random.h:77
void recvCheckpointAck(CheckpointMsg *)
Definition: Node.C:1422
void patchMapInit(void)
Definition: WorkDistrib.C:1238
void openSync()
Definition: Sync.C:63
ComputeMap * computeMap
Definition: Node.h:204
int gridsize_c(void) const
Definition: PatchMap.h:66
void runController(void)
Definition: NamdState.C:83
double memusage_MB()
Definition: memusage.h:13
virtual void reinitialize(SimParameters *simParams, MGridforceParams *mgridParams)=0
#define SEQ_STK_SZ
Definition: Thread.h:11
void sendComputeMap(void)
Definition: WorkDistrib.C:1211
#define PRIORITY_SIZE
Definition: Priorities.h:13
Definition: Output.h:35
int gridsize_a(void) const
Definition: PatchMap.h:64
int getDeviceIndex()
Definition: GlobalGPUMgr.h:101
void resumeAfterPapiMeasureBarrier(CkReductionMsg *msg)
Definition: Node.C:1574
void initialize(PatchMap *pmap, ComputeMap *cmap, int reinit=0)
void scriptParam(ScriptParamMsg *)
Definition: Node.C:1219
Definition: Random.h:37
int index_for_key(const char *key)
void run()
Definition: Node.C:1173
int numPatches(void) const
Definition: PatchMap.h:59
#define NAMD_EVENT_START(eon, id)
void enableExitScheduler(void)
Definition: Node.C:1439
void buildProxySpanningTree()
Definition: ProxyMgr.C:558
void createHomePatches(void)
Definition: WorkDistrib.C:989
void NAMD_bug(const char *err_msg)
Definition: common.C:195
char * gNAMDBinaryName
Definition: BackEnd.C:247
ComputeType type(ComputeID cid)
Definition: ComputeMap.C:118
ScaledPosition smax
Definition: ComputeMsm.h:21
Controller::checkpoint checkpoint
Definition: Node.C:99
NamdState * state
Definition: Node.h:184
#define MGRIDFORCEPARAMS_DEFAULTKEY
MGridforceParams * find_key(const char *key)
void traceBarrier(int turnOnTrace, int step)
Definition: Node.C:1501
ScriptTcl * script
Definition: PatchData.h:160
void updateGridScale(const char *key, Vector scale)
Definition: Node.C:1288
static void pme_select()
static void messageRun()
Definition: Node.C:1164
void scriptBarrier(void)
Definition: Node.C:1215
static Sync * Object()
Definition: Sync.h:52
void recvCheckpointAck(checkpoint &cp)
Definition: Controller.C:4944
void reloadStructure(const char *, const char *)
Definition: Node.C:1068
BigReal x
Definition: Vector.h:74
AtomMap * atomMap
Definition: Node.h:202
void recvEnableExitScheduler(void)
Definition: Node.C:1434
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:586
void NAMD_die(const char *err_msg)
Definition: common.C:147
PDB * pdb
Definition: Node.h:183
static LdbCoordinator * Object()
void initializeBackends()
Definition: GlobalGPUMgr.C:94
int getNumDevices()
Definition: GlobalGPUMgr.h:96
ConfigList * configList
Definition: Node.h:182
const std::vector< int > & getDeviceIndexToPeMap() const
Definition: GlobalGPUMgr.h:116
static AtomMap * Object()
Definition: AtomMap.h:37
#define BUFSIZE
Definition: Communicate.h:15
MGridforceParamsList mgridforcelist
static void nonbonded_select()
void recvEnableEarlyExit(void)
Definition: Node.C:1457
void sendPatchMap(void)
Definition: WorkDistrib.C:1111
void send_Parameters(MOStream *)
Definition: Parameters.C:6560
int isRecvSpanningTreeOn()
Parameters * parameters
Definition: Node.h:180
static ComputeMap * Instance()
Definition: ComputeMap.C:24
void resumeAfterTraceBarrier(CkReductionMsg *msg)
Definition: Node.C:1516
unsigned int randomSeed
CkpvDeclare(AtomMap *, AtomMap_instance)
WorkDistrib * workDistrib
Definition: Node.h:169
~Node(void)
Definition: Node.C:366
Parameters * node_parameters
Definition: Node.C:435
static GridforceGrid * unpack_grid(int gridnum, MIStream *msg)
Definition: GridForceGrid.C:60
#define SIMPARAMSTAG
Definition: common.h:177
SimParameters * node_simParameters
Definition: Node.C:434
Random * rand
Definition: Node.h:175
void mallocTestQd(void)
Definition: Node.C:415
void mapComputes(void)
Definition: WorkDistrib.C:2407
void recvCheckpointCAck_handler(envelope *)
Definition: Node.C:1416
void registerUserEventsForAllComputeObjs(void)
Definition: ComputeMgr.C:853
static ComputeMap * Object()
Definition: ComputeMap.h:91
PatchMap * patchMap
Definition: Node.h:203
ScaledPosition smin
Definition: ComputeMsm.h:21
void useController(Controller *controllerPtr)
Definition: NamdState.C:78
void papiMeasureBarrier(int turnOnMeasure, int step)
Definition: Node.C:1522
BigReal y
Definition: Vector.h:74
void resendMolecule2()
Definition: Node.C:1114
ScriptTcl * getScript()
Definition: Node.C:1656
void resendMolecule()
Definition: Node.C:1081
void distributeHomePatches(void)
Definition: WorkDistrib.C:1063
void setProxyTreeBranchFactor(int dim)
Definition: ProxyMgr.C:379
colvarmodule * colvars
Definition: Node.h:187
int eventEndOfTimeStep
Definition: Node.C:296
void startup()
Definition: Node.C:462
int node(ComputeID cid)
Definition: ComputeMap.h:108
int gridsize_b(void) const
Definition: PatchMap.h:65
int set_gridfrc_grid(int gridnum, GridforceGrid *grid)
Definition: Molecule.h:1377
__thread DeviceCUDA * deviceCUDA
Definition: DeviceCUDA.C:23
int pid(ComputeID cid, int i)
Definition: ComputeMap.C:107
#define MOLECULETAG
Definition: common.h:179
int isSendSpanningTreeOn()
Node(GroupInitMsg *msg)
Definition: Node.C:301
void resumeAfterTraceBarrier(int)
Definition: Controller.C:4984
void sendCheckpointReq(int remote, const char *key, int task, Lattice &lat, ControllerState &cs)
Definition: Node.C:1376
ComputeMgr * computeMgr
Definition: Node.h:172
int node(int pid) const
Definition: PatchMap.h:114
int mallocTest_size
Definition: Node.h:130
static GlobalGPUMgr * Object()
Definition: GlobalGPUMgr.h:61
void enableEarlyExit(void)
Definition: Node.C:1461
void receive_Molecule(MIStream *)
Definition: Molecule.C:6028
void earlyExit(void)
Definition: Node.C:1469
MGridforceParams * at_index(int idx)
ResizeArrayIter< T > end(void) const
static PatchMap * Instance()
Definition: PatchMap.C:32
Molecule * molecule
Definition: Node.h:179
int getIsMasterPe()
Definition: GlobalGPUMgr.h:106
void useSequencer(Sequencer *sequencerPtr)
Definition: HomePatch.C:301
char param[MAX_SCRIPT_PARAM_SIZE]
Definition: Node.h:74
void receive_Parameters(MIStream *)
Definition: Parameters.C:6936
static SynchronousCollectives * Object()
virtual void set_scale(Vector s)=0
void reloadCharges(const char *filename)
Definition: Node.C:1224
void send_SimParameters(MOStream *)
void reloadGridforceGrid(const char *key)
Definition: Node.C:1254
void assignNodeToPatch(void)
Definition: WorkDistrib.C:1456
char * key
Definition: Node.C:100
int proxySendSpanning
Definition: ProxyMgr.C:44