Example #1
0
void CP_Rho_GSpacePlane::divRhoVksGspace() {

  double tpi,*hmati;

  CPXCFNCTS::CP_fetch_hmati(&hmati,&tpi);

  memset(divRhoY, 0, sizeof(complex) * myGrid_size);
  memset(divRhoZ, 0, sizeof(complex) * myGrid_size);
  double gx,gy,gz;

  std::vector< gridPoint > & points = (*myPoints);
  double sumX = 0, sumY = 0, sumZ = 0;
  for(int p = 0; p < numPoints; p++) {
    int offset = points[p].offset;
    gx = tpi * (points[p].d3 * hmati[1] + points[p].d2 * hmati[2] +
        points[p].d1 * hmati[3]);
    gy = tpi * (points[p].d3 * hmati[4] + points[p].d2 * hmati[5] +
        points[p].d1 * hmati[6]);
    gz = tpi * (points[p].d3 * hmati[7] + points[p].d2 * hmati[8] +
        points[p].d1 * hmati[9]);
    complex tmp = (divRhoX[offset].multiplyByi())*(-1.0);
    divRhoX[offset] = tmp * gx;
    divRhoY[offset] = tmp * gy;
    divRhoZ[offset] = tmp * gz;
#if _CP_DEBUG_RHOG_VERBOSE_
    sumX += divRhoX[offset].re + divRhoX[offset].im;
    sumY += divRhoY[offset].re + divRhoY[offset].im;
    sumZ += divRhoZ[offset].re + divRhoZ[offset].im;
#endif
  }//endfor

#if _CP_DEBUG_RHOG_VERBOSE_
  CkPrintf("{%d} Rho GS [%d] divSums %lf %lf %lf\n", thisInstance.proxyOffset, thisIndex,
    sumX, sumY, sumZ);
#endif

  Charm_doBackwardFFT(CkCallback(CkIndex_CP_Rho_RealSpacePlane::acceptGradRhoVks(),
        UrhoRealProxy[thisInstance.proxyOffset]),
        Urho_fft_xProxy[thisInstance.proxyOffset], fft_xoffset,
        1 / simReadOnly.vol);
  Charm_doBackwardFFT(CkCallback(CkIndex_CP_Rho_RealSpacePlane::acceptGradRhoVks(),
        UrhoRealProxy[thisInstance.proxyOffset]),
        Urho_fft_yProxy[thisInstance.proxyOffset], fft_yoffset,
        1 / simReadOnly.vol);
  Charm_doBackwardFFT(CkCallback(CkIndex_CP_Rho_RealSpacePlane::acceptGradRhoVks(),
        UrhoRealProxy[thisInstance.proxyOffset]),
        Urho_fft_zProxy[thisInstance.proxyOffset], fft_zoffset,
        1 / simReadOnly.vol);

  //---------------------------------------------------------------------------
}//end routine
Example #2
0
static inline void _printStats(void)
{
  DEBUGF(("[%d] _printStats\n", CkMyPe()));
  int i;
  if(_printSS || _printCS) {
    Stats *total = new Stats();
    _MEMCHECK(total);
    for(i=0;i<CkNumPes();i++)
      total->combine(_allStats[i]);
    CkPrintf("Charm Kernel Summary Statistics:\n");
    for(i=0;i<CkNumPes();i++) {
      CkPrintf("Proc %d: [%d created, %d processed]\n", i,
               _allStats[i]->getCharesCreated(),
               _allStats[i]->getCharesProcessed());
    }
    CkPrintf("Total Chares: [%d created, %d processed]\n",
             total->getCharesCreated(), total->getCharesProcessed());
  }
  if(_printCS) {
    CkPrintf("Charm Kernel Detailed Statistics (R=requested P=processed):\n\n");

    CkPrintf("         Create    Mesgs     Create    Mesgs     Create    Mesgs\n");
    CkPrintf("         Chare     for       Group     for       Nodegroup for\n");
    CkPrintf("PE   R/P Mesgs     Chares    Mesgs     Groups    Mesgs     Nodegroups\n");
    CkPrintf("---- --- --------- --------- --------- --------- --------- ----------\n");

    for(i=0;i<CkNumPes();i++) {
      CkPrintf("%4d  R  %9d %9d %9d %9d %9d %9d\n      P  %9d %9d %9d %9d %9d %9d\n",i,
               _allStats[i]->getCharesCreated(),
               _allStats[i]->getForCharesCreated(),
               _allStats[i]->getGroupsCreated(),
               _allStats[i]->getGroupMsgsCreated(),
               _allStats[i]->getNodeGroupsCreated(),
               _allStats[i]->getNodeGroupMsgsCreated(),
               _allStats[i]->getCharesProcessed(),
               _allStats[i]->getForCharesProcessed(),
               _allStats[i]->getGroupsProcessed(),
               _allStats[i]->getGroupMsgsProcessed(),
               _allStats[i]->getNodeGroupsProcessed(),
	       _allStats[i]->getNodeGroupMsgsProcessed());
    }
  }
}
Example #3
0
/** Extract elements adjacent to edge [n1,n2] along with element-local node
    numberings and nodes opposite input edge **/
int FEM_Adapt::findAdjData(int n1, int n2, int *e1, int *e2, int *e1n1, 
			    int *e1n2, int *e1n3, int *e2n1, int *e2n2, 
			    int *e2n3, int *n3, int *n4)
{
  // Set some default values in case e1 is not there
  (*e1n1) = (*e1n2) = (*e1n3) = (*n3) = -1;

  //if n1,n2 is not an edge return 
  if(n1<0 || n2<0) return -1;
  if(theMesh->node.is_valid(n1)==0 || theMesh->node.is_valid(n2)==0) return -1;
  if(theMesh->n2n_exists(n1,n2)!=1 || theMesh->n2n_exists(n2,n1)!=1) return -1; 

  (*e1) = theMesh->getElementOnEdge(n1, n2); // assumed to return local element
  if ((*e1) == -1) {
    CkPrintf("[%d]Warning: No Element on edge %d->%d\n",theMod->idx,n1,n2);
    return -1;
  }
  (*e1n1) = find_local_node_index((*e1), n1);
  (*e1n2) = find_local_node_index((*e1), n2);
  (*e1n3) = 3 - (*e1n1) - (*e1n2);
  (*n3) = theMesh->e2n_getNode((*e1), (*e1n3));
  (*e2) = theMesh->e2e_getNbr((*e1), get_edge_index((*e1n1), (*e1n2)));
  // Set some default values in case e2 is not there
  (*e2n1) = (*e2n2) = (*e2n3) = (*n4) = -1;
  if ((*e2) != -1) { // e2 exists
    (*e2n1) = find_local_node_index((*e2), n1);
    (*e2n2) = find_local_node_index((*e2), n2);
    (*e2n3) = 3 - (*e2n1) - (*e2n2);
    //if ((*e2) > -1) { // if e2 is a ghost, there is no e2n data
    (*n4) = theMesh->e2n_getNode((*e2), (*e2n3));
    //}
  }
  if(*n3 == *n4) {
    CkPrintf("[%d]Warning: Identical elements %d:(%d,%d,%d) & %d:(%d,%d,%d)\n",theMod->idx,*e1,n1,n2,*n3,*e2,n1,n2,*n4);
    return -1;
  }
  return 1;
}
Example #4
0
  TestDriver(CkArgMsg *m) {
    delete m;

    CProxy_Destination destinationChare =
      CProxy_Destination::ckNew(CkNumPes() - 1);

    CkPrintf("Size of Converse envelope: %d bytes\n", CmiReservedHeaderSize);
    CkPrintf("Size of Charm++ envelope: %d bytes\n", sizeof(envelope));
    CkPrintf("Default alignment: %d bytes\n", ALIGN_BYTES);

    int msgSizes[] = {varSize1, varSize2};
    std::vector<TestMessage *> allMsgs;
    int prio = 1234;
    for (int i = 0; i < nCheck; i++) {
      TestMessage *msg = new (msgSizes, prio) TestMessage();
      allMsgs.push_back(msg);
    }
    alignmentTest(allMsgs, "source");

    for (int i = 0; i < allMsgs.size(); i++) {
      destinationChare.receiveMessage(allMsgs[i]);
    }
  }
Example #5
0
	BFSGraph(CmiUInt8 nVertex, bool directed = true) : 
	  directed(directed),	
		GraphLib::Graph<
				BFSMultiVertex, 
				BFSEdge,
				CProxy_BFSMultiVertex, 
				GraphLib::TransportType::Charm >(CmiNumPes())	{

    int dims[2] = {CkNumNodes(), CkNumPes() / CkNumNodes()};
    CkPrintf("Aggregation topology: %d %d\n", dims[0], dims[1]);
    aggregator =
      CProxy_ArrayMeshStreamer<dtype, long long, BFSMultiVertex, SimpleMeshRouter>
      ::ckNew(numMsgsBuffered, 2, dims, g, 1);
	}
Example #6
0
void Main::ready()  {
  int i;
  readyCount += 1;
  int BLOCK_SIZE = matrix_size*matrix_size/CkNumPes();
  double (*split_y)[BLOCK_SIZE] = (double (*)[BLOCK_SIZE]) split_bycol;

  if (readyCount == CkNumPes()) {
    // calculate
    CkPrintf("Start calculation\n");
    for (i = 0; i < CkNumPes(); i++) {	  
      object_array[i].multiply(matrix_size * matrix_size/CkNumPes(), split_y[i],i);	  
    }
  }
}
Example #7
0
 void allDone() {
   double elapsedTime = CkWallTimer() - startTime;
   CkPrintf("Elapsed time for all-to-all of %8d bytes sent in %6d %10s"
            " of %2d bytes each (%3s using TRAM): %.6f seconds\n",
            iters * DATA_ITEM_SIZE, iters,
            iters == 1 ? "iteration" : "iterations", DATA_ITEM_SIZE,
            testType == directSends ? "not" : "", elapsedTime);
   if (iters == dataSizeMax / DATA_ITEM_SIZE) {
     ++testType;
     if (testType == finishedTests) {
       CkExit();
     }
     else {
       CkPrintf("\nTEST 2: Using point to point sends\n");
       iters = dataSizeMin / DATA_ITEM_SIZE;
       prepare();
     }
   }
   else {
     iters *= 2;
     prepare();
   }
 }
Example #8
0
 Main(CkArgMsg *m) {
   CkPrintf("running SDAG migration test\n");
   CProxy_Test testProxy = CProxy_Test::ckNew(NUM_ELEMS);
   testProxy.wrapper(100, 200);
   for (int i = 0; i < NUM_ELEMS; i++) {
     char str[100];
     sprintf(str, "test %d", i);
     Msg* m = new (strlen(str) + 1) Msg(i, str);
     testProxy[i].method2(i * 2, i * 2 + 1);
     testProxy[i].method3(m);
     testProxy[i].methodA();
   }
   CkStartQD(CkCallback(CkIndex_Main::finished(), thisProxy));
 }
Example #9
0
 void SayHi(int hiNo)
 {
     if(hiNo <2 )
         startTimer = CkWallTimer();
     else if(hiNo >= numIterations)
     {
         double time = CkWallTimer() - startTimer;
         CkPrintf(" migration cost total : %f sec single migration cost: %f us\n", time, time/(hiNo-1)*1000000); 
         CkExit();
     }
     //CkPrintf("executing  %d  %d\n", CkMyPe(), hiNo);
     thisProxy[thisIndex].SayHi(hiNo+1);
     migrateMe(1-CkMyPe());
 }
Example #10
0
int FEM_Adapt::get_edge_index(int local_node1, int local_node2) 
{
  int sum = local_node1 + local_node2;
  CkAssert(local_node1 != local_node2);
  if (sum == 1) return 0;
  else if (sum == 3) return 1;
  else if (sum == 2) return 2;
  else {
    CkPrintf("ERROR: local node pair is strange: [%d,%d]\n", local_node1,
	    local_node2);
    CkAbort("ERROR: local node pair is strange\n");
    return -1;
  }
}
Example #11
0
		Pingping(std::size_t index, uChareSet<Pingping, CProxy_Pingping, CBase_Pingping> *uchareset) : 
			uChare<Pingping, CProxy_Pingping, CBase_Pingping>(index, uchareset)  {
			CkPrintf("[uchare=%d, chare=%d,pe=%d]: created \n", 
					getId(), getuChareSet()->getId(), getuChareSet()->getPe());

			pingDone = pongDone = false;

			pingCounters.resize(N_uChares);
			pingCounters.assign(N_uChares, -1);
			pongCounters.resize(N_uChares);
			pongCounters.assign(N_uChares, 999);

			contribute(CkCallback(CkReductionTarget(Main, start), mainProxy));
		}
Example #12
0
main::main(CkArgMsg* m)
  {
    //Process command-line arguments
    //Start the computation

    mainProxy = thishandle;
    if(m->argc<2)
      {
	      CkPrintf("Needs number of array elements and allreduce data size\n");
	CkExit();
      }
    units=atoi(m->argv[1]);
    allredSize=atoi(m->argv[2]);
    
    arr = CProxy_AllReduce::ckNew(thisProxy, units);

    CkPrintf("AllReduce for %d pes on %d units for %d size\n",
	     CkNumPes(),units,allredSize);

    arr.init();
    startTime = CkWallTimer();
    arr.dowork();
  }
Example #13
0
    // One worker reports back to here when it completes the workload
    void report(double result) {
      double totalTime, flops, diff;
      double ref_norm = (COEFX+COEFY)*(maxiterations+1);
      result   /= (n-2.0*RADIUS)*(n-2.0*RADIUS);
      totalTime = endTime - startTime;
      flops     = (double) (2*(4*RADIUS+1)+1) * (n-2*RADIUS)*(double)(n-2*RADIUS)*maxiterations;
      diff      = ABS(result-ref_norm);
      if (diff < EPSILON) {
        CkPrintf("Solution validates\n");
#if VERBOSE
      printf("Reference L1 norm = "FSTR", L1 norm = "FSTR"\n", 
             ref_norm, result);
#endif
        
        CkPrintf("Rate (MFlops): %lf Avg time (s) %lf\n", flops/totalTime/1.e6, 
                 totalTime/maxiterations);
      }
      else {
        CkPrintf("Solution does not validate\n");
        CkPrintf("Reference norm: %lf, norm: %lf, |diff|: %e\n", ref_norm, result, diff);
      }
      CkExit();
    }
Example #14
0
/** Allocate both the FEM_ELEM_ELEM_ADJACENCY and FEM_ELEM_ELEM_ADJ_TYPES attributes
    The values in these two attributes will be generated by 
*/
void FEM_Elem::allocateElemAdjacency(){
	
  if(elemAdjacency){
	CkPrintf("FEM> WARNING: Deleting previously allocated(?) elemAdjacency array. allocateElemAdjacency() should probably only be called once.\n");
    delete elemAdjacency;
  }
  if(elemAdjacencyTypes){
   	CkPrintf("FEM> WARNING: Deleting previously allocated(?) elemAdjacencyTypes array. allocateElemAdjacency() should probably only be called once.\n");
	delete elemAdjacencyTypes;
  }

  elemAdjacency = new FEM_IndexAttribute(this,FEM_ELEM_ELEM_ADJACENCY);
  elemAdjacencyTypes = new FEM_IndexAttribute(this,FEM_ELEM_ELEM_ADJ_TYPES);

  elemAdjacency->setLength(size());
  elemAdjacency->setWidth(conn->getWidth());
  elemAdjacencyTypes->setLength(size());
  elemAdjacencyTypes->setWidth(conn->getWidth());
	
  add(elemAdjacency);
  add(elemAdjacencyTypes);

}
Example #15
0
  Main(CkArgMsg* msg) {

    int n = atoi(msg->argv[1]);
    mainProxy = thisProxy;
    
    CkPrintf("n = %d\n",n);
    BProxy = CProxy_B::ckNew(n);
    AProxy = CProxy_A::ckNew(2);
    AProxy.F();

    CkCallback cb = CkCallback(CkReductionTarget(Main, done), thisProxy);
    CkStartQD(cb);

  }
Example #16
0
 void mcastPing(pingMsg *msg)
 {
   // Say hello world
   CkPrintf("Array %d, Element %d received ping number %d\n", aNum, thisIndex, msg->hiNo);
   // Save the section cookie, the first time you get it
   if (! isCookieSet)
   {
       sectionCookie = msg->_cookie;
       isCookieSet = true;
   }
   // Contribute to the section reduction
   mcastMgr->contribute(sizeof(int), &(msg->hiNo), CkReduction::sum_int, sectionCookie);
   delete msg;
 }
Example #17
0
		Main(CkArgMsg *m) {
			CkPrintf("%d:Hallo: argv[1] = %d, argv[2] = %d!\n", CmiMyPe(), atoi(m->argv[1]), atoi(m->argv[2]));

			nElements =  CkNumPes() * atoi(m->argv[1]);
			nChares =  CkNumPes() * atoi(m->argv[2]);

			mainProxy = thisProxy;
			//!!
			alltoall_proxy = new Pingping_uChareArray(nElements, nChares);
			alltoall_proxy->init();

			//thisProxy.init();
			delete m;
		}
Example #18
0
/// Exit simulation program after terminus reduction
void POSE_prepExit(void *param, void *msg)
{
  CkReductionMsg *m = (CkReductionMsg *)msg;
  long long *finalBasicStats = ((long long*)m->getData());
  CkPrintf("Final basic stats: Commits: %lld  Rollbacks: %lld\n", finalBasicStats[0], finalBasicStats[1]);
  delete m;
#ifdef SEQUENTIAL_POSE
  CProxy_pose POSE_Coordinator(POSE_Coordinator_ID);
  POSE_Coordinator.prepExit();
#else
  CProxy_GVT g(TheGVT);
  g.sumGVTIterationCounts();
#endif
}
Example #19
0
WSLB::WSLB(const CkLBOptions &opt) : BaseLB(opt) 
{
#if CMK_LBDB_ON
  thisProxy = CProxy_WSLB(thisgroup);
  lbname = "WSLB";
  if (CkMyPe() == 0)
    CkPrintf("[%d] WSLB created\n",CkMyPe());

  mystep = 0;
  theLbdb->
    AddLocalBarrierReceiver((LDBarrierFn)(staticAtSync),(void*)(this));
  notifier = theLbdb->getLBDB()->
    NotifyMigrated((LDMigratedFn)(staticMigrated),(void*)(this));


   LBtopoFn topofn = LBTopoLookup(_lbtopo);
  if (topofn == NULL) {
    if (CkMyPe()==0) CmiPrintf("LB> Fatal error: Unknown topology: %s.\n", _lbtopo);
    CmiAbort("");
  }
  topo = topofn(CkNumPes());

  // I had to move neighbor initialization outside the constructor
  // in order to get the virtual functions of any derived classes
  // so I'll just set them to illegal values here.
  neighbor_pes = NULL;
  stats_msg_count = 0;
  statsMsgsList = NULL;
  statsDataList = NULL;
  migrates_completed = 0;
  migrates_expected = -1;
  mig_msgs_received = 0;
  mig_msgs = NULL;

  myStats.proc_speed = theLbdb->ProcessorSpeed();
//  char hostname[80];
//  gethostname(hostname,79);
//  CkPrintf("[%d] host %s speed %d\n",CkMyPe(),hostname,myStats.proc_speed);
  myStats.obj_data_sz = 0;
  myStats.comm_data_sz = 0;
  receive_stats_ready = 0;

  vacate = false;
  usage = 1.0;
  usage_int_err = 0.;

  theLbdb->CollectStatsOn();
#endif
}
Example #20
0
HybridBaseLB::HybridBaseLB(const CkLBOptions &opt): CBase_HybridBaseLB(opt)
{
#if CMK_LBDB_ON
  lbname = (char *)"HybridBaseLB";
  thisProxy = CProxy_HybridBaseLB(thisgroup);
  receiver = theLbdb->
    AddLocalBarrierReceiver((LDBarrierFn)(staticAtSync),
			    (void*)(this));
  notifier = theLbdb->getLBDB()->
    NotifyMigrated((LDMigratedFn)(staticMigrated), (void*)(this));

  statsStrategy = FULL;

  // defines topology
  if (CkNumPes() <= 4)  {
    tree = new TwoLevelTree;
  }
  else {
    tree = new ThreeLevelTree;
    if (CkNumPes() >= 4096) statsStrategy = SHRINK;
    //statsStrategy = SHRINK;

  }
  //tree = new FourLevelTree;
  if (CkMyPe() == 0)
    CkPrintf("%s: %s is created.\n", lbname, tree->name());

  // decide which load balancer to call
//  greedy = (CentralLB *)AllocateGreedyLB();
//  refine = (CentralLB *)AllocateRefineLB();

  currentLevel = 0;
  foundNeighbors = 0;
  future_migrates_expected = -1;

  vector_n_moves = 0;

  maxLoad = 0.0;
  maxCpuLoad = 0.0;
  totalLoad = 0.0;
  maxCommCount = 0;
  maxCommBytes = 0.0;
  maxMem = 0.0;

  if (_lb_args.statsOn()) theLbdb->CollectStatsOn();

  group1_created = 0;             // base class need to call initTree()
#endif
}
Example #21
0
/// Commit (delete) all events that are done (used in sequential mode)
void eventQueue::CommitDoneEvents(sim *obj) {
#ifdef EQ_SANITIZE
  sanitize();
#endif
  Event *commitPtr = frontPtr->next;
  
  // commit calls for done events
  while (commitPtr != backPtr) {
    if (commitPtr->done) {
      obj->ResolveCommitFn(commitPtr->fnIdx, commitPtr->msg);
      obj->basicStats[0]++;
      CommitStatsHelper(obj, commitPtr);
      if (commitPtr->commitBfrLen > 0)  { // print buffered output
	CkPrintf("%s", commitPtr->commitBfr);
	if (commitPtr->commitErr) CmiAbort("Commit ERROR");
      }
    }
    commitPtr = commitPtr->next;
  }

  // now free up the memory (only delete events that are done)
  Event *link = commitPtr;
  commitPtr = commitPtr->prev;
  while (commitPtr != frontPtr) {
    if (commitPtr->done == 1) {
#ifdef MEM_TEMPORAL
      if (commitPtr->serialCPdata) {
	localTimePool->tmp_free(commitPtr->timestamp, commitPtr->serialCPdata);
      }
#else
      if (commitPtr->cpData) {
	delete commitPtr->cpData;
      }
#endif
    }
    commitPtr = commitPtr->prev;
    if (commitPtr->next->done == 1) {
      mem_usage--;
      delete commitPtr->next;
    } else {
      link = commitPtr->next;
    }
  }
  frontPtr->next = link;
  link->prev = frontPtr; 
#ifdef EQ_SANITIZE
  sanitize();
#endif
}
Example #22
0
void ComputeMap::saveComputeMap(const char *fname)
{
  static int count = 0;
  char f[128];
  sprintf(f, "%s.%d", fname, count++);
  FILE *fp = fopen(f, "w");
  CmiAssert(fp != NULL);
  fprintf(fp, "%d\n", nComputes);
  for(int i=0; i < nComputes; i++)
  {
    fprintf(fp, "%d\n", computeData[i].node);
  }
  fclose(fp);
  CkPrintf("ComputeMap has been stored in %s.\n", f);
}
Example #23
0
		void ping(int callee, int order) { 
				CkPrintf("[chare=%d,pe=%d]: %d: ping #%d called by %d\n", 
						getuChareSet()->getId(), getuChareSet()->getPe(), getId(), order, callee);
				getProxy()[callee]->pong(getId(), order+1000);

				if ((pingCounters[callee] + 1) != order) {
					CkError("Ping order failure: callee = %d, counter = %d, order = %d\n", 
							callee, pingCounters[callee], order);
					CkAbort("Ping order failure");
				}
				else
					pingCounters[callee]++;

				//doPong(callee);
		}
Example #24
0
void ScriptTcl::load(char *scriptFile) {

#ifdef NAMD_TCL
  int code = Tcl_EvalFile(interp,scriptFile);
  const char *result = Tcl_GetStringResult(interp);
  if (*result != 0) CkPrintf("TCL: %s\n",result);
  if (code != TCL_OK) {
    const char *errorInfo = Tcl_GetVar(interp,"errorInfo",0);
    NAMD_die(errorInfo);
  }
#else
  NAMD_bug("ScriptTcl::load called without Tcl.");
#endif

}
Example #25
0
    void F() {
      std::vector<CkFuture> arr;
      CkPrintf("Sending F\n");
      for(int i = 0 ; i < PER_A_ELEMS; i ++) {
        CkFuture f = CkCreateFuture();
        BProxy[Q[i]/PER_B_ELEMS].G(Q[i], f);
        arr.push_back(f);
      }
      CkPrintf("Receiving F\n");
      for(int i = 0 ; i < PER_A_ELEMS; i ++) {
        CkFuture f = arr[i];
        myMsg* m = (myMsg*)CkWaitFuture(f);
        T[i] = m->val;
        delete m;
      }



      CkPrintf("T[%d] Contents\n", thisIndex);
      for(int i = 0 ; i < PER_A_ELEMS; i ++) {
        CkPrintf("%d ", T[i]);
      }
      CkPrintf("\n");
    }
Example #26
0
/*
 * Begin Ewald messages
 */
void ComputeMgr:: sendComputeEwaldData(ComputeEwaldMsg *msg)
{
    if (computeEwaldObject)
    {
        int node = computeEwaldObject->getMasterNode();
        CProxy_ComputeMgr cm(CkpvAccess(BOCclass_group).computeMgr);
        cm[node].recvComputeEwaldData(msg);
    }
    else if (!PatchMap::Object()->numHomePatches())
    {
        CkPrintf("skipping message on Pe(%d)\n", CkMyPe());
        delete msg;
    }
    else NAMD_die("ComputeMgr::computeEwaldObject is NULL!");
}
Example #27
0
void WSLB::MigrationDone()
{
#if CMK_LBDB_ON
  if (CkMyPe() == 0) {
    double end_lb_time = CkWallTimer();
    CkPrintf("Load balancing step %d finished at %f duration %f\n",
	     step(),end_lb_time,end_lb_time - start_lb_time);
  }
  migrates_completed = 0;
  migrates_expected = -1;
  // Increment to next step
  mystep++;
  thisProxy [CkMyPe()].ResumeClients();
#endif
}
Example #28
0
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);
        }
    }
}
Example #29
0
void chunk::refiningElements()
{
  int i;
  
  CkPrintf("[tmr] Chunk %d: refiningElements\n", cid);
  while (modified) { 
    // continue trying to refine elements until nothing changes during
    // a refinement cycle
    i = 0;
    modified = 0;
    CkPrintf("[tmr] Chunk %d: Entering internal refinement loop...\n", cid);
    while (i < numElements) { // loop through the elements
      if (theElements[i].getCachedArea() < 0.0) // no cached area yet
      	theElements[i].calculateArea();
      if ((!theElements[i].hasDependency() &&
	  (((theElements[i].getTargetArea() <= theElements[i].getCachedArea()) 
	    && (theElements[i].getTargetArea() >= 0.0)) 
	   || theElements[i].isSpecialRequest() 
	   || theElements[i].isPendingRequest()))
	  || theElements[i].isRequestResponse()) {
	// the element either needs refining or has been asked to
	// refine or has asked someone else to refine
	//CkPrintf("[tmr] Chunk %d: Element %d: hasdep? %c target=%f current=%f spcReq? %c pend? %c reqResp? %c\n", cid, i, (theElements[i].hasDependency() ? 'y' : 'n'), theElements[i].getTargetArea(), theElements[i].getCachedArea(), (theElements[i].isSpecialRequest() ? 'y' : 'n'), (theElements[i].isPendingRequest() ? 'y' : 'n'), (theElements[i].isRequestResponse() ? 'y' : 'n'));
	modified = 1; // something's bound to change
	theElements[i].refine(); // refine the element
      }
      i++;
    }
    //if (CkMyPe() == 0) for (int j=0; j<numChunks; j++) mesh[j].print();
    adjustMesh();
    CthYield(); // give other chunks on the same PE a chance
  }
  // nothing is in need of refinement; turn refine loop off
  refineInProgress = 0;  
  CkPrintf("[tmr] Chunk %d: DONE refiningElements\n", cid);
}
Example #30
0
bool saneFreqNormLds(double *loads, int numProcs)
{
	double tot=0.0;
	for(int i=0;i<numProcs;i++)
	{
		tot+=loads[i];
	}
	double r=numProcs-tot;
	if(r>0.01 || r<-0.01)
	{
		CkPrintf("THere is a problem with LOADs!!! r=%f procs=%d loadSum=%f\n",r,numProcs,tot);
		return false;
	}
	else return true;
}