Exemplo n.º 1
0
  // Each worker reports back to here when it completes an iteration
  void report (CkReductionMsg *msg)
  {
    recieve_count++;
    double totaltime = CkWallTimer () - startTime;
//    printf("coming in report--------------------------------------------- rec=%d\n",recieve_count);
    if (2 == recieve_count)
//      if(minElements+1 == recieve_count)
      {
	if (iterations == total_iterations)
	  {
	    CkPrintf
	      ("Completed %d iterations; last iteration time: %.6lf total time=%f\n",
	       iterations, totaltime, CkWallTimer () - start);
//	    CkExit ();
		mainProxy.exiting();
	  }
	else
	  {
if(iterations==1) useThisCriticalPathForPriorities();
	    if (iterations % 1 == 0)
	      {
		char tempArr[50];
		for (int x = 0; x < 50; x++)
		  tempArr[x] = 0;
		float avg = 0;
		for (int pe = 0; pe < CkNumPes (); pe++)
		  {
		    sprintf (tempArr + strlen (tempArr), "%d ",
			     (int) getTemp (pe));
		    avg += getTemp (pe);
		    //if(gmaxTemp<stats->procs[pe].pe_temp) gmaxTemp=stats->procs[pe].pe_temp;
		  }
		avg /= CkNumPes ();
		CkPrintf
		  ("starting new iteration; iteration %d time: %.6lf AVG=%.6lf\n",
		   iterations, totaltime, avg);
		//printf("********* iteration=%d AVG temp=%f **********\n",iterations,avg);
//                      sprintf(tempArr,"%d %f",iterations,avg);
		// printf("temps=%s\n",tempArr);
		writeTemps (f, tempArr);
//		if (CkMyPe () == 0)
		  freqProxy.measureFreq (iterations, total_iterations);
	      }

//                CkPrintf("starting new iteration; iteration %d time: %.6lf\n", iterations, totaltime);
	    recieve_count = 0;
	    iterations++;
	    // Call begin_iteration on all worker chares in array
	    startTime = CkWallTimer ();
#ifdef PRIOR
	    opts = new CkEntryOptions ();
	    opts1 = new CkEntryOptions ();
	    opts->setPriority (-100);
	    opts1->setPriority (100);

	    array[0].begin_iteration (1, opts);
                for(int i=0;i<7;i++)
                        arrayMin[i].begin_iteration(1,opts1);
//              arrayMin.begin_iteration(1,opts1);              
#else
	    array[0].begin_iteration (1);
	    for (int i = 0; i < 7; i++)
	      arrayMin[i].begin_iteration (1);
#endif

	  }
      }
  }