您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CkMyPe函数代码示例

51自学网 2021-06-01 20:10:58
  C++
这篇教程C++ CkMyPe函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CkMyPe函数的典型用法代码示例。如果您正苦于以下问题:C++ CkMyPe函数的具体用法?C++ CkMyPe怎么用?C++ CkMyPe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CkMyPe函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: _exitHandler

static void _exitHandler(envelope *env){  DEBUGF(("exitHandler called on %d msgtype: %d/n", CkMyPe(), env->getMsgtype()));  switch(env->getMsgtype()) {    case StartExitMsg:      CkAssert(CkMyPe()==0);      if (!_CkExitFnVec.isEmpty()) {        CkExitFn fn = _CkExitFnVec.deq();        fn();        break;      }      // else goto next    case ExitMsg:      CkAssert(CkMyPe()==0);      if(_exitStarted) {        CmiFree(env);        return;      }      _exitStarted = 1;      CkNumberHandler(_charmHandlerIdx,(CmiHandler)_discardHandler);      CkNumberHandler(_bocHandlerIdx, (CmiHandler)_discardHandler);      env->setMsgtype(ReqStatMsg);      env->setSrcPe(CkMyPe());      // if exit in ring, instead of broadcasting, send in ring      if (_ringexit){	DEBUGF(("[%d] Ring Exit /n",CkMyPe()));        const int stride = CkNumPes()/_ringtoken;        int pe = 0;        while (pe<CkNumPes()) {          CmiSyncSend(pe, env->getTotalsize(), (char *)env);          pe += stride;        }        CmiFree(env);      }else{	CmiSyncBroadcastAllAndFree(env->getTotalsize(), (char *)env);      }	      break;    case ReqStatMsg:#if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))      _messageLoggingExit();#endif      DEBUGF(("ReqStatMsg on %d/n", CkMyPe()));      CkNumberHandler(_charmHandlerIdx,(CmiHandler)_discardHandler);      CkNumberHandler(_bocHandlerIdx, (CmiHandler)_discardHandler);      /*FAULT_EVAC*/      if(CmiNodeAlive(CkMyPe())){#if CMK_WITH_STATS         _sendStats();#endif      _mainDone = 1; // This is needed because the destructors for                     // readonly variables will be called when the program		     // exits. If the destructor is called while _mainDone		     // is 0, it will assume that the readonly variable was		     // declared locally. On all processors other than 0, 		     // _mainDone is never set to 1 before the program exits.#if CMK_TRACE_ENABLED      if (_ringexit) traceClose();#endif    }      if (_ringexit) {        int stride = CkNumPes()/_ringtoken;        int pe = CkMyPe()+1;        if (pe < CkNumPes() && pe % stride != 0)          CmiSyncSendAndFree(pe, env->getTotalsize(), (char *)env);        else          CmiFree(env);      }      else        CmiFree(env);      //everyone exits here - there may be issues with leftover messages in the queue#if CMK_WITH_STATS      if(CkMyPe())#endif      {        DEBUGF(("[%d] Calling converse exit /n",CkMyPe()));        ConverseExit();        if(CharmLibInterOperate)          CpvAccess(interopExitFlag) = 1;      }      break;#if CMK_WITH_STATS    case StatMsg:      CkAssert(CkMyPe()==0);      _allStats[env->getSrcPe()] = (Stats*) EnvToUsr(env);      _numStatsRecd++;      DEBUGF(("StatMsg on %d with %d/n", CkMyPe(), _numStatsRecd));			/*FAULT_EVAC*/      if(_numStatsRecd==CkNumValidPes()) {        _printStats();        DEBUGF(("[%d] Calling converse exit /n",CkMyPe()));        ConverseExit();        if(CharmLibInterOperate)          CpvAccess(interopExitFlag) = 1;      }      break;#endif    default:      CmiAbort("Internal Error(_exitHandler): Unknown-msg-type. Contact Developers./n");  }}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:100,


示例2: Hello

  Hello(const CollideHandle &collide_) :collide(collide_)  {	  CkPrintf("Creating element %d on PE %d/n",thisIndex,CkMyPe());	  nTimes=0;	  CollideRegister(collide,thisIndex);  }
开发者ID:brog2610,项目名称:quinoa,代码行数:6,


示例3: CkpvAccess

LdbCoordinator::LdbCoordinator(){  if (CkpvAccess(LdbCoordinator_instance) == NULL) {    CkpvAccess(LdbCoordinator_instance) = this;  } else {    iout << iFILE << iERROR << iPE 	 << "LdbCoordinator instanced twice on same node!" << endi;    CkExit();  }  #if 0  // Create a load balancer  if (CkMyPe() == 0) {    //   CreateCentralLB();    CreateNamdCentLB();    //   CreateNamdNborLB();  }#endif  ldbCycleNum = 1;  takingLdbData = 1;  totalStepsDone = 0;  nLocalComputes = nLocalPatches = 0;  patchNAtoms = (int *) NULL;  sequencerThreads = (Sequencer **) NULL;  ldbStatsFP = NULL;  computeArray = NULL;  patchArray = NULL;  processorArray = NULL;  // Register self as an object manager for new charm++ balancer framework  theLbdb = LBDatabase::Object();   // Set the load balancing period (in seconds).  Without this the  // load balancing framework will hang until 1 second has passed  // since the last load balancing, causing hiccups in very fast runs.  // Unfortunately, the clock is already set for the first load  // balancing, but only +LBPeriod 1.0e-5 can fix that in older charm.  // For newer versions this is handled in initproc above.  theLbdb->SetLBPeriod(1.0e-5);  myOMid.id.idx = 1;  LDCallbacks cb = { (LDMigrateFn)staticMigrateFn,		     (LDStatsFn)staticStatsFn,		     (LDQueryEstLoadFn)staticQueryEstLoadFn                   };  myHandle = theLbdb->RegisterOM(myOMid,(void*)this,cb);  // Add myself as a local barrier receiver, so I know when I might  // be registering objects.  theLbdb->AddLocalBarrierReceiver((LDBarrierFn)staticReceiveAtSync,				   (void*)this);;  // Also, add a local barrier client, to trigger load balancing  ldBarrierHandle = theLbdb->    AddLocalBarrierClient((LDResumeFn)staticResumeFromSync,			  (void*)this);  migrateMsgs = 0; // linked list  numComputes = 0;  reg_all_objs = 1;}
开发者ID:sun51,项目名称:ece598HK,代码行数:62,


示例4: CmiPrintf

//.........这里部分代码省略.........  top_partition.origin[XDIR] = minx;  top_partition.origin[YDIR] = miny;  top_partition.origin[ZDIR] = minz;  top_partition.corner[XDIR] = maxx;  top_partition.corner[YDIR] = maxy;   top_partition.corner[ZDIR] = maxz;  top_partition.refno = 0;  top_partition.load = 0.0;  top_partition.count = nObjs;  // if we take background load into account  if (!_lb_args.ignoreBgLoad()) {    top_partition.bkpes.resize(0);    double total = totalLoad;    for (i=0; i<P; i++) {      if (!stats->procs[i].available) continue;      double bkload = stats->procs[i].bg_walltime;      total += bkload;    }    double averageLoad = total / npartition;    for (i=0; i<P; i++) {      if (!stats->procs[i].available) continue;      double bkload = stats->procs[i].bg_walltime;      if (bkload < averageLoad) top_partition.bkpes.push_back(i);      else CkPrintf("OrbLB Info> PE %d with %f background load will have 0 object./n", i, bkload);    }    npartition = top_partition.bkpes.size();    // formally add these bg load to total load    for (i=0; i<npartition; i++)       totalLoad += stats->procs[top_partition.bkpes[i]].bg_walltime;     if (_lb_args.debug()>=2) {      CkPrintf("BG load: ");      for (i=0; i<P; i++)  CkPrintf(" %f", stats->procs[i].bg_walltime);      CkPrintf("/n");      CkPrintf("Partition BG load: ");      for (i=0; i<npartition; i++)  CkPrintf(" %f", stats->procs[top_partition.bkpes[i]].bg_walltime);      CkPrintf("/n");    }  }  top_partition.load = totalLoad;  currentp = 0;  refno = 0;  // recursively divide  rec_divide(npartition, top_partition);  // mapping partitions to nodes  mapPartitionsToNodes();  // this is for sanity check  int *num = new int[P];  for (i=0; i<P; i++) num[i] = 0;  for (i=0; i<nObjs; i++)  {    for (j=0; j<npartition; j++)      if (computeLoad[i].refno == partitions[j].refno)   {        computeLoad[i].partition = partitions+j;        num[j] ++;    }    CmiAssert(computeLoad[i].partition != NULL);  }  for (i=0; i<npartition; i++)    if (num[i] != partitions[i].count)       CmiAbort("OrbLB: Compute counts don't agree!/n");  delete [] num;  // Save output  objIdx = 0;  for(int obj=0;obj<stats->n_objs;obj++) {      stats->to_proc[obj] = stats->from_proc[obj];      LDObjData &odata = stats->objData[obj];      if (odata.migratable == 0) { continue; }      int frompe = stats->from_proc[obj];      int tope = computeLoad[objIdx].partition->node;      if (frompe != tope) {        if (_lb_args.debug() >= 3) {              CkPrintf("[%d] Obj %d migrating from %d to %d/n",                     CkMyPe(),obj,frompe,tope);        }	stats->to_proc[obj] = tope;      }      objIdx ++;  }  // free memory  delete [] computeLoad;  for (i=0; i<3; i++) delete [] vArray[i];  delete [] partitions;  if (_lb_args.debug() >= 1)    CkPrintf("OrbLB finished time: %fs/n", CkWallTimer() - t);#endif}
开发者ID:davidheryanto,项目名称:sc14,代码行数:101,


示例5: DebugM

void ComputeDPME::doWork(){  DebugM(4,"Entering ComputeDPME::doWork()./n");  Pme2Particle *localData;  ResizeArrayIter<PatchElem> ap(patchList);  // Skip computations if nothing to do.  if ( ! patchList[0].p->flags.doFullElectrostatics )  {    for (ap = ap.begin(); ap != ap.end(); ap++) {      CompAtom *x = (*ap).positionBox->open();      Results *r = (*ap).forceBox->open();      (*ap).positionBox->close(&x);      (*ap).forceBox->close(&r);    }    if ( master ) {      master->reduction->submit();    }    return;  }  // allocate storage  numLocalAtoms = 0;  for (ap = ap.begin(); ap != ap.end(); ap++) {    numLocalAtoms += (*ap).p->getNumAtoms();  }  Lattice lattice = patchList[0].p->flags.lattice;  localData = new Pme2Particle[numLocalAtoms];  // given to message  // get positions and charges  Pme2Particle * data_ptr = localData;  const BigReal coulomb_sqrt = sqrt( COULOMB * ComputeNonbondedUtil::scaling				* ComputeNonbondedUtil::dielectric_1 );  for (ap = ap.begin(); ap != ap.end(); ap++) {    CompAtom *x = (*ap).positionBox->open();    if ( patchList[0].p->flags.doMolly ) {      (*ap).positionBox->close(&x);      x = (*ap).avgPositionBox->open();    }    int numAtoms = (*ap).p->getNumAtoms();    for(int i=0; i<numAtoms; ++i)    {      Vector tmp = lattice.delta(x[i].position);      data_ptr->x = tmp.x;      data_ptr->y = tmp.y;      data_ptr->z = tmp.z;      data_ptr->cg = coulomb_sqrt * x[i].charge;      data_ptr->id = x[i].id;      ++data_ptr;    }    if ( patchList[0].p->flags.doMolly ) { (*ap).avgPositionBox->close(&x); }    else { (*ap).positionBox->close(&x); }  }  // send data to master  ComputeDPMEDataMsg *msg = new ComputeDPMEDataMsg;  msg->node = CkMyPe();  msg->numParticles = numLocalAtoms;  msg->particles = localData;  comm->sendComputeDPMEData(msg);}
开发者ID:aar2163,项目名称:NAMD-energy,代码行数:67,


示例6: work

//.........这里部分代码省略.........	for (j=0; j<nobjs; j++) {	  int recverID = stats->getHash(objs[j]);	  if((senderID == -1)||(recverID == -1))	    if (_lb_args.migObjOnly()) continue;	    else CkAbort("Error in search/n");						  if(newmap[senderID]==newmap[recverID])	    continue;		  if(partgraph->edges[newmap[senderID]][newmap[recverID]] == 0){	    partgraph->nodes[newmap[senderID]].degree++;	    partgraph->nodes[newmap[recverID]].degree++;	  }	  //Communication added only once for a message sent to many objects on a single processor	  if(!addedComm[newmap[recverID]]){	    partgraph->edges[newmap[senderID]][newmap[recverID]] += cdata.bytes;	    partgraph->edges[newmap[recverID]][newmap[senderID]] += cdata.bytes;		    partgraph->nodes[newmap[senderID]].comm += cdata.bytes;	    partgraph->nodes[newmap[recverID]].comm += cdata.bytes;	    if(partgraph->nodes[newmap[senderID]].comm > max_comm){	      max_comm = partgraph->nodes[newmap[senderID]].comm;	      max_comm_part = newmap[senderID];	    }	    if(partgraph->nodes[newmap[recverID]].comm > max_comm){	      max_comm = partgraph->nodes[newmap[recverID]].comm;	      max_comm_part = newmap[recverID];	    }	    //bytesComm[newmap[senderID]][newmap[recverID]] += cdata.bytes;	    //bytesComm[newmap[recverID]][newmap[senderID]] += cdata.bytes;	    addedComm[newmap[recverID]]=1;	  }	}      }    }#endif	  int *proc_mapping = new int[n_pes];	  delete [] addedComm;		  LBtopoFn topofn;  //Parsing the command line input for getting the processor topology  char *lbcopy = strdup(_lbtopo);  char *ptr = strchr(lbcopy, ':');  if (ptr!=NULL)    ptr = strtok(lbcopy, ":");  else    ptr=lbcopy;  topofn = LBTopoLookup(ptr);  if (topofn == NULL) {    char str[1024];    CmiPrintf("TopoCentLB> Fatal error: Unknown topology: %s. Choose from:/n", ptr);    printoutTopo();    sprintf(str, "TopoCentLB> Fatal error: Unknown topology: %s", ptr);    CmiAbort(str);  }    topo = topofn(n_pes);  //Call the core routine to produce the partition processor mapping  calculateMST(partgraph,topo,proc_mapping,max_comm_part);  //Returned partition graph is a Maximum Spanning Tree -- converted in above function itself  //Debugging code: Result of mapping partition graph onto processor graph  if (_lb_args.debug()>1) {    CkPrintf("Resultant mapping..(partition,processor)/n");    for(i = 0; i < n_pes; i++)      CkPrintf("%d,%d/n",i,proc_mapping[i]);  }  //Store the result in the load balancing database  int pe;  PartGraph::Node* n;  for(i = 0; i < n_pes; i++){    pe = proc_mapping[i];    n = &partgraph->nodes[i];    for(j=0;j<n->num_objs;j++){      stats->to_proc[n->obj_list[j]] = pe;      if (_lb_args.debug()>1)         CkPrintf("[%d] Obj %d migrating from %d to %d/n", CkMyPe(),n->obj_list[j],stats->from_proc[n->obj_list[j]],pe);    }  }  delete[] newmap;  delete[] proc_mapping;  //Delete hopCount  for(i = 0; i < n_pes; i++)    delete[] hopCount[i];  delete[] hopCount;  delete[] heapMapping;	  delete partgraph;}
开发者ID:quinoacomputing,项目名称:quinoa,代码行数:101,


示例7: CpvInitialize

//! process command line arguments!void TraceCounter::traceInit(char **argv){  CpvInitialize(CountLogPool*, _logPool);  CpvInitialize(char*, _logName);  CpvInitialize(double, version);  CpvInitialize(char**, _counterNames);  CpvInitialize(char**, _counterDesc);  CpvInitialize(int,    _numCounters);  CpvInitialize(int, _reductionID);  CpvAccess(_logName) = (char *) malloc(strlen(argv[0])+1);  _MEMCHECK(CpvAccess(_logName));  strcpy(CpvAccess(_logName), argv[0]);  CpvAccess(version) = VER;  int i;  // parse command line args  char* counters = NULL;  commandLine_ = NULL;  bool badArg = false;  int numCounters = 0;  if (CmiGetArgStringDesc(argv, "+counters", &counters, "Measure these performance counters")) {    if (CmiMyPe()==0) { CmiPrintf("Counters: %s/n", counters); }    int offset = 0;    int limit = strlen(counters);    char* ptr = counters;    while (offset < limit && 	   (ptr = strtok(&counters[offset], ",")) != NULL)     {       offset += strlen(ptr)+1;      ptr = &ptr[strlen(ptr)+1];      numCounters++;     }    if (CmiMyPe()==0) {       CmiPrintf("There are %d counters/n", numCounters);     }    commandLine_ = new CounterArg[numCounters];    ptr = counters;    for (i=0; i<numCounters; i++) {      commandLine_[i].arg = ptr;      if (!matchArg(&commandLine_[i])) { 	if (CmiMyPe()==0) { CmiPrintf("Bad arg: [%s]/n", ptr); }	badArg = true;       }      ptr = &ptr[strlen(ptr)+1];    }  }  commandLineSz_ = numCounters;  // check to see if args are valid, output if not  if (badArg || CmiGetArgFlagDesc(argv, "+count-help", "List available performance counters")) {    if (CmiMyPe() == 0) { printHelp(); }    ConverseExit();  return;  }  else if (counters == NULL) {    if (CmiMyPe() == 0) { usage(); }    ConverseExit();  return;  }  // get optional command line args  overview_      = CmiGetArgFlag(argv, "+count-overview");    switchRandom_  = CmiGetArgFlag(argv, "+count-switchrandom");    switchByPhase_ = CmiGetArgFlag(argv, "+count-switchbyphase");  noLog_         = CmiGetArgFlag(argv, "+count-nolog");  writeByPhase_  = CmiGetArgFlag(argv, "+count-writebyphase");  char* logName  = NULL;  if (CmiGetArgString(argv, "+count-logname", &logName)) {    CpvAccess(_logName) = logName;    if (noLog_) {      if (CkMyPe()==0) {	CmiPrintf("+count-logname and +count-nolog are MUTUALLY EXCLUSIVE/n");	usage();	CmiAbort("");      }    }  }  if (switchByPhase_ && overview_) {    if (CkMyPe()==0) {      CmiPrintf(	"+count-switchbyphase and +count-overview are MUTUALLY EXCLUSIVE/n"	"+count-overview automatically switches by phase./n");      usage();      CmiAbort("");    }  }  if (writeByPhase_ && noLog_) {    if (CkMyPe()==0) {      CmiPrintf("+count-writebyphase and +count-nolog are MUTUALLY EXCLUSIVE/n");      usage();      CmiAbort("");    }  }  // parse through commandLine_, figure out which belongs on which list (1 vs 2)  CounterArg* last1 = NULL;  CounterArg* last2 = NULL;  CounterArg* tmp = NULL;  counter1Sz_ = counter2Sz_ = 0;  for (i=0; i<commandLineSz_; i++) {//.........这里部分代码省略.........
开发者ID:quinoacomputing,项目名称:quinoa,代码行数:101,


示例8: p

/// ENTRY: Gathers PVT reports; calculates and broadcasts GVT to PVTsvoid GVT::computeGVT(UpdateMsg *m){#ifndef CMK_OPTIMIZE  if(pose_config.stats)    localStats->TimerStart(GVT_TIMER);#endif  CProxy_PVT p(ThePVT);  CProxy_GVT g(TheGVT);  GVTMsg *gmsg = new GVTMsg;  POSE_TimeType lastGVT = 0, earliestMsg = POSE_UnsetTS,     earlyAny = POSE_UnsetTS;  SRentry *tmpSRs = SRs;  if (CkMyPe() != 0) startOffset = 1;  if (m->runGVTflag == 1) done++;  else {    // see if message provides new min optGVT or conGVT    if ((optGVT < 0) || ((m->optPVT > POSE_UnsetTS) && (m->optPVT < optGVT)))      optGVT = m->optPVT;    if ((conGVT < 0) || ((m->conPVT > POSE_UnsetTS) && (m->conPVT < conGVT)))      conGVT = m->conPVT;    if (m->maxSR > earlyAny)       earlyAny = m->maxSR;    // add send/recv info to SRs    /*    if (m->numEntries > 0)      CkPrintf("GVT recv'd %d SRs from a PE, earliest=%d/n", m->numEntries,       m->SRs[0].timestamp);*/    addSR(&SRs, m->SRs, optGVT, m->numEntries);    done++;  }  CkFreeMsg(m);  if (done == reportsExpected+startOffset) { // all PVT reports are in#ifndef CMK_OPTIMIZE    if(pose_config.stats)      localStats->GvtInc();#endif    gvtIterationCount++;    done = 0;    startOffset = 1;    lastGVT = estGVT; // store previous estimate    if (lastGVT < 0) lastGVT = 0;    estGVT = POSE_UnsetTS;        // derive GVT estimate from min optimistic & conservative GVTs    estGVT = optGVT;    if ((conGVT > POSE_UnsetTS) && (estGVT > POSE_UnsetTS) && (conGVT < estGVT))  estGVT = conGVT;    // Check if send/recv activity provides lower possible estimate    /*    if (SRs) SRs->dump();	  else CkPrintf("No SRs reported to GVT!/n");*/    SRentry *tmp = SRs;    POSE_TimeType lastSR = POSE_UnsetTS;    while (tmp && ((tmp->timestamp <= estGVT) || (estGVT == POSE_UnsetTS))) {      lastSR = tmp->timestamp;      if (tmp->sends != tmp->recvs) {	earliestMsg = tmp->timestamp;	break;      }      tmp = tmp->next;    }    /*    if ((earliestMsg > POSE_UnsetTS) || (earlyAny > POSE_UnsetTS))	  CkPrintf("GVT: earlyDiff=%d earlyAny=%d estGVT was %d./n", earliestMsg, earlyAny, estGVT);*/    if (((earliestMsg < estGVT) && (earliestMsg != POSE_UnsetTS)) ||	(estGVT == POSE_UnsetTS))      estGVT = earliestMsg;    if ((lastSR != POSE_UnsetTS) && (estGVT == POSE_UnsetTS) && 	(lastSR > lastGVT))      estGVT = lastSR;    // check for inactivity    if ((optGVT == POSE_UnsetTS) && (earliestMsg == POSE_UnsetTS)) {      inactive++;      /*      if (inactive == 1) {	CkPrintf("[%d] Inactive... calling CkWaitQD.../n", CkMyPe());	CkWaitQD();	CkPrintf("[%d] Back from CkWaitQD.../n", CkMyPe());      }      */      estGVT = lastGVT;      if (inactive == 1) inactiveTime = lastGVT;    }    else if (estGVT < 0) {      estGVT = lastGVT;      inactive = 0;    }    else inactive = 0;    // check the estimate    //CkPrintf("opt=%d con=%d lastGVT=%d early=%d lastSR=%d et=%d/n", optGVT, conGVT, lastGVT, earliestMsg, lastSR, POSE_endtime);    CmiAssert(estGVT >= lastGVT);     //if (estGVT % 1000 == 0)    //CkPrintf("[%d] New GVT = %d/n", CkMyPe(), estGVT);    //CkPrintf("[%d] New GVT = %lld/n", CkMyPe(), estGVT);    // check for termination conditions    int term = 0;    if ((estGVT >= POSE_endtime) && (POSE_endtime > POSE_UnsetTS)) {//.........这里部分代码省略.........
开发者ID:davidheryanto,项目名称:sc14,代码行数:101,


示例9: CmiAssert

void CentralLB::ReceiveStats(CkMarshalledCLBStatsMessage &msg){#if CMK_LBDB_ON  if (statsMsgsList == NULL) {    statsMsgsList = new CLBStatsMsg*[CkNumPes()];    CmiAssert(statsMsgsList != NULL);    for(int i=0; i < CkNumPes(); i++)      statsMsgsList[i] = 0;  }  if (statsData == NULL) statsData = new LDStats;    //  loop through all CLBStatsMsg in the incoming msg  int count = msg.getCount();  for (int num = 0; num < count; num++)   {    CLBStatsMsg *m = msg.getMessage(num);    CmiAssert(m!=NULL);    const int pe = m->from_pe;    DEBUGF(("Stats msg received, %d %d %d %p step %d/n", pe,stats_msg_count,m->n_objs,m,step()));#if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))     /*       *  if(m->step < step()){ *    //TODO: if a processor is redoing an old load balance step.. *    //tell it that the step is done and that it should not perform any migrations *      thisProxy[pe].ReceiveDummyMigration(); *  }*/#endif	    if(!CmiNodeAlive(pe)){	DEBUGF(("[%d] ReceiveStats called from invalidProcessor %d/n",CkMyPe(),pe));	continue;    }	    if (m->avail_vector!=NULL) {      LBDatabaseObj()->set_avail_vector(m->avail_vector,  m->next_lb);    }    if (statsMsgsList[pe] != 0) {      CkPrintf("*** Unexpected CLBStatsMsg in ReceiveStats from PE %d ***/n",	     pe);    } else {      statsMsgsList[pe] = m;#if USE_REDUCTION      depositData(m);#else      // store per processor data right away      struct ProcStats &procStat = statsData->procs[pe];      procStat.pe = pe;      procStat.total_walltime = m->total_walltime;      procStat.idletime = m->idletime;      procStat.bg_walltime = m->bg_walltime;#if CMK_LB_CPUTIMER      procStat.total_cputime = m->total_cputime;      procStat.bg_cputime = m->bg_cputime;#endif      procStat.pe_speed = m->pe_speed;      //procStat.utilization = 1.0;      procStat.available = CmiTrue;      procStat.n_objs = m->n_objs;      statsData->n_objs += m->n_objs;      statsData->n_comm += m->n_comm;#endif#if defined(TEMP_LDB)			procStat.pe_temp=m->pe_temp;			procStat.pe_speed=m->pe_speed;#endif      stats_msg_count++;    }  }    // end of for  const int clients = CkNumValidPes();  DEBUGF(("THIS POINT count = %d, clients = %d/n",stats_msg_count,clients));   if (stats_msg_count == clients) {	DEBUGF(("[%d] All stats messages received /n",CmiMyPe()));    statsData->nprocs() = stats_msg_count;    thisProxy[CkMyPe()].LoadBalance();  }#endif}
开发者ID:luyukunphy,项目名称:namd,代码行数:82,


示例10: return

/// Register poser with PVTint PVT::objRegister(int arrIdx, POSE_TimeType safeTime, int sync, sim *myPtr){  int i = objs.Insert(arrIdx, POSE_UnsetTS, sync, myPtr); // add to object list  return(i*1000 + CkMyPe());                          // return unique PVT idx}
开发者ID:davidheryanto,项目名称:sc14,代码行数:6,


示例11: objRemove

// Unregister poser from PVTvoid PVT::objRemove(int pvtIdx){  int idx = (pvtIdx-CkMyPe())/1000;  // calculate local index from unique index  objs.Delete(idx);                  // delete the object}
开发者ID:davidheryanto,项目名称:sc14,代码行数:6,


示例12: CkPrintf

/// Basic ConstructorPVT::PVT() {#ifdef VERBOSE_DEBUG  CkPrintf("[%d] constructing PVT/n",CkMyPe());#endif  CpvInitialize(int, stateRecovery);  CpvAccess(stateRecovery) = 0;  CpvInitialize(eventID, theEventID);  CpvAccess(theEventID)=eventID();  //  CpvAccess(theEventID).dump();  //LBTurnInstrumentOff();  optGVT = POSE_UnsetTS; conGVT = POSE_UnsetTS;  rdone=0;  SRs=NULL;#ifdef POSE_COMM_ON  //com_debug = 1;#endif#ifndef CMK_OPTIMIZE  localStats = (localStat *)CkLocalBranch(theLocalStats);  if (pose_config.stats) {    localStats->TimerStart(GVT_TIMER);  }#endif#ifdef MEM_TEMPORAL  localTimePool = (TimePool *)CkLocalBranch(TempMemID);  CkPrintf("NOTE: Temporal memory manager is ON!/n");#endif  optPVT = conPVT = estGVT = POSE_UnsetTS;  startPhaseActive = gvtTurn = simdone = 0;  SendsAndRecvs = new SRtable();  SendsAndRecvs->Initialize();  specEventCount = eventCount = waitForFirst = 0;  iterMin = POSE_UnsetTS;  int P=CkNumPes(), N=CkMyPe();  reportReduceTo =  -1;  if ((N < P-2) && (N%2 == 1)) { //odd    reportTo = N-1;    reportsExpected = reportEnd = 0;  }  else if (N < P-2) { //even    reportTo = N;    reportsExpected = 2;     if (N == P-3)      reportsExpected = 1;    reportEnd = 0;    if (N < (P-2)/2)      reportReduceTo = P-2;    else reportReduceTo = P-1;  }  if (N == P-2) {    reportTo = N;    reportEnd = 1;    reportsExpected = 1 + (P-2)/4 + ((P-2)%4)/2;  }  else if (N == P-1) {    reportTo = N;    reportEnd = 1;    if (P==1) reportsExpected = 1;    else reportsExpected = 1 + (P-2)/4 + (P-2)%2;  }  //  CkPrintf("PE %d reports to %d, receives %d reports, reduces and sends to %d, and reports directly to GVT if %d = 1!/n", CkMyPe(), reportTo, reportsExpected, reportReduceTo, reportEnd);  parCheckpointInProgress = 0;  parLastCheckpointGVT = 0;  parLastCheckpointTime = parStartTime = 0.0;  parLBInProgress = 0;  parLastLBGVT = 0;  //  debugBufferLoc = debugBufferWrapped = debugBufferDumped = 0;#ifndef CMK_OPTIMIZE  if(pose_config.stats)    localStats->TimerStop();#endif  LBDatabase::Object()->AddMigrationDoneFn(staticDoneLB, this);}
开发者ID:davidheryanto,项目名称:sc14,代码行数:76,


示例13: _initCharm

//.........这里部分代码省略.........		memCriticalEntries[memcnt++] = i;	    }	}    }#endif#if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))    _messageLoggingInit();#endif#ifndef __BIGSIM__	/*		FAULT_EVAC	*/	CpvAccess(_validProcessors) = new char[CkNumPes()];	for(int vProc=0;vProc<CkNumPes();vProc++){		CpvAccess(_validProcessors)[vProc]=1;	}	_ckEvacBcastIdx = CkRegisterHandler((CmiHandler)_ckEvacBcast);	_ckAckEvacIdx = CkRegisterHandler((CmiHandler)_ckAckEvac);#endif	CkpvAccess(startedEvac) = 0;	CpvAccess(serializer) = 0;	evacuate = 0;	CcdCallOnCondition(CcdSIGUSR1,(CcdVoidFn)CkDecideEvacPe,0);#if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))     CcdCallOnCondition(CcdSIGUSR2,(CcdVoidFn)CkMlogRestart,0);#endif	if(_raiseEvac){		processRaiseEvacFile(_raiseEvacFile);		/*		if(CkMyPe() == 2){		//	CcdCallOnConditionKeep(CcdPERIODIC_10s,(CcdVoidFn)CkDecideEvacPe,0);			CcdCallFnAfter((CcdVoidFn)CkDecideEvacPe, 0, 10000);		}		if(CkMyPe() == 3){			CcdCallFnAfter((CcdVoidFn)CkDecideEvacPe, 0, 10000);		}*/	}	        if (CkMyRank() == 0) {      TopoManager_init();    }    CmiNodeAllBarrier();    if (!_replaySystem) {        CkFtFn  faultFunc_restart = CkRestartMain;        if (faultFunc == NULL || faultFunc == faultFunc_restart) {         // this is not restart from memory            // these two are blocking calls for non-bigsim#if ! CMK_BIGSIM_CHARM	  CmiInitCPUAffinity(argv);          CmiInitMemAffinity(argv);#endif        }        CmiInitCPUTopology(argv);#if CMK_SHARED_VARS_POSIX_THREADS_SMP        if (CmiCpuTopologyEnabled()) {            int *pelist;            int num;            CmiGetPesOnPhysicalNode(0, &pelist, &num);#if !CMK_MULTICORE && !CMK_SMP_NO_COMMTHD            // Count communication threads, if present            // XXX: Assuming uniformity of node size here            num += num/CmiMyNodeSize();
开发者ID:gitter-badger,项目名称:quinoa,代码行数:67,


示例14: simple

		simple(double pi)		{			ckout<<"I am a simple chare running from processor:"<<CkMyPe()<<endl;			y = pi;		};
开发者ID:ChinmaySKulkarni,项目名称:Charm-Practice-Programs,代码行数:5,


示例15: CkNumPes

void CentralLB::LoadBalance(){#if CMK_LBDB_ON  int proc;  const int clients = CkNumPes();#if ! USE_REDUCTION  // build data  buildStats();#else  for (proc = 0; proc < clients; proc++) statsMsgsList[proc] = NULL;#endif  theLbdb->ResetAdaptive();  if (!_lb_args.samePeSpeed()) statsData->normalize_speed();  if (_lb_args.debug())       CmiPrintf("/nCharmLB> %s: PE [%d] step %d starting at %f Memory: %f MB/n",		  lbname, cur_ld_balancer, step(), start_lb_time,		  CmiMemoryUsage()/(1024.0*1024.0));  // if we are in simulation mode read data  if (LBSimulation::doSimulation) simulationRead();  char *availVector = LBDatabaseObj()->availVector();  for(proc = 0; proc < clients; proc++)      statsData->procs[proc].available = (CmiBool)availVector[proc];  preprocess(statsData);//    CkPrintf("Before Calling Strategy/n");  if (_lb_args.printSummary()) {      LBInfo info(clients);        // not take comm data      info.getInfo(statsData, clients, 0);      LBRealType mLoad, mCpuLoad, totalLoad;      info.getSummary(mLoad, mCpuLoad, totalLoad);      int nmsgs, nbytes;      statsData->computeNonlocalComm(nmsgs, nbytes);      CkPrintf("[%d] Load Summary (before LB): max (with bg load): %f max (obj only): %f average: %f at step %d nonlocal: %d msgs %.2fKB./n", CkMyPe(), mLoad, mCpuLoad, totalLoad/clients, step(), nmsgs, 1.0*nbytes/1024);//      if (_lb_args.debug() > 1) {//        for (int i=0; i<statsData->n_objs; i++)//          CmiPrintf("[%d] %.10f %.10f/n", i, statsData->objData[i].minWall, statsData->objData[i].maxWall);//      }  }#if CMK_REPLAYSYSTEM  LDHandle *loadBalancer_pointers;  if (_replaySystem) {    loadBalancer_pointers = (LDHandle*)malloc(CkNumPes()*sizeof(LDHandle));    for (int i=0; i<statsData->n_objs; ++i) loadBalancer_pointers[statsData->from_proc[i]] = statsData->objData[i].handle.omhandle.ldb;  }#endif    LBMigrateMsg* migrateMsg = Strategy(statsData);#if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))	migrateMsg->step = step();#endif#if CMK_REPLAYSYSTEM  CpdHandleLBMessage(&migrateMsg);  if (_replaySystem) {    for (int i=0; i<migrateMsg->n_moves; ++i) migrateMsg->moves[i].obj.omhandle.ldb = loadBalancer_pointers[migrateMsg->moves[i].from_pe];    free(loadBalancer_pointers);  }#endif    LBDatabaseObj()->get_avail_vector(migrateMsg->avail_vector);  migrateMsg->next_lb = LBDatabaseObj()->new_lbbalancer();  // if this is the step at which we need to dump the database  simulationWrite();//  calculate predicted load//  very time consuming though, so only happen when debugging is on  if (_lb_args.printSummary()) {      LBInfo info(clients);        // not take comm data      getPredictedLoadWithMsg(statsData, clients, migrateMsg, info, 0);      LBRealType mLoad, mCpuLoad, totalLoad;      info.getSummary(mLoad, mCpuLoad, totalLoad);      int nmsgs, nbytes;      statsData->computeNonlocalComm(nmsgs, nbytes);      CkPrintf("[%d] Load Summary (after LB): max (with bg load): %f max (obj only): %f average: %f at step %d nonlocal: %d msgs %.2fKB useMem: %.2fKB./n", CkMyPe(), mLoad, mCpuLoad, totalLoad/clients, step(), nmsgs, 1.0*nbytes/1024, (1.0*useMem())/1024);      for (int i=0; i<clients; i++)        migrateMsg->expectedLoad[i] = info.peLoads[i];  }  DEBUGF(("[%d]calling recv migration/n",CkMyPe()));#if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))     lbDecisionCount++;    migrateMsg->lbDecisionCount = lbDecisionCount;#endif  envelope *env = UsrToEnv(migrateMsg);  if (1) {      // broadcast    thisProxy.ReceiveMigration(migrateMsg);  }//.........这里部分代码省略.........
开发者ID:luyukunphy,项目名称:namd,代码行数:101,


示例16: FEM_master_parallel_part

//.........这里部分代码省略.........  printf("Creating mapping of node to partition took %.6lf/n",CkWallTimer()-dataArrangeStartTime);  dataArrangeStartTime = CkWallTimer();  MSA1DINTLIST::Read nodepartRead = nodepartAcc.syncToRead();	  /*    Set up a msa to store the nodes that belong to a partition  */  MSA1DNODELIST part2node(numChunks,numChunks);  MPI_Bcast_pup(part2node,masterRank,(MPI_Comm)comm_context);  part2node.enroll(numChunks);  MSA1DNODELIST::Accum part2nodeAcc = part2node.getInitialAccum();  FEM_write_part2node(nodepartRead, part2nodeAcc, partdata, (MPI_Comm)comm_context);	  /*    Get the list of elements and nodes that belong to this partition  */  MSA1DNODELIST::Read rPart2node = part2nodeAcc.syncToRead();  NodeList lnodes = rPart2node.get(masterRank);  lnodes.uniquify();//  IntList lelems = part2elem.get(masterRank);		printf("Creating mapping of  partition to node took %.6lf/n",CkWallTimer()-dataArrangeStartTime);  printf("Time spent doing +=ElemList %.6lf /n",elemlistaccTime);	dataArrangeStartTime = CkWallTimer();  /*    Build an MSA of FEM_Mesh, with each index containing the mesh for that  chunk  */  MSA1DFEMMESH part2mesh(numChunks,numChunks);  MPI_Bcast_pup(part2mesh,masterRank,(MPI_Comm)comm_context);  part2mesh.enroll(numChunks);  MSA1DFEMMESH::Accum aPart2mesh = part2mesh.getInitialAccum();  FEM_write_part2mesh(aPart2mesh,partdata, &data,nodepartRead,numChunks,masterRank,&mypiece);  /*    Get your mesh consisting of elements and nodes out of the mesh MSA  */  MSA1DFEMMESH::Read rPart2mesh = aPart2mesh.syncToRead();  MeshElem me = rPart2mesh.get(masterRank);  //printf("[%d] Number of elements in my partitioned mesh %d number of nodes %d /n",masterRank,me.m->nElems(),me.m->node.size());	  DEBUG(printf("[%d] Memory usage on vp 0 close to max %d /n",CkMyPe(),CmiMemoryUsage()));	//Free up the eptr and eind MSA arrays stored in data  delete &rPtr;  delete &rInd;  data.arr1.FreeMem();  data.arr2.FreeMem();  nodepart.FreeMem();  DEBUG(printf("[%d] Memory usage on vp 0 after FreeMem %d /n",CkMyPe(),CmiMemoryUsage()));	  addIDXLists(me.m,lnodes,masterRank);		part2node.FreeMem();  DEBUG(printf("[%d] Memory usage on vp 0 after addIDXL %d /n",CkMyPe(),CmiMemoryUsage()));	  /*    Broadcast  the user data to all the meshes  */  DEBUG(printf("[%d] Length of udata vector in master %d /n",masterRank,m->udata.size()));  MPI_Bcast_pup(m->udata,masterRank,(MPI_Comm)comm_context);  me.m->udata = m->udata;		  delete partdata;  	printf("[%d] Data Arrangement took %.6lf /n",masterRank,CkWallTimer()-dataArrangeStartTime);		/*    collect the ghost data and send it to all the chunks.  */  struct ghostdata *gdata = gatherGhosts();  DEBUG(printf("[%d] number of ghost layers %d /n",masterRank,gdata->numLayers));  MPI_Bcast_pup(*gdata,masterRank,(MPI_Comm)comm_context);  /*    make ghosts for this mesh  */  printf("[%d] Starting to generate number of ghost layers %d /n",masterRank,gdata->numLayers);	double _startTime = CkWallTimer();  makeGhosts(me.m,(MPI_Comm)comm_context,masterRank,gdata->numLayers,gdata->layers);  delete gdata;		printf("[%d] Ghost generation took %.6lf /n",masterRank,CkWallTimer()-_startTime);	  me.m->becomeGetting();  FEM_chunk *chunk = FEM_chunk::get("FEM_Mesh_Parallel_broadcast");  int tempMeshNo = chunk->meshes.put(me.m);  int new_mesh = FEM_Mesh_copy(tempMeshNo);	  FEM_Mesh *nmesh = c->lookup(new_mesh,"master_parallel_broadcast");  DEBUG(printf("[%d] Length of udata vector in master new_mesh %d /n",masterRank,nmesh->udata.size()));		part2mesh.FreeMem();  printf("[%d] Max Memory usage on vp 0 at end of parallel partition %d /n",CkMyPe(),CmiMaxMemoryUsage());		  return new_mesh;}
开发者ID:davidheryanto,项目名称:sc14,代码行数:101,


示例17: Hello

 Hello(int _aNum, CkGroupID mcastMgrGID): aNum(_aNum), mcastMgr(NULL), isCookieSet(false) {   CkPrintf("Array %d, Element %d created on PE %d/n", aNum, thisIndex, CkMyPe());   mcastMgr = CProxy_CkMulticastMgr(mcastMgrGID).ckLocalBranch(); }
开发者ID:brog2610,项目名称:quinoa,代码行数:5,


示例18: CkPrintf

void GridCommLB::Map_NonMigratable_Objects_To_PEs (){    int i;    for (i = 0; i < Num_Objects; i++) {        if (!((&Object_Data[i])->migratable)) {            if (_lb_args.debug() > 1) {                CkPrintf ("[%d] GridCommLB identifies object %d as non-migratable./n", CkMyPe(), i);            }            Assign_Object_To_PE (i, (&Object_Data[i])->from_pe);        }    }}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:15,


示例19: CentralLB

OrbLB::OrbLB(const CkLBOptions &opt): CentralLB(opt){  lbname = "OrbLB";  if (CkMyPe() == 0)    CkPrintf("[%d] OrbLB created/n",CkMyPe());}
开发者ID:davidheryanto,项目名称:sc14,代码行数:6,


示例20: if

//.........这里部分代码省略.........        int min_objs;        int i;        min_index = -1;        min_objs = MAXINT;        for (i = 0; i < Num_PEs; i++) {            if (((&PE_Data[i])->available) && ((&PE_Data[i])->cluster == cluster)) {                if ((&PE_Data[i])->num_objs < min_objs) {                    min_index = i;                    min_objs = (&PE_Data[i])->num_objs;                } else if (((&PE_Data[i])->num_objs == min_objs) &&                           ((&PE_Data[i])->num_wan_objs < (&PE_Data[min_index])->num_wan_objs)) {                    min_index = i;                } else if (((&PE_Data[i])->num_objs == min_objs) &&                           ((&PE_Data[i])->num_wan_objs == (&PE_Data[min_index])->num_wan_objs) &&                           ((&PE_Data[i])->num_wan_msgs < (&PE_Data[min_index])->num_wan_msgs)) {                    min_index = i;                } else if (((&PE_Data[i])->num_objs == min_objs) &&                           ((&PE_Data[i])->num_wan_objs == (&PE_Data[min_index])->num_wan_objs) &&                           ((&PE_Data[i])->num_wan_msgs == (&PE_Data[min_index])->num_wan_msgs) &&                           ((&PE_Data[i])->scaled_load < (&PE_Data[min_index])->scaled_load)) {                    min_index = i;                }            }        }        return (min_index);    } else if (CK_LDB_GridCommLB_Mode == 1) {        int min_index;        int min_load_index;        double min_scaled_load;        int min_wan_msgs_index;        int min_wan_msgs;        double load_tolerance;        int i;        min_index = -1;        min_load_index = -1;        min_scaled_load = MAXDOUBLE;        min_wan_msgs_index = -1;        min_wan_msgs = MAXINT;        for (i = 0; i < Num_PEs; i++) {            if (((&PE_Data[i])->available) && ((&PE_Data[i])->cluster == cluster)) {                if ((&PE_Data[i])->scaled_load < min_scaled_load) {                    min_load_index = i;                    min_scaled_load = (&PE_Data[i])->scaled_load;                }                if ((&PE_Data[i])->num_wan_msgs < min_wan_msgs) {                    min_wan_msgs_index = i;                    min_wan_msgs = (&PE_Data[i])->num_wan_msgs;                }            }        }        // If no PE at all was found, return a -1.        if (min_load_index < 0) {            return (min_load_index);        }        // If the number of WAN messages on the lightest loaded PE happens to match the minimum number        // of WAN messages overall, we win because this target PE is overall the minimum PE in terms        // of both load *and* WAN messages.        if ((&PE_Data[min_load_index])->num_wan_msgs <= (&PE_Data[min_wan_msgs_index])->num_wan_msgs) {            return (min_load_index);        }        // Otherwise, we now search for PEs that have loads +/- our tolerance.  If any PE has a load        // within our tolerance, check its number of WAN messages.  The one of these that has the        // fewest WAN messages is probably the best candidate for placing the next object onto.        load_tolerance = (&PE_Data[min_load_index])->scaled_load * CK_LDB_GridCommLB_Load_Tolerance;        min_index = min_load_index;        for (i = 0; i < Num_PEs; i++) {            if (((&PE_Data[i])->available) && ((&PE_Data[i])->cluster == cluster)) {                if (i != min_load_index) {                    if (fabs ((&PE_Data[i])->scaled_load - (&PE_Data[min_load_index])->scaled_load) <= load_tolerance) {                        if ((&PE_Data[i])->num_wan_msgs < (&PE_Data[min_index])->num_wan_msgs) {                            min_index = i;                        }                    }                }            }        }        return (min_index);    } else {        if (_lb_args.debug() > 0) {            CkPrintf ("[%d] GridCommLB was told to use bad mode (%d)./n", CkMyPe(), CK_LDB_GridCommLB_Mode);        }        return (-1);    }}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:101,


示例21: driver

extern "C" voiddriver(void){  int ignored;  int i, count;    int myChunk=FEM_My_partition();    /*Add a refinement object to FEM array*/  CkPrintf("[%d] begin init/n",myChunk);  FEM_REFINE2D_Init();  CkPrintf("[%d] end init/n",myChunk);    myGlobals g;  FEM_Register(&g,(FEM_PupFn)pup_myGlobals);  init_myGlobal(&g);    g.nnodes = FEM_Mesh_get_length(FEM_Mesh_default_read(),FEM_NODE);  int maxNodes = g.nnodes;  g.maxnodes=2*maxNodes;  g.m_i_fid=FEM_Create_field(FEM_DOUBLE,1,0,sizeof(double));  resize_nodes((void *)&g,&g.nnodes,&maxNodes);  int nghost=0;  g.nelems=FEM_Mesh_get_length(FEM_Mesh_default_read(),FEM_ELEM);  g.maxelems=g.nelems;  resize_elems((void *)&g,&g.nelems,&g.maxelems);  FEM_REFINE2D_Newmesh(FEM_Mesh_default_read(),FEM_NODE,FEM_ELEM);    //Initialize associated data  for (i=0;i<g.maxnodes;i++) {    g.R_net[i]=g.d[i]=g.v[i]=g.a[i]=vector2d(0.0);  }    //Apply a small initial perturbation to positions  for (i=0;i<g.nnodes;i++) {    const double max=1.0e-15/15.0; //Tiny perturbation    g.d[i].x+=max*(i&15);    g.d[i].y+=max*((i+5)&15);  }    int fid=FEM_Create_field(FEM_DOUBLE,2,0,sizeof(vector2d));    for (i=0;i<g.nelems;i++){    checkTriangle(g,i);  }	  sleep(5);  //Timeloop  if (CkMyPe()==0){    CkPrintf("Entering timeloop/n");  }	  //  int tSteps=0x70FF00FF;  int tSteps=4;  int z=13;  calcMasses(g);  double startTime=CkWallTimer();  double curArea=2.5e-5/1024;  int t = 0;  // THIS IS THE INITIAL MESH SENT TO NetFEM  if (1) { //Publish data to the net    publishMeshToNetFEM(g,myChunk,t);  }  double desiredArea;  /*   //should not be necessary as it would have been set in the init  for (i=0; i<g.nnodes; i++) {    g.validNode[i] = 1;  }  for (i=0; i<g.nelems; i++) {    g.validElem[i] = 1;  }*/  double avgArea = 0.0;  for (i=0;i<g.nelems;i++) {    avgArea += calcArea(g, i);  }  avgArea /= g.nelems;  for (t=1;t<=tSteps;t++) {    /*    if (1) { //Structural mechanics    //Compute forces on nodes exerted by elements    CST_NL(g.coord,g.conn,g.R_net,g.d,matConst,g.nnodes,g.nelems,g.S11,g.S22,g.S12);    //Communicate net force on shared nodes    FEM_Update_field(fid,g.R_net);    //Advance node positions    advanceNodes(dt,g.nnodes,g.coord,g.R_net,g.a,g.v,g.d,g.m_i,(t%4)==0);    }*/        //Debugging/perf. output    double curTime=CkWallTimer();    double total=curTime-startTime;    startTime=curTime;    vector2d *loc;    double *areas;	    // prepare to coarsen    loc=new vector2d[2*g.nnodes];    for (i=0;i<g.nnodes;i++) {      loc[i]=g.coord[i];//+g.d[i];    }    areas=new double[g.nelems];    for (i=0;i<g.nelems;i++) {//.........这里部分代码省略.........
开发者ID:davidheryanto,项目名称:sc14,代码行数:101,


示例22: CkPrintf

Slave::Slave() {	/* ==> read-only variables set by the main chare	k = kInput;	thresh = threshInput;	max_level = 30;	*/	CkPrintf("Constructor of the Slave chare # %d is called on processor %d./n", thisIndex, CkMyPe());	int n = (int) log2(numProcesses);	int l = thisIndex;	Function *function = new Function(n, l, k, thresh, test1);	mainProxy.done_refine();}
开发者ID:MohammadMahdiJavanmard,项目名称:MADNESS-CHARM,代码行数:16,


示例23: CBase_MetisLB

MetisLB::MetisLB(const CkLBOptions &opt): CBase_MetisLB(opt){  lbname = "MetisLB";  if (CkMyPe() == 0)    CkPrintf("[%d] MetisLB created/n",CkMyPe());}
开发者ID:quinoacomputing,项目名称:quinoa,代码行数:6,


示例24: NAMD_die

//.........这里部分代码省略.........  if ( simParams->switchingActive ) splitType = SPLIT_SHIFT;  if ( simParams->martiniSwitching ) splitType = SPLIT_MARTINI;  if ( simParams->fullDirectOn || simParams->FMAOn || PMEOn || MSMOn ) {    switch ( simParams->longSplitting ) {      case C2:      splitType = SPLIT_C2;      break;      case C1:      splitType = SPLIT_C1;      break;      case XPLOR:      NAMD_die("Sorry, XPLOR splitting not supported.");      break;      case SHARP:      NAMD_die("Sorry, SHARP splitting not supported.");      break;      default:      NAMD_die("Unknown splitting type found!");    }  }  BigReal r2_tol = 0.1;    r2_delta = 1.0;  r2_delta_exp = 0;  while ( r2_delta > r2_tol ) { r2_delta /= 2.0; r2_delta_exp += 1; }  r2_delta_1 = 1.0 / r2_delta;  if ( ! CkMyPe() ) {    iout << iINFO << "NONBONDED TABLE R-SQUARED SPACING: " <<				r2_delta << "/n" << endi;  }  BigReal r2_tmp = 1.0;  int cutoff2_exp = 0;  while ( (cutoff2 + r2_delta) > r2_tmp ) { r2_tmp *= 2.0; cutoff2_exp += 1; }  int i;  int n = (r2_delta_exp + cutoff2_exp) * 64 + 1;  if ( ! CkMyPe() ) {    iout << iINFO << "NONBONDED TABLE SIZE: " <<				n << " POINTS/n" << endi;  }  if ( table_alloc ) delete [] table_alloc;  table_alloc = new BigReal[61*n+16];  BigReal *table_align = table_alloc;  while ( ((long)table_align) % 128 ) ++table_align;  table_noshort = table_align;  table_short = table_align + 16*n;  slow_table = table_align + 32*n;  fast_table = table_align + 36*n;  scor_table = table_align + 40*n;  corr_table = table_align + 44*n;  full_table = table_align + 48*n;  vdwa_table = table_align + 52*n;  vdwb_table = table_align + 56*n;  r2_table = table_align + 60*n;  BigReal *fast_i = fast_table + 4;  BigReal *scor_i = scor_table + 4;
开发者ID:wware,项目名称:namd-povray-cloud,代码行数:67,


示例25: ProcArray

void MetisLB::work(LDStats* stats){  /** ========================== INITIALIZATION ============================= */  ProcArray *parr = new ProcArray(stats);  ObjGraph *ogr = new ObjGraph(stats);  /** ============================= STRATEGY ================================ */  if (_lb_args.debug() >= 2) {    CkPrintf("[%d] In MetisLB Strategy.../n", CkMyPe());  }  // convert ObjGraph to the adjacency structure  int numVertices = ogr->vertices.size();	// number of vertices  int numEdges = 0;				// number of edges  double maxLoad = 0.0;  int i, j, k, vert;  /** remove duplicate edges from recvFrom */  for(i = 0; i < numVertices; i++) {    for(j = 0; j < ogr->vertices[i].sendToList.size(); j++) {      vert = ogr->vertices[i].sendToList[j].getNeighborId();      for(k = 0; k < ogr->vertices[i].recvFromList.size(); k++) {	if(ogr->vertices[i].recvFromList[k].getNeighborId() == vert) {	  ogr->vertices[i].sendToList[j].setNumBytes(ogr->vertices[i].sendToList[j].getNumBytes() + ogr->vertices[i].recvFromList[k].getNumBytes());	  ogr->vertices[i].recvFromList.erase(ogr->vertices[i].recvFromList.begin() + k);        }      }    }  }  /** the object load is normalized to an integer between 0 and 256 */  for(i = 0; i < numVertices; i++) {    if(ogr->vertices[i].getVertexLoad() > maxLoad)      maxLoad = ogr->vertices[i].getVertexLoad();    numEdges = numEdges + ogr->vertices[i].sendToList.size() + ogr->vertices[i].recvFromList.size();  }  /* adjacency list */  idx_t *xadj = new idx_t[numVertices + 1];  /* id of the neighbors */  idx_t *adjncy = new idx_t[numEdges];  /* weights of the vertices */  idx_t *vwgt = new idx_t[numVertices];  /* weights of the edges */  idx_t *adjwgt = new idx_t[numEdges];  int edgeNum = 0;  double ratio = 256.0/maxLoad;  for(i = 0; i < numVertices; i++) {    xadj[i] = edgeNum;    vwgt[i] = (int)ceil(ogr->vertices[i].getVertexLoad() * ratio);    for(j = 0; j < ogr->vertices[i].sendToList.size(); j++) {      adjncy[edgeNum] = ogr->vertices[i].sendToList[j].getNeighborId();      adjwgt[edgeNum] = ogr->vertices[i].sendToList[j].getNumBytes();      edgeNum++;    }    for(j = 0; j < ogr->vertices[i].recvFromList.size(); j++) {      adjncy[edgeNum] = ogr->vertices[i].recvFromList[j].getNeighborId();      adjwgt[edgeNum] = ogr->vertices[i].recvFromList[j].getNumBytes();      edgeNum++;    }  }  xadj[i] = edgeNum;  CkAssert(edgeNum == numEdges);  idx_t edgecut;		// number of edges cut by the partitioning  idx_t *pemap;  idx_t options[METIS_NOPTIONS];  METIS_SetDefaultOptions(options);  //options[METIS_OPTION_PTYPE] = METIS_PTYPE_RB;  // C style numbering  options[METIS_OPTION_NUMBERING] = 0;  // number of constrains  idx_t ncon = 1;  // number of partitions  idx_t numPes = parr->procs.size();  real_t ubvec[ncon];  // allow 10% imbalance  ubvec[0] = 1.1;  // mapping of objs to partitions  pemap = new idx_t[numVertices];  // Specifies size of vertices for computing the total communication volume  idx_t *vsize = NULL;  // This array of size nparts specifies the desired weight for each partition  // and setting it to NULL indicates graph should be equally divided among  // partitions  real_t *tpwgts = NULL;  int option = 0;  if (WEIGHTED == option) {    // set up the different weights between 0 and 1    tpwgts = new real_t[numPes];    for (i = 0; i < numPes; i++) {      tpwgts[i] = 1.0/(real_t)numPes;//.........这里部分代码省略.........
开发者ID:quinoacomputing,项目名称:quinoa,代码行数:101,


示例26: CreateNamdNborLB

void LdbCoordinator::initialize(PatchMap *pMap, ComputeMap *cMap, int reinit){  const SimParameters *simParams = Node::Object()->simParameters;#if 0  static int lbcreated = 0; // XXX static variables are unsafe for SMP  // PE0 first time Create a load balancer  if (CkMyPe() == 0 && !lbcreated) {    if (simParams->ldbStrategy == LDBSTRAT_ALGNBOR)       CreateNamdNborLB();    else {      //   CreateCentralLB();      CreateNamdCentLB();    }    lbcreated = 1;  }#endif  //  DebugM(10,"stepsPerLdbCycle initialized/n");  stepsPerLdbCycle = simParams->ldbPeriod;  firstLdbStep = simParams->firstLdbStep;  int lastLdbStep = simParams->lastLdbStep;  int stepsPerCycle = simParams->stepsPerCycle;  computeMap = cMap;  patchMap = pMap;  // Set the number of received messages correctly for node 0  nStatsMessagesExpected = Node::Object()->numNodes();  nStatsMessagesReceived = 0;  if (patchNAtoms)     delete [] patchNAtoms;  // Depends on delete NULL to do nothing  nPatches = patchMap->numPatches();  patchNAtoms = new int[nPatches];  typedef Sequencer *seqPtr;  if ( ! reinit ) {    delete [] sequencerThreads;  // Depends on delete NULL to do nothing    sequencerThreads = new seqPtr[nPatches];  }  nLocalPatches=0;  int i;  for(i=0;i<nPatches;i++)  {    if (patchMap->node(i) == Node::Object()->myid())    {      nLocalPatches++;      patchNAtoms[i]=0;    } else {      patchNAtoms[i]=-1;    }    if ( ! reinit ) sequencerThreads[i]=NULL;  }  if ( ! reinit ) controllerThread = NULL;  if (nLocalPatches != patchMap->numHomePatches())    NAMD_die("Disaggreement in patchMap data./n");   const int oldNumComputes = numComputes;  nLocalComputes = 0;  numComputes = computeMap->numComputes();  for(i=0;i<numComputes;i++)  {    if ( (computeMap->node(i) == Node::Object()->myid())	 && ( 0#ifndef NAMD_CUDA	      || (computeMap->type(i) == computeNonbondedSelfType)	      || (computeMap->type(i) == computeNonbondedPairType)#endif	      || (computeMap->type(i) == computeLCPOType)	      || (computeMap->type(i) == computeSelfExclsType)	      || (computeMap->type(i) == computeSelfBondsType)	      || (computeMap->type(i) == computeSelfAnglesType)	      || (computeMap->type(i) == computeSelfDihedralsType)	      || (computeMap->type(i) == computeSelfImpropersType)	      || (computeMap->type(i) == computeSelfTholeType)	      || (computeMap->type(i) == computeSelfAnisoType)	      || (computeMap->type(i) == computeSelfCrosstermsType)                 || (computeMap->type(i) == computeBondsType)                 || (computeMap->type(i) == computeExclsType)                 || (computeMap->type(i) == computeAnglesType)                 || (computeMap->type(i) == computeDihedralsType)                 || (computeMap->type(i) == computeImpropersType)                 || (computeMap->type(i) == computeTholeType)                 || (computeMap->type(i) == computeAnisoType)                 || (computeMap->type(i) == computeCrosstermsType)	) ) {      nLocalComputes++;    }  }    // New LB frameworks registration  // Allocate data structure to save incoming migrations.  Processor  // zero will get all migrations//.........这里部分代码省略.........
开发者ID:sun51,项目名称:ece598HK,代码行数:101,


示例27: _bufferHandler

static void _bufferHandler(void *msg){  DEBUGF(("[%d] _bufferHandler called./n", CkMyPe()));  CkpvAccess(_buffQ)->enq(msg);}
开发者ID:gitter-badger,项目名称:quinoa,代码行数:5,



注:本文中的CkMyPe函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ CkNumPes函数代码示例
C++ CkExit函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。