Exemplo n.º 1
0
void waitqd_QDChare::onQD(CkQdMsg *ckqm) {
  CthThread pthr;
  while(!CdsFifo_Empty((CdsFifo) threadList)) {
    pthr = (CthThread)CdsFifo_Dequeue((CdsFifo) threadList);
    CthAwaken(pthr);
  }
  CdsFifo_Destroy((CdsFifo) threadList);
  threadList = 0;
  waitStarted = 0;
  delete ckqm;
}
Exemplo n.º 2
0
void MSA_Thread_Listener::signal(unsigned int pageNo)
{
	count--;
	if (count<0) CkAbort("MSA_Thread_Listener signaled more times than added!");
	if (count==0) { /* now ready to resume thread (if needed) */
		if (thread!=0) {
			CthAwaken(thread);
			thread=0;
		}
	}
}
Exemplo n.º 3
0
CpmInvokable vars_control()
{
  struct vars_chare c; CthThread t1,t2;

  t1 = CthCreate(vars_check_ctv_privacy, (void *)&c, 0);
  t2 = CthCreate(vars_check_ctv_privacy, (void *)&c, 0);
  CthSetStrategyDefault(t1);
  CthSetStrategyDefault(t2);

  CthAwaken(t1); CthAwaken(t2);
  c.countdown = 2; c.pending = CthSelf(); CthSuspend();
  
  CthAwaken(t1); CthAwaken(t2);
  c.countdown = 2; c.pending = CthSelf(); CthSuspend();
  
  Cpm_vars_set_cpv_and_csv(CpmSend(CpmALL), &c);
  c.countdown = CmiNumPes(); c.pending = CthSelf(); CthSuspend();
  
  Cpm_vars_check_cpv_and_csv(CpmSend(CpmALL), &c);
  c.countdown = CmiNumPes(); c.pending = CthSelf(); CthSuspend();
  
  Cpm_megacon_ack(CpmSend(0));
}
Exemplo n.º 4
0
void workThreadInfo::addAffMessage(char *msgPtr)
{
  ckMsgQueue &que = myNode->affinityQ[id];
  que.enq(msgPtr);
  if (schedule_flag) {
  /* don't awake directly, put into a priority queue sorted by recv time */
  double nextT = CmiBgMsgRecvTime(msgPtr);
  CthThread tid = me;
  unsigned int prio = (unsigned int)(nextT*PRIO_FACTOR)+1;
  DEBUGF(("[%d] awaken worker thread with prio %d.\n", tMYNODEID, prio));
  CthAwakenPrio(tid, CQS_QUEUEING_IFIFO, sizeof(int), &prio);
  }
  else {
  if (que.length() == 1) {
#if BIGSIM_OUT_OF_CORE && BIGSIM_OOC_PREFETCH
      //thread scheduling point!!
      if(bgUseOutOfCore) schedWorkThds->push(this);
#endif
    CthAwaken(me);
  }
  }
}
Exemplo n.º 5
0
// common code for submission and delivery
void ReductionMgr::mergeAndDeliver(ReductionSet *set, int seqNum) {

//iout << "seq " << seqNum << " complete on " << CkMyPe() << "\n" << endi;
 
    set->nextSequenceNumber++; // should match all clients

    ReductionSetData *data = set->getData(seqNum);
    if ( data->submitsRecorded != set->submitsRegistered ) {
      NAMD_bug("ReductionMgr::mergeAndDeliver not ready to deliver.");
    }

    if ( isRoot() ) {
      if ( set->requireRegistered ) {
	if ( set->threadIsWaiting && set->waitingForSequenceNumber == seqNum) {
	  // awaken the thread so it can take the data
	  CthAwaken(set->waitingThread);
	}
      } else {
	NAMD_die("ReductionSet::deliver will never deliver data");
      }
    } else {
      // send data to parent
      int size = set->dataSize;
      ReductionSubmitMsg *msg = new(&size,1) ReductionSubmitMsg;
      msg->reductionSetID = set->reductionSetID;
      msg->sourceNode = CkMyPe();
      msg->sequenceNumber = seqNum;
      msg->dataSize = set->dataSize;
      for ( int i = 0; i < msg->dataSize; ++i ) {
        msg->data[i] = data->data[i];
      }
      CProxy_ReductionMgr reductionProxy(thisgroup);
      reductionProxy[myParent].remoteSubmit(msg);
      delete set->removeData(seqNum);
    }

}
Exemplo n.º 6
0
CpmInvokable vars_ack(vars_chare c)
{
  c->countdown--;
  if ((c->countdown==0)&&(c->pending))
    CthAwaken(c->pending);
}
Exemplo n.º 7
0
 void barrierH() {
   CthAwaken(t);
 }