Пример #1
0
void StreamingStrategy::pup(PUP::er &p){

  Strategy::pup(p);
  p | PERIOD;
  p | bufferMax;
  p | msgSizeMax;
  //p | shortMsgPackingFlag;
  p | bufSizeMax;
  p | idleFlush;
  //p | streaming_handler_id;

  if(p.isPacking() || p.isUnpacking()) {
      streamingMsgBuf = new CkQ<MessageHolder *>[CmiNumPes()];
      streamingMsgCount = new int[CmiNumPes()];
      bufSize = new int[CmiNumPes()];
      for(int count = 0; count < CmiNumPes(); count ++) {
	streamingMsgCount[count] = 0;
	bufSize[count] = 0;
      }
  }

  // packing is done once in processor 0, unpacking is done once in all processors except 0
  if (p.isPacking() || p.isUnpacking()) registerFlush();
}
Пример #2
0
void CentralLB::pup(PUP::er &p) { 
  BaseLB::pup(p); 
  if (p.isUnpacking())  {
    initLB(CkLBOptions(seqno)); 
  }
  p|reduction_started;
  int has_statsMsg=0;
  if (p.isPacking()) has_statsMsg = (statsMsg!=NULL);
  p|has_statsMsg;
  if (has_statsMsg) {
    if (p.isUnpacking())
      statsMsg = new CLBStatsMsg;
    statsMsg->pup(p);
  }
#if (defined(_FAULT_MLOG_) || defined(_FAULT_CAUSAL_))
  p | lbDecisionCount;
  p | resumeCount;
#endif
	
}
Пример #3
0
void PipeBroadcastStrategy::pup(PUP::er &p){
  ComlibPrintf("[%d] PipeBroadcastStrategy::pup %s\n",CkMyPe(), (p.isPacking()==0)?(p.isUnpacking()?"UnPacking":"sizer"):("Packing"));
  PipeBroadcastConverse::pup(p);
  CharmStrategy::pup(p);

  /*
  if (p.isUnpacking()) {
    converseStrategy = new PipeBroadcastConverse(0,0,this);
  }
  p | *converseStrategy;

  if (p.isUnpacking()) {
    //propagateHandle = CmiRegisterHandler((CmiHandler)propagate_handler);

    ComlibPrintf("[%d] registered handler single to %d\n",CmiMyPe(),CsvAccess(pipeBcastPropagateHandle));
    messageBuf = new CkQ<CharmMessageHolder *>;
    converseStrategy->setHigherLevel(this);
  }
  */
}
Пример #4
0
void PipeBroadcastConverse::pup(PUP::er &p){
  Strategy::pup(p);
  ComlibPrintf("[%d] initial of PipeBroadcastConverse::pup %s\n",CkMyPe(),(p.isPacking()==0)?(p.isUnpacking()?"UnPacking":"sizer"):("Packing"));

  p | pipeSize;
  p | topology;
  p | seqNumber;

  //ComlibPrintf("[%d] PipeBroadcast converse pupping %s, size=%d, topology=%d\n",CkMyPe(), (p.isPacking()==0)?(p.isUnpacking()?"UnPacking":"sizer"):("Packing"),pipeSize,topology);

  /*
  if (p.isUnpacking()) {
    //log_of_2_inv = 1/log((double)2);
    messageBuf = new CkQ<MessageHolder *>;
    //propagateHandle_frag = CmiRegisterHandler((CmiHandler)propagate_handler_frag);
    ComlibPrintf("[%d] registered handler fragmented to %d\n",CkMyPe(),CsvAccess(pipeBcastPropagateHandle_frag));
  }
  if (p.isPacking()) {
    delete messageBuf;
  }
  //p|(*messageBuf);
  //p|fragments;
  */
}
Пример #5
0
/**************************************************************************
** This is a very complicated pack/unpack method.
**
** This method must handle the column_bucket[] and row_bucket[] data
** structures.  These are arrays of queues of (char *).  To pack these,
** we must iterate through the data structures and pack the sizes of
** each message (char *) pointed to by each queue entry.
*/
void MeshStreamingStrategy::pup (PUP::er &p)
{

  ComlibPrintf ("[%d] MeshStreamingStrategy::pup() invoked.\n", CkMyPe());

  // Call the superclass method -- easy.
  Strategy::pup (p);

  // Pup the instance variables -- easy.
  p | num_pe;
  p | num_columns;
  p | num_rows;
  p | row_length;

  //p | my_pe;
  //p | my_column;
  //p | my_row;

  p | max_bucket_size;
  p | flush_period;
  //p | strategy_id;
  //p | column_handler_id;

  //p | shortMsgPackingFlag;

  // Handle the column_bucket[] data structure.
  // For each element in column_bucket[], pup the length of the queue
  // at that element followed by the contents of that queue.  For each
  // queue, pup the size of the message pointed to by the (char *)
  // entry, followed by the memory for the (char *) entry.
  if (p.isUnpacking ()) {
      column_bucket = new CkQ<char *>[num_columns];
      column_destQ = new CkQ<int>[num_columns];
  }

  /*In correct code, will only be useful for checkpointing though
  for (i = 0; i < num_columns; i++) {
    int length = column_bucket[i].length ();

    p | length;

    for (int j = 0; j < length; j++) {
        char *msg = column_bucket[i].deq ();
        int size = sizeof (int) + ((int *) msg)[1];
        p | size;
        p(msg, size);
    }
  }
  */

  // Handle the column_bytes[] data structure.
  // This is a straightforward packing of an int array.
  if (p.isUnpacking ()) {
      column_bytes = new int[num_columns];
  }

  p(column_bytes, num_columns);

  // Handle the row_bucket[] data structure.
  // This works exactly like the column_bucket[] above.
  if (p.isUnpacking ()) {
    row_bucket = new CkQ<char *>[num_rows];
  }
  
  /* In correct code, will only be useful for checkpointing though
  for (i = 0; i < num_rows; i++) {
    int length = row_bucket[i].length ();

    p | length;

    for (int j = 0; j < length; j++) {
      char *msg = row_bucket[i].deq ();
      int size = ((int *) msg)[0];
      p | size;
      p(msg, size);
    }
  }
  */

    my_pe = CkMyPe ();

    my_column = my_pe % num_columns;
    my_row = my_pe / row_length;
    
    //column_bucket = new CkQ<char *>[num_columns];
    //column_bytes = new int[num_columns];
    
    for (int i = 0; i < num_columns; i++) {
        column_bytes[i] = 0;
    }
    
    // packing called once on processor 0, unpacking called once on all processors except 0
    if (p.isPacking() || p.isUnpacking()) {
      //column_handler_id = CkRegisterHandler ((CmiHandler) column_handler);
    
      CcdCallOnConditionKeepOnPE(CcdPROCESSOR_BEGIN_IDLE, idle_flush_handler,
				 (void *) this, CkMyPe());
      RegisterPeriodicFlush ();
    }
}
Пример #6
0
//==============================================================================
//cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
//==============================================================================
void GStateSlab::pup(PUP::er &p) {
  //==============================================================================
  // Dont have to pup fftw plans - they live in the fft cache group

  //  CkPrintf("gs pup\n:");
  p|cp_min_opt;
  p|ees_nonlocal;
  p|numNonZeroPlanes;
  p|numRuns;
  p|numLines;
  p|numPoints;
  p|numFull;
  p|mysizeX; 
  p|planeSize;
  p|fftReqd;
  p|S_grainSize;
  p|xdim;
  p|ydim;
  p|zdim;
  p|ngridaNL;
  p|ngridbNL;
  p|ngridcNL;
  p|iplane_ind;
  p|istate_ind;
  p|ihave_kx0;
  p|ihave_g000;
  p|ind_g000;
  p|kx0_strt;
  p|kx0_end;
  p|nkx0; p|nkx0_uni; p|nkx0_red; p|nkx0_zero;
  p|eke_ret;
  p|fictEke_ret;
  p|ekeNhc_ret;
  p|potNHC_ret;
  p|degfree;
  p|degfreeNHC;

  if (p.isUnpacking()) {
    packedPlaneData     = (complex *)fftw_malloc(numPoints*sizeof(complex));
    packedForceData     = (complex *)fftw_malloc(numFull*sizeof(complex));
    packedVelData       = (complex *)fftw_malloc(numPoints*sizeof(complex));
    packedRedPsi        = (complex *)fftw_malloc(nkx0*sizeof(complex));
    if(cp_min_opt==0){
      packedPlaneDataScr  = (complex *)fftw_malloc(numPoints*sizeof(complex));
    }//endif
#ifdef  _CP_DEBUG_UPDATE_OFF_
    if(cp_min_opt==1){
      packedPlaneDataTemp = (complex *)fftw_malloc(numPoints*sizeof(complex));
    }//endif
#endif
  }//endif
  p((char *) packedPlaneData, numPoints*sizeof(complex));
  p((char *) packedForceData, numFull*sizeof(complex));
  p((char *) packedVelData, numPoints*sizeof(complex));   //cg under min
  p((char *) packedRedPsi, nkx0*sizeof(complex));
  if(cp_min_opt==0){
    p((char *) packedPlaneDataScr, numPoints*sizeof(complex));
  }//endif
#ifdef  _CP_DEBUG_UPDATE_OFF_
  if(cp_min_opt==1){
    p((char *) packedPlaneDataTemp, numPoints*sizeof(complex));
  }//endif
#endif

  p|nck_nhc_cp;
  p|len_nhc_cp;
  p|num_nhc_cp;
  p|kTCP;
  p|tauNHCCP;
  if (p.isUnpacking()) {
    initNHC(len_nhc_cp,num_nhc_cp,nck_nhc_cp);
  }//endif recving
  int nsize   = num_nhc_cp*len_nhc_cp*nck_nhc_cp;
  double *xt  = new double[nsize];
  double *xtp = new double[nsize];
  double *vt  = new double[nsize];
  double *ft  = new double[nsize];
  if(p.isPacking()){
    int iii=0;
    for(int k =0;k<num_nhc_cp;k++){
      for(int i =0;i<num_nhc_cp;i++){
        for(int j =0;j<len_nhc_cp;j++){
          xt[iii]  = xNHC[k][i][j];
          xtp[iii] = xNHCP[k][i][j];
          vt[iii]  = vNHC[k][i][j];
          ft[iii]  = fNHC[k][i][j];
          iii++;
        }}}
  }//endif sending
  p(xt,nsize);
  p(xtp,nsize);
  p(vt,nsize);
  p(ft,nsize);
  p(degFreeSplt,nck_nhc_cp);
  p(istrNHC,nck_nhc_cp);
  p(iendNHC,nck_nhc_cp);
  p(mNHC,len_nhc_cp);
  p(v0NHC,num_nhc_cp);
  p(a2NHC,num_nhc_cp);
  p(a4NHC,num_nhc_cp);
  if (p.isUnpacking()) {
    int iii=0;
    for(int k =0;k<nck_nhc_cp;k++){
      for(int i =0;i<num_nhc_cp;i++){
        for(int j =0;j<len_nhc_cp;j++){
          xNHC[k][i][j]  = xt[iii];
          xNHCP[k][i][j] = xtp[iii];
          vNHC[k][i][j]  = vt[iii];
          fNHC[k][i][j]  = ft[iii];
          iii++;
        }}}
  }//endif receiving 
  delete []xt;
  delete []xtp;
  delete []vt;
  delete []ft;

  //==============================================================================
}//end routine