Exemple #1
0
    void check_and_compute() {
        compute_kernel();

        // calculate error
        // not being done right now since we are doing a fixed no. of iterations

        double *tmp;
        tmp = temperature;
        temperature = new_temperature;
        new_temperature = tmp;

        constrainBC();

        if (iterations % CKP_FREQ == 0 || iterations > MAX_ITER) {
#ifdef CMK_MEM_CHECKPOINT
            contribute(0, 0, CkReduction::concat, CkCallback(CkIndex_Main::report(), mainProxy));
#elif CMK_MESSAGE_LOGGING
            if(iterations > MAX_ITER)
                contribute(0, 0, CkReduction::concat, CkCallback(CkIndex_Main::report(), mainProxy));
            else
                AtSync();
#else
            contribute(0, 0, CkReduction::concat, CkCallback(CkIndex_Main::report(), mainProxy));
#endif
        } else {
            doStep();
        }
    }
Exemple #2
0
  void check_and_compute ()
  {
//       if (--messages_due == 0) 
//          messages_due = 4;
      compute ();
//          mainProxy.report();
      if (thisIndex < majElements - 1)
	{
//                      printf("DONE WITH index=%d and calling for ind=%d\n",thisIndex,thisIndex+1);
#ifdef PRIOR
	  opts = new CkEntryOptions ();
	  opts1 = new CkEntryOptions ();
	  opts->setPriority (-100);
	  opts1->setPriority (100);

//printf("-------- Jacobi[%d] sending message to next one at time=%f\n",thisIndex,CkWallTimer());
	  thisProxy[thisIndex + 1].begin_iteration (1, opts);
        for(int i=(thisIndex+1)*7;i<(thisIndex+1)*7+7;i++)
                minorProxy[i].begin_iteration(1,opts1);
#else
	  thisProxy[thisIndex + 1].begin_iteration (1);
	  for (int i = (thisIndex + 1) * 7; i < (thisIndex + 1) * 7 + 7; i++)
	    minorProxy[i].begin_iteration (1);
#endif
	}
      else
	{
//                      printf("CAlling report Jacobi[%d] time=%f!!!!!!!!!!1\n",thisIndex,CkWallTimer());

//	  else
//	    mainProxy.report ();
	}
	if (iterations % ldbTime == 4) AtSync();
	else contribute(CkCallback(CkIndex_Main::report(NULL),mainProxy));
  }
    void check_and_compute() {
	    float timeToCompute = CmiWallTimer();
       if (messages_due == 0 && hasSent) {
          messages_due = 4;
          hasSent=false;
          compute();
          int currPe = CkMyPe();
          //ckout << "iter=" << itercnt << ": (" << thisIndex.x << "," << thisIndex.y << ") reporting pe " << CkMyPe() << endl;
          mainProxy.report(thisIndex.x, thisIndex.y, CkMyPe(), CmiWallTimer()-timeToCompute);
          if (itercnt == LDB_ITER) {
            //ckout << "iter=" << itercnt << ": AtSync reported from " << CkMyPe() << endl;
            AtSync();
          }
        }
    }
Exemple #4
0
// Function that checks whether it must start the following step or wait until other messages are received
void Patch::checkNextStep(){
  int i;
  double timer;

  if (updateFlag && incomingFlag) {
    // resetting flags
    updateFlag = false;
    incomingFlag = false;
    stepCount++;

    // adding new elements
    for (i = 0; i < incomingParticles.length(); i++)
      particles.push_back(incomingParticles[i]);
    incomingParticles.removeAll();

    if (thisIndex.x == 0 && thisIndex.y == 0 && thisIndex.z == 0 && stepCount%NUM_STEPS == 0) {
      timer = CmiWallTimer();
      CkPrintf("Step %d Benchmark Time %f ms/step, Total Time Elapsed %f s\n", stepCount, ((timer - stepTime)/NUM_STEPS)*1000, timer);
      stepTime = timer;
//      if (stepCount == 300)
//	traceBegin();
  //    if (stepCount == 400)
//	traceEnd();

    }
 //   if (stepCount == 300 && thisIndex.x*patchArrayDimY*patchArrayDimZ + thisIndex.y*patchArrayDimZ + thisIndex.z < 8)
 //     traceBegin();
 //   if (stepCount == 301 && thisIndex.x*patchArrayDimY*patchArrayDimZ + thisIndex.y*patchArrayDimZ + thisIndex.z < 8)
 //     traceEnd();

    // checking for next step
    if (stepCount >= finalStepCount) {
     // CkPrintf("Final number of particles is %d on Patch [%d][%d][%d]\n", particles.length(), thisIndex.x, thisIndex.y, thisIndex.z);
      print();
      contribute(CkCallback(CkIndex_Main::allDone(), mainProxy)); 
    } else {
      if (perform_lb){
	AtSync();
	LBTurnInstrumentOff();
	perform_lb=false;
      }
      else{
	thisProxy(thisIndex.x, thisIndex.y, thisIndex.z).start();
	//contribute(CkCallback(CkIndex_Main::lbBarrier(),mainProxy));
      }
    }
  }
}
Exemple #5
0
  void check_and_compute ()
  {
//       if (--messages_due == 0) 

//          messages_due = 4;
    compute ();
    if (iterations % ldbTime == 4/* || iterations == 100*/)
      {
//                        printf("MINOR[%d] itr=%d ----------------------------- ssssssssssssss\n",thisIndex,iterations);
	AtSync ();
      }

    else
//      mainProxy.report ();
	contribute(CkCallback(CkIndex_Main::report(NULL),mainProxy));


  }
Exemple #6
0
/// Perform load balancing now.	
void LV3D_Array::LV3D_DoBalance(void) {
	AtSync();
}