Ejemplo n.º 1
0
void timestampBarrier(const char* msg)
{
   barrierParallel();
   if (! printRank())
      return;
   time_t t= time(NULL);
   char* timeString = ctime(&t);
   timeString[24] = '\0'; // clobber newline
   fprintf(screenOut, "%s: %s\n", timeString, msg);
   fflush(screenOut);
}
Ejemplo n.º 2
0
void printPerformanceResultsYaml(FILE* file)
{
   if (! printRank())
      return;

   double tick = getTick();
   double loopTime = perfTimer[loopTimer].total*tick;

   fprintf(file,"\nPerformance Results:\n");
   fprintf(file, "  TotalRanks: %d\n", getNRanks());
   fprintf(file, "  ReportingTimeUnits: seconds\n");
   fprintf(file, "Performance Results For Rank %d:\n", getMyRank());
   for (int ii = 0; ii < numberOfTimers; ii++)
   {
      if (perfTimer[ii].count > 0)
      {
         double totalTime = perfTimer[ii].total*tick;
         fprintf(file, "  Timer: %s\n", timerName[ii]);
         fprintf(file, "    CallCount:  %"PRIu64"\n", perfTimer[ii].count); 
         fprintf(file, "    AvgPerCall: %8.4f\n", totalTime/(double)perfTimer[ii].count);
         fprintf(file, "    Total:      %8.4f\n", totalTime);
         fprintf(file, "    PercentLoop: %8.2f\n", totalTime/loopTime*100);
      }
   }

   fprintf(file, "Performance Results Across Ranks:\n");
   for (int ii = 0; ii < numberOfTimers; ii++)
   {
      if (perfTimer[ii].count > 0)
      {
         fprintf(file, "  Timer: %s\n", timerName[ii]);
         fprintf(file, "    MinRank: %d\n", perfTimer[ii].minRank);
         fprintf(file, "    MinTime: %8.4f\n", perfTimer[ii].minValue*tick);     
         fprintf(file, "    MaxRank: %d\n", perfTimer[ii].maxRank);
         fprintf(file, "    MaxTime: %8.4f\n", perfTimer[ii].maxValue*tick);
         fprintf(file, "    AvgTime: %8.4f\n", perfTimer[ii].average*tick);
         fprintf(file, "    StdevTime: %8.4f\n", perfTimer[ii].stdev*tick);
      }
   }

   fprintf(file,"Performance Global Update Rates:\n");
   fprintf(file, "  AtomUpdateRate:\n");
   fprintf(file, "    AverageRate: %6.2f\n", perfGlobal.atomRate);
   fprintf(file, "    Units: us/atom/task\n");
   fprintf(file, "  AllAtomUpdateRate:\n");
   fprintf(file, "    AverageRate: %6.2f\n", perfGlobal.atomAllRate);
   fprintf(file, "    Units: us/atom\n");
   fprintf(file, "  AtomRate:\n");
   fprintf(file, "    AverageRate: %6.2f\n", perfGlobal.atomsPerUSec);
   fprintf(file, "    Units: atoms/us\n");
 
   fprintf(file, "\n");
}
Ejemplo n.º 3
0
void PrintFnovList( FNOV_LIST *root )
/***********************************/
// pretty display of list of overloaded function rankings
{
    int         i;
    FNOV_LIST   *entry;
    VBUF        name;

    i = 1;
    RingIterBeg( root, entry ) {
        printf( "[%d]: '%s'", i++, FormatSym( entry->sym, &name ) );
        VbufFree( &name );
        if( entry->member || entry->stdops ) {
            printf( " flags=( " );
            if( entry->member ) {
                printf( "member " );
            }
            if( entry->stdops ) {
                printf( "stdops " );
            }
            printf( ")" );
        }
        printf( "\n" );
        if( SymIsThisFuncMember( entry->sym ) ) {
            printRank( 1, &entry->thisrank, PRINT_THIS );
        }
        if( entry->rankvector == NULL ) {
            printf( "    (no rank available)\n" );
        } else {
            if( entry->rankvector->control & FNC_RANK_RETURN ) {
                printRank( 1, entry->rankvector, PRINT_RETURN );
            } else {
                printRank( entry->alist->num_args
                         , entry->rankvector
                         , PRINT_DEFAULT );
            }
        }
    } RingIterEnd( entry )
Ejemplo n.º 4
0
void printTableData(InterpolationObject* table, const char* fileName)
{
   if (!printRank()) return;

   FILE* potData;
   potData = fopen(fileName,"w");
   real_t dR = 1.0/table->invDx;
   for (int i = 0; i<table->n; i++)
   {
      real_t r = table->x0+i*dR;
      fprintf(potData, "%d %e %e\n", i, r, table->values[i]);
   }
   fclose(potData);
}
Ejemplo n.º 5
0
int main() {
    FILE *file;
    Matrix *matrix;

    matrix = initMatrix();

    fileToMatrix(file, matrix);

    stocatic(matrix);
    fromStocatic(matrix);

    convergeMatrix(matrix);

    printRank(matrix, matrix->pages);
    return 0;
}
/// \details
/// The report contains two blocks.  The upper block is performance
/// information for the printRank.  The lower block is statistical
/// information over all ranks.
void printPerformanceResults(int nGlobalAtoms)
{
   // Collect timer statistics overall and across ranks
   timerStats();

   if (!printRank())
      return;

   // only print timers with non-zero values.
   double tick = getTick();
   double loopTime = perfTimer[loopTimer].total*tick;
   
   fprintf(screenOut, "\n\nTimings for Rank %d\n", getMyRank());
   fprintf(screenOut, "        Timer        # Calls    Avg/Call (s)   Total (s)    %% Loop\n");
   fprintf(screenOut, "___________________________________________________________________\n");
   for (int ii=0; ii<numberOfTimers; ++ii)
   {
      double totalTime = perfTimer[ii].total*tick;
      if (perfTimer[ii].count > 0)
         fprintf(screenOut, "%-16s%12"PRIu64"     %8.4f      %8.4f    %8.2f\n", 
                 timerName[ii],
                 perfTimer[ii].count,
                 totalTime/(double)perfTimer[ii].count,
                 totalTime,
                 totalTime/loopTime*100.0);
   }

   fprintf(screenOut, "\nTiming Statistics Across %d Ranks:\n", getNRanks());
   fprintf(screenOut, "        Timer        Rank: Min(s)       Rank: Max(s)      Avg(s)    Stdev(s)\n");
   fprintf(screenOut, "_____________________________________________________________________________\n");

   for (int ii = 0; ii < numberOfTimers; ++ii)
   {
      if (perfTimer[ii].count > 0)
         fprintf(screenOut, "%-16s%6d:%10.4f  %6d:%10.4f  %10.4f  %10.4f\n", 
            timerName[ii], 
            perfTimer[ii].minRank, perfTimer[ii].minValue*tick,
            perfTimer[ii].maxRank, perfTimer[ii].maxValue*tick,
            perfTimer[ii].average*tick, perfTimer[ii].stdev*tick);
   }
   real_t atomsPerTask = nGlobalAtoms/(real_t)getNRanks();
   real_t atomRate = perfTimer[computeForceTimer].average * tick * 1e6 /
      (atomsPerTask * perfTimer[computeForceTimer].count);
   fprintf(screenOut, "\n---------------------------------------------------\n");
   fprintf(screenOut, " Average atom update rate: %6.2f us/atom/task\n", atomRate);
   fprintf(screenOut, "---------------------------------------------------\n\n");
}
Ejemplo n.º 7
0
Validate* initValidate(SimFlat* sim)
{
   sumAtoms(sim);
   Validate* val = comdMalloc(sizeof(Validate));
   val->eTot0 = (sim->ePotential + sim->eKinetic) / sim->atoms->nGlobal;
   val->nAtoms0 = sim->atoms->nGlobal;

   if (printRank())
   {
      fprintf(screenOut, "\n");
      printSeparator(screenOut);
      fprintf(screenOut, "Initial energy : %14.12f, atom count : %d \n",
            val->eTot0, val->nAtoms0);
      fprintf(screenOut, "\n");
   }
   return val;
}
Ejemplo n.º 8
0
void yamlBegin(void)
{
   if (!PRINT_YAML || !printRank())
      return;

   char filename[64];
   time_t rawtime;
   time (&rawtime);
   struct tm* ptm = localtime(&rawtime);
   char sdate[25];
  //use tm_mon+1 because tm_mon is 0 .. 11 instead of 1 .. 12
   sprintf (sdate,"%04d:%02d:%02d-%02d:%02d:%02d",
            ptm->tm_year + 1900, ptm->tm_mon+1,
            ptm->tm_mday, ptm->tm_hour, ptm->tm_min,ptm->tm_sec);
   sprintf(filename, "%s.%s.yaml", CoMDVariant, sdate);
   yamlFile = fopen(filename, "w");
}
Ejemplo n.º 9
0
void printCmdYaml(FILE* file, Command* cmd)
{
   if (! printRank())
      return;
   fprintf(file,
           "Command Line Parameters:\n"
           "  doeam: %d\n"
           "  potDir: %s\n"
           "  potName: %s\n"
           "  potType: %s\n"
           "  nx: %d\n"
           "  ny: %d\n"
           "  nz: %d\n"
           "  xproc: %d\n"
           "  yproc: %d\n"
           "  zproc: %d\n"
           "  Lattice constant: %g Angstroms\n"
           "  nSteps: %d\n"
           "  printRate: %d\n"
           "  Time step: %g fs\n"
           "  Initial Temperature: %g K\n"
           "  Initial Delta: %g Angstroms\n\n"
           "  GPU async opt: %d\n"
           "  GPU profiling mode: %d\n"
           "  GPU method: %s\n"
           "  Space-filling (Hilbert): %d\n"
           "\n",
           cmd->doeam,
           cmd->potDir,
           cmd->potName,
           cmd->potType,
           cmd->nx, cmd->ny, cmd->nz,
           cmd->xproc, cmd->yproc, cmd->zproc,
           cmd->lat,
           cmd->nSteps,
           cmd->printRate,
           cmd->dt,
           cmd->temperature,
           cmd->initialDelta,
	   cmd->gpuAsync,
	   cmd->gpuProfile,
	   cmd->method,
	   cmd->doHilbert
   );
   fflush(file);
}
Ejemplo n.º 10
0
void printCmdYaml(FILE* file, Command* cmd)
{
   if (! printRank())
      return;
   fprintf(file,
           "Command Line Parameters:\n"
           "  doeam: %d\n"
           "  potDir: %s\n"
           "  potName: %s\n"
           "  potType: %s\n"
           "  nx: %d\n"
           "  ny: %d\n"
           "  nz: %d\n"
           "  xproc: %d\n"
           "  yproc: %d\n"
           "  zproc: %d\n"
           "  Lattice constant: %g Angstroms\n"
           "  nSteps: %d\n"
           "  printRate: %d\n"
           "  Time step: %g fs\n"
           "  Initial Temperature: %g K\n"
           "  Initial Delta: %g Angstroms\n"
           "\n",
           cmd->doeam,
#ifdef TEST_SUITE
           cmd->potDir,
#else
           ".",
#endif
           cmd->potName,
           cmd->potType,
           cmd->nx, cmd->ny, cmd->nz,
           cmd->xproc, cmd->yproc, cmd->zproc,
           cmd->lat,
           cmd->nSteps,
           cmd->printRate,
           cmd->dt,
           cmd->temperature,
           cmd->initialDelta
   );
   fflush(file);
}
Ejemplo n.º 11
0
/// Print information about the simulation in a format that is (mostly)
/// YAML compliant.
void printSimulationDataYaml(FILE* file, SimFlat* s)
{
   // All ranks get maxOccupancy
   int maxOcc = maxOccupancy(s->boxes);

   // Only rank 0 prints
   if (!PRINT_YAML || !printRank())
      return;
   
   fprintf(file,"Simulation data: \n");
   fprintf(file,"  Total atoms        : %d\n", 
           s->atoms->nGlobal);
   fprintf(file,"  Min global bounds  : [ %14.10f, %14.10f, %14.10f ]\n",
           s->domain->globalMin[0], s->domain->globalMin[1], s->domain->globalMin[2]);
   fprintf(file,"  Max global bounds  : [ %14.10f, %14.10f, %14.10f ]\n",
           s->domain->globalMax[0], s->domain->globalMax[1], s->domain->globalMax[2]);
   printSeparator(file);
   fprintf(file,"Decomposition data: \n");
   fprintf(file,"  Processors         : %6d,%6d,%6d\n", 
           s->domain->procGrid[0], s->domain->procGrid[1], s->domain->procGrid[2]);
   fprintf(file,"  Local boxes        : %6d,%6d,%6d = %8d\n", 
           s->boxes->gridSize[0], s->boxes->gridSize[1], s->boxes->gridSize[2], 
           s->boxes->gridSize[0]*s->boxes->gridSize[1]*s->boxes->gridSize[2]);
   fprintf(file,"  Box size           : [ %14.10f, %14.10f, %14.10f ]\n", 
           s->boxes->boxSize[0], s->boxes->boxSize[1], s->boxes->boxSize[2]);
   fprintf(file,"  Box factor         : [ %14.10f, %14.10f, %14.10f ] \n", 
           s->boxes->boxSize[0]/s->pot->cutoff,
           s->boxes->boxSize[1]/s->pot->cutoff,
           s->boxes->boxSize[2]/s->pot->cutoff);
   fprintf(file, "  Max Link Cell Occupancy: %d of %d\n",
           maxOcc, MAXATOMS);
   printSeparator(file);
   fprintf(file,"Potential data: \n");
   s->pot->print(file, s->pot);
   
   fflush(file);      
}
int main () {
    int n = 0, m = 0;
    scanf("%d %d", &n, &m);
    struct Student *students = new struct Student[n];
    for (int i = 0; i < n; i++) {
        scanf("%s %d %d %d", students[i].id, &students[i].score[1], &students[i].score[2], &students[i].score[3]);
        students[i].score[0] = (students[i].score[1] + students[i].score[2] + students[i].score[3]) / 3.0 + 0.5;
    }
    
    // qsort by C Programming Language
    qsort(students, n, sizeof(students[0]), cmp1);
    for (int i = 0; i < n; i++) {
        students[i].rank[1] = i + 1;
        if (i != 0 && students[i].score[1] == students[i - 1].score[1]) {
            students[i].rank[1] = students[i - 1].rank[1];
        }
    }
    
    // qsort by Mathematics
    qsort(students, n, sizeof(students[0]), cmp2);
    for (int i = 0; i < n; i++) {
        students[i].rank[2] = i + 1;
        if (i != 0 && students[i].score[2] == students[i - 1].score[2]) {
            students[i].rank[2] = students[i - 1].rank[2];
        }
    }
    
    // qsort by English
    qsort(students, n, sizeof(students[0]), cmp3);
    for (int i = 0; i < n; i++) {
        students[i].rank[3] = i + 1;
        if (i != 0 && students[i].score[3] == students[i - 1].score[3]) {
            students[i].rank[3] = students[i - 1].rank[3];
        }
    }
    
    // qsort by Average
    qsort(students, n, sizeof(students[0]), cmp0);
    for (int i = 0; i < n; i++) {
        students[i].rank[0] = i + 1;
        if (i != 0 && students[i].score[0] == students[i - 1].score[0]) {
            students[i].rank[0] = students[i - 1].rank[0];
        }
    }
    
    
    for (int i = 0; i < m; i++) {
        char id[7];
        scanf("%s", id);
        bool state = true;
        for (int j = 0; j < n; j++) {
            if (strcmp(students[j].id, id) == 0) {
                printRank(students[j]);
                state = false;
                break;
            } else {
                
            }
        }
        if (state) printf("N/A\n");
    }
    delete [] students;
    return 0;
}