NAMD
Static Public Member Functions | List of all members
BackEnd Class Reference

#include <BackEnd.h>

Static Public Member Functions

static void init (int argc, char **argv)
 
static void exit (int status=0)
 
static void suspend (void)
 
static void awaken (void)
 
static void barrier (void)
 
static void ExitSchedOn (int pe)
 

Detailed Description

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 12 of file BackEnd.h.

Member Function Documentation

void BackEnd::awaken ( void  )
static

Definition at line 316 of file BackEnd.C.

References Node::enableExitScheduler(), and Node::Object().

Referenced by Controller::algorithm(), barrier(), and Controller::terminate().

316  {
318 }
static Node * Object()
Definition: Node.h:86
void enableExitScheduler(void)
Definition: Node.C:1334
void BackEnd::barrier ( void  )
static

Definition at line 321 of file BackEnd.C.

References awaken(), and suspend().

321  {
322  awaken();
323  suspend();
324 }
static void awaken(void)
Definition: BackEnd.C:316
static void suspend(void)
Definition: BackEnd.C:311
void BackEnd::exit ( int  status = 0)
static

Definition at line 276 of file BackEnd.C.

References cpuTime_start, cuda_finalize(), memusage_MB(), and wallTime_start.

Referenced by after_backend_init(), colvarproxy_namd::exit(), NamdState::loadStructure(), and Node::startup().

276  {
277  float cpuTime = CmiCpuTimer() - cpuTime_start;
278  float wallTime = CmiWallTimer() - wallTime_start;
279  CmiPrintf("====================================================\n\n"
280  "WallClock: %f CPUTime: %f Memory: %f MB\n",
281  wallTime, cpuTime, memusage_MB());
282 #ifdef NAMD_TCL
283  Tcl_Finalize();
284 #endif
285 #ifdef NAMD_CUDA
286  cuda_finalize();
287 #ifdef __APPLE__
288 #if 0 && CMK_MULTICORE
289  CmiPrintf("EXITING ABNORMALLY TO AVOID HANGING CUDA RUNTIME THREADS\n");
290  ::exit(0);
291 #endif
292 #endif
293 #endif
294 #ifdef NAMD_MIC
295 #if 0 && CMK_MULTICORE
296  CmiPrintf("EXITING ABNORMALLY TO AVOID HANGING MIC OFFLOAD THREADS\n");
297 #pragma offload target(mic)
298  {
299  ::exit(0);
300  }
301 #endif
302 #endif
303 #if CHARM_VERSION < 61000
304  CkExit();
305 #else
306  CkExit(status);
307 #endif
308 }
static void exit(int status=0)
Definition: BackEnd.C:276
float cpuTime_start
Definition: BackEnd.C:50
float wallTime_start
Definition: BackEnd.C:51
double memusage_MB()
Definition: memusage.h:13
void cuda_finalize()
Definition: DeviceCUDA.C:26
void BackEnd::ExitSchedOn ( int  pe)
static

Definition at line 67 of file BackEnd.C.

68 {
69  void* msg = CmiAlloc(CmiMsgHeaderSizeBytes);
70  CmiSetHandler(msg,CkpvAccess(exitSchedHndlr));
71  CmiSyncSendAndFree(pe,CmiMsgHeaderSizeBytes,(char *)msg);
72 }
void BackEnd::init ( int  argc,
char **  argv 
)
static

Definition at line 239 of file BackEnd.C.

References master_init(), NAMD_die(), and slave_init().

Referenced by main().

239  {
240 
241  gNAMDBinaryName = argv[0]+strlen(argv[0])-1;
242  while(gNAMDBinaryName != argv[0]){
243  if(*gNAMDBinaryName=='/' || *gNAMDBinaryName=='\\'){
244  gNAMDBinaryName++;
245  break;
246  }
247  gNAMDBinaryName--;
248  }
249 
250 #if defined(NAMD_CUDA) || defined(NAMD_MIC)
251  // look for but don't remove +idlepoll on command line
252  int idlepoll = 0;
253  for ( int i = 0; i < argc; ++i ) {
254  if ( 0==strcmp(argv[i],"+idlepoll") ) {
255  idlepoll = 1;
256  break;
257  }
258  }
259 #endif
260 
261  ConverseInit(argc, argv, slave_init, 1, 1); // calls slave_init on others
262 
263 // idlepoll only matters for non-smp UDP layer
264 #if (defined(NAMD_CUDA) || defined(NAMD_MIC)) && CMK_NET_VERSION && CMK_SHARED_VARS_UNAVAILABLE && CMK_WHEN_PROCESSOR_IDLE_USLEEP && ! CMK_USE_IBVERBS && ! CMK_USE_TCP
265  if ( ! idlepoll ) {
266  NAMD_die("Please add +idlepoll to command line for proper performance.");
267  }
268 #endif
269 
270  master_init(argc, argv);
271 }
char * gNAMDBinaryName
Definition: BackEnd.C:237
void master_init(int argc, char **argv)
Definition: BackEnd.C:167
void NAMD_die(const char *err_msg)
Definition: common.C:83
void slave_init(int argc, char **argv)
Definition: BackEnd.C:147
void BackEnd::suspend ( void  )
static

Definition at line 311 of file BackEnd.C.

Referenced by barrier().

311  {
312  CsdScheduler(-1);
313 }

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