Example #1
0
static void collectNumbers(ProcMsg *msg)
{
  int npes;
  EmptyMsg emsg;

  if(CpvAccess(isSingle)) {
    CpvAccess(Time1) = CmiWallTimer() - CpvAccess(Time1);
    CpvAccess(seqPI) = 4.0 * msg->success / NTRIALS;
    CpvAccess(isSingle) = 0;
    CpvAccess(nreported) = 0;
    CpvAccess(success) = 0;
    msg->success = NTRIALS/CmiNumPes();
    CmiSetHandler(msg, CpvAccess(trial_handler));
    CmiSyncBroadcastAll(sizeof(ProcMsg), msg);
    CpvAccess(TimeN) = CmiWallTimer();
  } else {
    CpvAccess(nreported)++;
    CpvAccess(success) += msg->success;
    if(CpvAccess(nreported)==CmiNumPes()) {
      CpvAccess(TimeN) = CmiWallTimer() - CpvAccess(TimeN);
      CpvAccess(parPI) = 4.0 * CpvAccess(success) / NTRIALS;
      npes = iround(CpvAccess(Time1)/CpvAccess(TimeN));
      CmiPrintf("[proc] Tseq = %le seconds, Tpar = %le seconds\n",
                 CpvAccess(Time1), CpvAccess(TimeN));
      CmiPrintf("[proc] CmiNumPes() reported %d processors\n", CmiNumPes());
      CmiPrintf("[proc] But actual number of processors is %d\n", npes);
      CmiPrintf("[proc] FYI, appox PI (seq) = %lf\n",CpvAccess(seqPI));
      CmiPrintf("[proc] FYI, appox PI (par) = %lf\n",CpvAccess(parPI));
      CmiSetHandler(&emsg, CpvAccess(ack_handler));
      CmiSyncSend(0, sizeof(EmptyMsg), &emsg);
    }
  }
}
Example #2
0
/**
 * This is the entrance point of a CCS request into the server.
 * It is executed only on proc 0, and it forwards the request to the appropriate PE.
 */
void CcsImpl_netRequest(CcsImplHeader *hdr,const void *reqData)
{
  char *msg;
  int len,repPE=ChMessageInt(hdr->pe);
  if (repPE<=-CmiNumPes() || repPE>=CmiNumPes()) {
#if ! CMK_BIGSIM_CHARM
    /*Treat out of bound values as errors. Helps detecting bugs*/
    if (repPE==-CmiNumPes()) CmiPrintf("Invalid processor index in CCS request: are you trying to do a broadcast instead?");
    else CmiPrintf("Invalid processor index in CCS request.");
    CpvAccess(ccsReq)=hdr;
    CcsSendReply(0,NULL); /*Send an empty reply to the possibly waiting client*/
    return;
#endif
  }

  msg=CcsImpl_ccs2converse(hdr,reqData,&len);
  if (repPE >= 0) {
    /* The following %CmiNumPes() follows the assumption that in BigSim the mapping is round-robin */
    //CmiPrintf("CCS message received for %d\n",repPE);
    CmiSyncSendAndFree(repPE%CmiNumPes(),len,msg);
  } else if (repPE == -1) {
    /* Broadcast to all processors */
    //CmiPrintf("CCS broadcast received\n");
    CmiSyncSendAndFree(0,len,msg);
  } else {
    /* Multicast to -repPE processors, specified right at the beginning of reqData (as a list of pes) */
    int firstPE = ChMessageInt(*(ChMessageInt_t*)reqData);
    /* The following %CmiNumPes() follows the assumption that in BigSim the mapping is round-robin */
    //CmiPrintf("CCS multicast received\n");
    CmiSyncSendAndFree(firstPE%CmiNumPes(),len,msg);
  }
}
Example #3
0
  void cb_client(CkReductionMsg *msg)
  {
    endTime = CkWallTimer ();
    int dataSize = msg->getSize();
    void *data = msg->getData();
    CmiPrintf("%e\n", endTime-startTime); 

    // check correctness
    int result;
    int redno = msg->getRedNo();
    result = 0;
    for (int i=0; i<sectionSize; i++) result+=i;

    if (*(int *)data != result) {
      CmiPrintf("Expected: %d acual:%d\n", result, *(int *)data);
      CmiAbort("reduction result is wrong!");
    }
  
    cnt.reductionsRemaining--;
    if (cnt.reductionsRemaining<=0) {
      CProxy_main mproxy(mid);
      mproxy.maindone();
      cnt.reductionNo++;
    }
    else {
      HiMsg *hiMsg = new (2, 0) HiMsg;
      hiMsg->data[0] = 22;
      hiMsg->data[1] = 28;
      startTime = CkWallTimer ();  
      mcp.SayHi(hiMsg);
      cnt.reductionNo++;
    }
    delete msg;
  }
Example #4
0
void LBDB::DumpDatabase()
{
#ifdef DEBUG  
  CmiPrintf("Database contains %d object managers\n",omCount);
  CmiPrintf("Database contains %d objects\n",objCount);
#endif
}
Example #5
0
 void displayLBs()
 {
   CmiPrintf("\nAvailable load balancers:\n");
   for (int i=0; i<lbtables.length(); i++) {
     LBDBEntry &entry = lbtables[i];
     if (entry.shown) CmiPrintf("* %s:	%s\n", entry.name, entry.help);
   }
   CmiPrintf("\n");
 }
Example #6
0
int RefinerTemp::multirefine()
{
  computeAverage();
  double avg = averageLoad;
  int maxPe=-1;
 // double max = computeMax();
  double max = computeMax(&maxPe);

  //const double overloadStep = 0.01;
  const double overloadStep = 0.01;
  const double overloadStart = 1.001;
//  double dCurOverload = max / avg;
  double dCurOverload = max /(totalInst*procFreqNew[maxPe]/sumFreqs); 
                                                                               
  int minOverload = 0;
  int maxOverload = (int)((dCurOverload - overloadStart)/overloadStep + 1);
  double dMinOverload = minOverload * overloadStep + overloadStart;
  double dMaxOverload = maxOverload * overloadStep + overloadStart;
  int curOverload;
  int refineDone = 0;
//CmiPrintf("maxPe=%d max=%f myAvg=%f dMinOverload: %f dMaxOverload: %f\n",maxPe,max,(totalInst*procFreqNew[maxPe]/sumFreqs), dMinOverload, dMaxOverload);

  if (_lb_args.debug()>=1)
    CmiPrintf("dMinOverload: %f dMaxOverload: %f\n", dMinOverload, dMaxOverload);
                                                                                
  overLoad = dMinOverload;
  if (refine())
    refineDone = 1;
  else {
    overLoad = dMaxOverload;
    if (!refine()) {
      CmiPrintf("ERROR: Could not refine at max overload\n");
      refineDone = 1;
    }
  }
                                                                                
  // Scan up, until we find a refine that works
  while (!refineDone) {
    if (maxOverload - minOverload <= 1)
      refineDone = 1;
    else {
      curOverload = (maxOverload + minOverload ) / 2;
                                                                                
      overLoad = curOverload * overloadStep + overloadStart;
      if (_lb_args.debug()>=1)
      CmiPrintf("Testing curOverload %d = %f [min,max]= %d, %d\n", curOverload, overLoad, minOverload, maxOverload);
      if (refine())
        maxOverload = curOverload;
      else
        minOverload = curOverload;
    }
  }
  return 1;
}
Example #7
0
CpmInvokable vars_check_cpv_and_csv(vars_chare c)
{
  if (CpvAccess(cpv1) != CmiMyPe()) {
    CmiPrintf("cpv privacy test failed.\n");
    exit(1);
  }
  if (CsvAccess(csv1) != 0x12345678) {
    CmiPrintf("csv sharing test failed.\n");
    exit(1);
  }
  Cpm_vars_ack(CpmSend(0), c);
}
Example #8
0
void CmiPoolPrintList(char *p)
{
  CmiPrintf("Free list is: -----------\n");
  while (p != 0) {
    char ** header = (char **) p-CMI_POOL_HEADER_SIZE;
    CmiPrintf("next ptr is %p. ", p);
    CmiPrintf("header is at: %p, and contains: %p \n", header, *header);
    p = *header;
  }
  CmiPrintf("End of Free list: -----------\n");
 
}
Example #9
0
void OrbLB::quicksort(int x)
{
  int y = (x+1)%3;
  int z = (x+2)%3;
  setVal(x, y, z);
  qsort(x, 0, nObjs-1);

#if 0
  CmiPrintf("result for :%d\n", x);
  for (int i=0; i<nObjs; i++) 
    CmiPrintf("%d ", computeLoad[vArray[x][i].id].tv);
  CmiPrintf("\n");
#endif
}
Example #10
0
static void CpdList_ccs_list_items_set(char *msg)
{
  CpdListItemsRequest req;
  CpdListAccessor *acc=CpdListHeader_ccs_list_items(msg,req);
  if(acc == NULL) CmiPrintf("ccs-builtins> Null Accessor--bad list name (set)\n");
  else {
    PUP_toNetwork_unpack p(req.extra);
    pupCpd(p,acc,req);
    if (p.size()!=req.extraLen)
    	CmiPrintf("Size mismatch during ccs_list_items.set: client sent %d bytes, but %d bytes used!\n",
		req.extraLen,p.size());
  }
  CmiFree(msg);
}
Example #11
0
CmiStartFn mymain(int argc, char** argv)
{
    if(CmiMyRank() == CmiMyNodeSize()) return 0;

    CpvInitialize(int,msgSize);
    CpvInitialize(int,cycleNum);
    CpvInitialize(int,sizeNum);
    CpvAccess(sizeNum) = 1;
    CpvAccess(msgSize)= CmiMsgHeaderSizeBytes + 8;
    
    CpvInitialize(int,exitHandler);
    CpvAccess(exitHandler) = CmiRegisterHandler((CmiHandler) exitHandlerFunc);
    CpvInitialize(int,node0Handler);
    CpvAccess(node0Handler) = CmiRegisterHandler((CmiHandler) node0HandlerFunc);
    CpvInitialize(int,node1Handler);
    CpvAccess(node1Handler) = CmiRegisterHandler((CmiHandler) node1HandlerFunc);
    CpvInitialize(int,ackHandler);
    CpvAccess(ackHandler) = CmiRegisterHandler((CmiHandler) ackHandlerFunc);
    
    CpvInitialize(double,startTime);
    CpvInitialize(double,endTime);
    
    CpvInitialize(double, IdleStartTime);
    CpvInitialize(double, IdleTime);

    CpvInitialize(int,ackCount);
    CpvAccess(ackCount) = 0;

    CpvInitialize(int,twoway);
    CpvAccess(twoway) = 0;

    CcdCallOnConditionKeep(CcdPROCESSOR_BEGIN_IDLE, ApplIdleStart, NULL);
    CcdCallOnConditionKeep(CcdPROCESSOR_END_IDLE, ApplIdleEnd, NULL);
    
    if(argc > 1)
        CpvAccess(twoway) = atoi(argv[1]);

    if(CmiMyPe() == 0) {
      if(!CpvAccess(twoway))
        CmiPrintf("Starting Pingpong with oneway traffic \n");
      else
        CmiPrintf("Starting Pingpong with twoway traffic\n");
    }

    if ((CmiMyPe() < CmiNumPes()/2) || CpvAccess(twoway))
      startPingpong();

    return 0;
}
Example #12
0
//  void cb_client(CkSectionInfo sid, void *param, int dataSize, void *data)
  void cb_client(CkReductionMsg *msg)
  {
    int dataSize = msg->getSize();
    void *data = msg->getData();
    CmiPrintf("RESULT [%d]: %d\n", cnt.reductionNo, *(int *)data); 

    // check correctness
    int result;
    int redno = msg->getRedNo();
    if (redno%3 == 0) {
      result = 0;
      for (int i=0; i<sectionSize; i++) result+=i;
    }
    else if (redno%3 == 2) {
      result = 1;
      for (int i=1; i<sectionSize+1; i++) result*=i;
    }
    else {
      result = sectionSize+1;
    }
    if (*(int *)data != result) {
      CmiPrintf("Expected: %d acual:%d\n", result, *(int *)data);
      CmiAbort("reduction result is wrong!");
    }
  
    cnt.reductionsRemaining--;
    if (cnt.reductionsRemaining<=0) {
      CProxy_main mproxy(mid);
      mproxy.maindone();
      cnt.reductionNo++;
    }
    else {
#if 0
      CkMulticastMgr *mg = CProxy_CkMulticastMgr(mCastGrpId).ckLocalBranch();
      if (cnt->reductionNo % 32 == 0)
        mg->rebuild(mcp.ckGetSectionInfo());
#endif
  
      if (cnt.reductionNo%3 == 0) {
        HiMsg *hiMsg = new (2, 0) HiMsg;
        //hiMsg->data[0] = 18+cnt.reductionNo;
        hiMsg->data[0] = 22;
        hiMsg->data[1] = 28;
        mcp.SayHi(hiMsg);
      }
      cnt.reductionNo++;
    }
    delete msg;
  }
Example #13
0
void OrbLB::setVal(int x, int y, int z)
{
  int i;
  for (i=0; i<nObjs; i++) {
    computeLoad[i].tv = 1000000.0*computeLoad[i].v[x]+
			1000.0*computeLoad[i].v[y]+
			computeLoad[i].v[z];
  }
#if 0
  CmiPrintf("original:%d\n", x);
  for (i=0; i<numComputes; i++) 
    CmiPrintf("%d ", computeLoad[i].tv);
  CmiPrintf("\n");
#endif
}
Example #14
0
void LBSimulation::PrintDifferences(LBSimulation *realSim, BaseLB::LDStats *stats)
{
  LBRealType *peLoads = lbinfo.peLoads;
  LBRealType *realPeLoads = realSim->lbinfo.peLoads;

  // the number of procs during the simulation and the real execution must be checked by the caller!
  int i;
  // here to print the differences between the predicted (this) and the real (real)
  CmiPrintf("Differences between predicted and real balance:\n");
  CmiPrintf("PE   (Predicted Load) (Real Predicted)  (Difference)  (Real CPU)  (Prediction Error)\n");
  for(i = 0; i < numPes; ++i) {
    CmiPrintf("%-4d %13f %16f %15f %12f %14f\n", i, peLoads[i], realPeLoads[i], peLoads[i]-realPeLoads[i],
	      stats->procs[i].total_walltime-stats->procs[i].idletime, realPeLoads[i]-(stats->procs[i].total_walltime-stats->procs[i].idletime));
  }
}
Example #15
0
//! turn trace on/off, note that charm will automatically call traceBegin()
//! at the beginning of every run unless the command line option "+traceoff"
//! is specified
void TraceCounter::traceEnd() {
  DEBUGF(("%d/%d traceEnd called\n", CmiMyPe(), CmiNumPes()));
  if (!traceOn_) { 
    static bool print = true;
    if (print) {
      print = false;
      if (CmiMyPe()==0) {
	CmiPrintf("%d/%d WARN: traceEnd called but trace not on!\n"
		  "            Sure you didn't mean to use +traceoff?\n",
		  CmiMyPe(), CmiNumPes());
      }
    }
  }
  else {
    traceOn_ = false;
    dirty_ = false;
    if (overview_) { endOverview(); }  // overview switches counters automatic
    else if (switchByPhase_) { switchCounters(); };

    if (!noLog_ && writeByPhase_) {
      if (CmiMyPe()==0) { CpvAccess(_logPool)->writeSts(phase_); }
      CpvAccess(_logPool)->write(phase_); 
    }
    reductionPhase_++;
    CpvAccess(_logPool)->doReduction(reductionPhase_, idleTime_); 
    if (writeByPhase_) {
      idleTime_ = 0.0;
      CpvAccess(_logPool)->clearEps(); 
    }
    // setTrace must go after the writes otherwise the writes won't go through
    DEBUGF(("%d/%d DEBUG: Created _logPool at %08x\n", 
	    CmiMyPe(), CmiNumPes(), CpvAccess(_logPool)));
  }
}
Example #16
0
//! print out usage argument
void TraceCounter::usage() {
  CmiPrintf(
    "ERROR: You've linked with '-tracemode counter', so you must specify\n"
    "       the +counters <counters> option followed by any of the \n"
    "       following optional command line options.\n"
    "\n"
    "REQUIRED: +counters <counter>\n"
    "\n"
    "  +counters <counters>: Where <counters> is comma delimited list\n"
    "                        of valid counters.  Type '+count-help' to\n"
    "                        get a list of valid counters.\n"
    "\n"
    "OPTIONAL: [+count-overview] [+count-switchrandom] [+switchbyphase]\n"
    "\n"
    "  +count-overview:      Collect counter values between start/stop\n"
    "                        of the program (or traceBegin/traceEnd if\n"
    "                        user marked events are on [see Performance\n"
    "                        Counter section of the Charm++ manual]).\n"
    "                        Normal operation collects counter values\n"
    "                        between the stop/start of Charm++ entry\n"
    "                        points.\n"
    "  +count-switchrandom:  Counters will switch randomly between\n"
    "                        each event instead of in the order\n"
    "                        specified by the <counters> arg.\n"
    "  +count-switchbyphase: Counters will switch not every EP call,\n"
    "                        but only in between phases (between each\n"
    "                        traceBegin/traceEnd call).\n"
    "  +count-nolog:         Don't write any log files.\n"
    "\n"
    "See the Performance Counter section of the Charm++ manual for\n"
    "examples of different options.\n"
    "\n");
}
Example #17
0
//! add the argument parameters to the linked list of args choices
void TraceCounter::registerArg(CounterArg* arg)
{
  if (firstArg_ == NULL) {
    firstArg_ = lastArg_ = arg;
    argStrSize_ = strlen(arg->arg);
  }
  else { 
    // check to see if any redundancy 
    CounterArg* check = firstArg_;
    while (check != NULL) {
      if (strcmp(check->arg, arg->arg)==0 || check->code == arg->code) {
	if (CmiMyPe()==0) { 
	  CmiPrintf("Two args with same name %s or code %d\n", 
		    arg->arg, arg->code); 
	}
	CmiAbort("TraceCounter::registerArg()\n");
      }
      check = check->next;
    }

    lastArg_->next = arg;
    lastArg_ = arg;
    int len = strlen(arg->arg);
    if (len > argStrSize_) { argStrSize_ = len; }
  }
}
Example #18
0
main::main(CkArgMsg *msg)
{
  CmiPrintf("Megatest is running on %d nodes %d processors. \n", CkNumNodes(), CkNumPes());
  int argc = msg->argc;
  char **argv = msg->argv;
  int numtests, i;
  delete msg;
  mainhandle = thishandle;
  if (nTests<=0)
    CkAbort("Megatest: No tests registered-- is MEGATEST_REGISTER_TEST malfunctioning?");
  for (i=0; i<nTests; i++)
    (tests[i].initializer)();
  test_bank_size = nTests;
  next_test_index = 0;
  next_test_number = 0;
  test_negate_skip=0;
  test_repeat = 0;
  for (i=1; i<argc; i++) {
    if (strcmp(argv[i],"-only")==0)
      test_negate_skip = 1;
    if (strcmp(argv[i],"-repeat")==0)
      test_repeat = 1;
  }
  num_tests_to_skip = argc;
  tests_to_skip = argv;
  CProxy_main(thishandle).start();
}
Example #19
0
static void *meta_valloc(size_t size)
{
  void *ret=mm_valloc(size);
  if (memInit) CmiPrintf("CMI_MEMORY(%d)> valloc(%d) => %p\n",
			 CmiMyPe(),size,ret);  
  return ret;
}
Example #20
0
int print_thread_affinity() {
  unsigned long mask;
  size_t len = sizeof(mask);

#if  CMK_HAS_PTHREAD_SETAFFINITY
  int j;
  cpu_set_t cpuset;
  pthread_t thread;
  char str[256], pe[16];

  thread = pthread_self();
  
  if (errno = pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuset)) {
    perror("pthread_getaffinity");
    return -1;
  }

  sprintf(str, "[%d] %s affinity is: ", CmiMyPe(), CmiMyPe()>=CmiNumPes()?"communication pthread":"pthread");
  for (j = 0; j < CPU_SETSIZE; j++)
        if (CPU_ISSET(j, &cpuset)) {
            sprintf(pe, " %d ", j);
            strcat(str, pe);
        }
  CmiPrintf("%s\n", str);
#endif
  return 0;
}
Example #21
0
static void meta_free(void *mem)
{
  if (memInit) CmiPrintf("CMI_MEMORY(%d)> free(%p)\n",
			 CmiMyPe(),mem);
  if (memInit>1) {int memBack=memInit; memInit=0; CmiPrintStackTrace(0); memInit=memBack;}
  mm_free(mem);
}
Example #22
0
static int getNUMANidByRank(int coreid) {
    int i;
    /*int totalCores = CmiNumCores();*/
    int totalNUMANodes = CmiNumNUMANodes();
    /*The core id array is viewed as 2D array but in form of 1D array*/
    /*int *coreids=(int *)malloc(sizeof(int)*totalCores);*/
    /*Assume each NUMA node has the same number of cores*/
    /*int nCoresPerNode = totalCores/totalNUMANodes;*/
    /*CmiAssert(totalCores%totalNUMANodes==0);*/
    char command[256];
    for (i=0; i<totalNUMANodes; i++) {
        FILE *cmd;
        int cpuid;
        sprintf(command, "ls -1d /sys/devices/system/node/node%d/cpu[0-9]* | cut -d'u' -f2", i);
        cmd = popen(command, "r");
        while (1) {
            int ret=fscanf(cmd, "%d\n", &cpuid);
            if (ret==EOF) break;
            if (cpuid == coreid) {
                pclose(cmd);
                /*free(coreids);*/
                return i;
            }
        }
        pclose(cmd);
    }
    /*free(coreids);*/
    CmiPrintf("%d: the corresponding NUMA node for cpu id %d is not found!\n", CmiMyPe(), coreid);
    CmiAssert(0);
    return -1;
}
Example #23
0
void CmiExitPxshm(){
        if (pxshmContext == NULL) return;
	if(pxshmContext->nodesize != 1){
                int i;
		if (!pxshm_freed)
                    tearDownSharedBuffers();
	
		for(i=0;i<pxshmContext->nodesize;i++){
			if(i != pxshmContext->noderank){
				break;
			}
		}
		free(pxshmContext->recvBufNames[i]);
		free(pxshmContext->sendBufNames[i]);

		free(pxshmContext->recvBufNames);
		free(pxshmContext->sendBufNames);

		free(pxshmContext->recvBufs);
		free(pxshmContext->sendBufs);

	}
#if PXSHM_STATS
CmiPrintf("[%d] sendCount %d sendTime %6lf validCheckCount %d validCheckTime %.6lf commServerTime %6lf lockRecvCount %d \n",_Cmi_mynode,pxshmContext->sendCount,pxshmContext->sendTime,pxshmContext->validCheckCount,pxshmContext->validCheckTime,pxshmContext->commServerTime,pxshmContext->lockRecvCount);
#endif
	free(pxshmContext);
        pxshmContext = NULL;
}
Example #24
0
/** At startup on each processor, this method is called. 
    This sets up the converse level comlib strategies.

    This is called before any mainchare main functions.
 */
void initConvComlibManager(){ 

    if(!CkpvInitialized(conv_com_object))
      CkpvInitialize(ConvComlibManager, conv_com_object);
    
    
    if(CkpvAccess(conv_com_object).getInitialized()) {
      CmiPrintf("Comlib initialized more than once!\n");
      return;
    }
    
    CkpvInitialize(int, RecvdummyHandle);
    CkpvAccess(RecvdummyHandle) = CkRegisterHandler((CmiHandler)recv_dummy);

    CkpvInitialize(int, comlib_receive_table);
    CkpvAccess(comlib_receive_table) = CkRegisterHandler((CmiHandler)comlibReceiveTableHandler);
    CkpvInitialize(int, comlib_table_received);
    CkpvAccess(comlib_table_received) = CkRegisterHandler((CmiHandler)comlibTableReceivedHandler);
    CkpvInitialize(int, comlib_ready);
    CkpvAccess(comlib_ready) = CkRegisterHandler((CmiHandler)comlibReadyHandler);

    // init strategy specific variables

    // router strategy
    CkpvInitialize(int, RouterRecvHandle);
    CkpvAccess(RouterRecvHandle) = CkRegisterHandler((CmiHandler)routerRecvManyCombinedMsg);
    CkpvInitialize(int, RouterProcHandle);
    CkpvAccess(RouterProcHandle) = CkRegisterHandler((CmiHandler)routerProcManyCombinedMsg);
    CkpvInitialize(int, RouterDummyHandle);
    CkpvAccess(RouterDummyHandle) = CkRegisterHandler((CmiHandler)routerDummyMsg);    

    // streaming strategy
    CpvInitialize(int, streaming_handler_id);
    CpvAccess(streaming_handler_id) = CmiRegisterHandler(StreamingHandlerFn);

    // mesh streaming strategy
    CkpvInitialize(int, streaming_column_handler_id);
    CkpvAccess(streaming_column_handler_id) = CkRegisterHandler(streaming_column_handler);

    // pipelined broadcast
    CkpvInitialize(int, pipeline_handler);
    CkpvInitialize(int, pipeline_frag_handler);
    CkpvAccess(pipeline_handler) = CkRegisterHandler((CmiHandler)PipelineHandler);
    CkpvAccess(pipeline_frag_handler) = CkRegisterHandler((CmiHandler)PipelineFragmentHandler);
    
    // general handler
    CkpvInitialize(int, comlib_handler);
    CkpvAccess(comlib_handler) = CkRegisterHandler((CmiHandler) strategyHandler);

    //PUPable_reg(Strategy); ABSTRACT
    //PUPable_reg(ConvComlibInstanceHandle);
    if (CmiMyRank() == 0) {
   	  PUPable_reg(RouterStrategy);
      PUPable_reg(StreamingStrategy);
      PUPable_reg(MeshStreamingStrategy);
      PUPable_reg(PipeBroadcastConverse);
      PUPable_reg(MessageHolder);
    }
    CkpvAccess(conv_com_object).setInitialized();
}
Example #25
0
void CqsRemoveSpecific(Queue q, const void *msgPtr) {
    if( CqsRemoveSpecificPrioq(&(q->negprioq), msgPtr) == 0 )
        if( CqsRemoveSpecificDeq(&(q->zeroprio), msgPtr) == 0 )
            if(CqsRemoveSpecificPrioq(&(q->posprioq), msgPtr) == 0) {
                CmiPrintf("Didn't remove the specified entry because it was not found\n");
            }
}
Example #26
0
void TraceCounter::endOverview()
{
  DEBUGF(("%d/%d DEBUG:   endOverview\n", CmiMyPe(), CmiNumPes()));
 
  double t = TraceTimer();
  int _numEntries=_entryTable.size();

  long long value1 = 0, value2 = 0;
  int genRead;
  if ((genRead=read_counters(counter1_->code, &value1, counter2_->code, &value2)) < 0 ||
      genRead != genStart_)
  {
    CmiPrintf("genRead %d genStart_ %d counter1 %ld counter2 %ld\n",
	      genRead, genStart_, value1, value2);
    traceClose();
    CmiAbort("ERROR: read_counters() in endOverview\n");
  }

  DEBUGF((
    "%d/%d DEBUG:   endOverview genRead %d Time %f counter1 %ld counter2 %ld\n", 
    CmiMyPe(), CmiNumPes(), genRead, t-startEP_, value1, value2));
  dirty_ = false;

  CpvAccess(_logPool)->setEp(_numEntries, 
			     counter1_->index, value1, 
			     counter2_->index, value2, 
			     t-startEP_); 
  DEBUGF((
    "%d/%d OVERVIEW phase%d Time(us) %f %s %ld %s %ld Idle(us) %f"
    " (overflow? MAX=%ld)\n",
    CmiMyPe(), CmiNumPes(), phase_, (t-startEP_)*1e6, counter1_->arg, value1, 
    counter2_->arg, value2, idleTime_*1e6, MAXLONGLONG));
  // this is phase boundary anyway, so switch counters
  switchCounters(); 
}
Example #27
0
static void *meta_realloc(void *mem, size_t size)
{
  void *ret=mm_realloc(mem,size);
  if (memInit) CmiPrintf("CMI_MEMORY(%d)> realloc(%p,%d) => %p\n",
			 CmiMyPe(),mem,size,ret);
  return ret;
}
Example #28
0
// mainchare
LBDBInit::LBDBInit(CkArgMsg *m)
{
#if CMK_LBDB_ON
  _lbdb = CProxy_LBDatabase::ckNew();

  // runtime specified load balancer
  if (lbRegistry.runtime_lbs.size() > 0) {
    for (int i=0; i<lbRegistry.runtime_lbs.size(); i++) {
      const char *balancer = lbRegistry.runtime_lbs[i];
      createLoadBalancer(balancer);
    }
  }
  else if (lbRegistry.compile_lbs.size() > 0) {
    for (int i=0; i<lbRegistry.compile_lbs.size(); i++) {
      const char* balancer = lbRegistry.compile_lbs[i];
      createLoadBalancer(balancer);
    }
  }
  else {
    // NullLB is the default when none of above lb created
    // note user may create his own load balancer in his code manually like
    // in NAMD, but never mind NullLB can disable itself if there is 
    // a non NULL LB.
    createLoadBalancer("NullLB");
  }

  // simulation mode
  if (LBSimulation::doSimulation) {
    CmiPrintf("Charm++> Entering Load Balancer Simulation Mode ... \n");
    CProxy_LBDatabase(_lbdb).ckLocalBranch()->StartLB();
  }
#endif
  delete m;
}
Example #29
0
//Startup routine-- must be called on processor 0
void liveViz0Init(const liveVizConfig &cfg) {
  config=cfg;
  CcsRegisterHandler("lvConfig",(CmiHandler)getImageConfigHandler);
  CcsRegisterHandler("lvImage", (CmiHandler)getImageHandler);
  if (config.getVerbose(1))
    CmiPrintf("CCS getImage handlers registered.  Waiting for clients...\n");
}
Example #30
0
static void *meta_memalign(size_t align, size_t size)
{
  void *ret=mm_memalign(align,size);
  if (memInit) CmiPrintf("CMI_MEMORY(%d)> memalign(%p,%d) => %p\n",
			 CmiMyPe(),align,size,ret);
  return ret;
}