コード例 #1
0
ファイル: CoMD.c プロジェクト: tim0s/llvmir-NPB-MPI
/// 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 (! 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);
   
   // Memory footprint diagnostics
   int perAtomSize = 10*sizeof(real_t)+2*sizeof(int);
   float mbPerAtom = perAtomSize/1024/1024;
   float totalMemLocal = (float)(perAtomSize*s->atoms->nLocal)/1024/1024;
   float totalMemGlobal = (float)(perAtomSize*s->atoms->nGlobal)/1024/1024;

   int nLocalBoxes = s->boxes->gridSize[0]*s->boxes->gridSize[1]*s->boxes->gridSize[2];
   int nTotalBoxes = (s->boxes->gridSize[0]+2)*(s->boxes->gridSize[1]+2)*(s->boxes->gridSize[2]+2);
   float paddedMemLocal = (float) nLocalBoxes*(perAtomSize*MAXATOMS)/1024/1024;
   float paddedMemTotal = (float) nTotalBoxes*(perAtomSize*MAXATOMS)/1024/1024;

   printSeparator(file);
   fprintf(file,"Memory data: \n");
   fprintf(file, "  Intrinsic atom footprint = %4d B/atom \n", perAtomSize);
   fprintf(file, "  Total atom footprint     = %7.3f MB (%6.2f MB/node)\n", totalMemGlobal, totalMemLocal);
   fprintf(file, "  Link cell atom footprint = %7.3f MB/node\n", paddedMemLocal);
   fprintf(file, "  Link cell atom footprint = %7.3f MB/node (including halo cell data\n", paddedMemTotal);

   fflush(file);      
}
コード例 #2
0
ファイル: main.c プロジェクト: mattokaren/zw-schoolwork
int main(int argc, const char * argv[])
{
    static const double endingCondition = 0.000000001;
    
    printSeparator();
    printf(" This program will successively run iterations of the     \n");
    printf(" Jacobi Algorithm for diagonalization until some form of  \n");
    printf(" convergence is reacheed.\n");
    printSeparator();
    BOOL shouldSort = promptShouldUseSorting();
    BOOL demoMode = promptShouldUseDemo();
    int iterations = 1;
    if (!demoMode) {
        iterations = promptIterations();
    }
    
    for (int i = 0; i < iterations; i++) {
        printSeparator();
        printLine();
        
        MatrixRef A = MatrixCreateRandomSymmetric(5);
        double offA = JacobiSquareSumOffDiagonal(A, NULL);
        
        if (demoMode) {
            printf("Starting 5x5 symmetric matrix: \n\n");
            MatrixPrint(A);
            
            printLine();
            printf("Starting off(A): %6.2f\n\n", offA);
            
            printSeparator();
            printLine();
        }
        
        MatrixRef B = Jacobi(A, shouldSort, endingCondition);
        
        if (demoMode) {
            printLine();
            printSeparator();
            printLine();
            printf("Finishing matrix: \n\n");
            MatrixPrint(B);
        }
        
        MatrixDestroy(B); B = NULL;
        MatrixDestroy(A); A = NULL;
    }
    
#if defined(__MINGW32__) || defined(_WIN32)
    system("PAUSE");
#endif
    
    return 0;
}
コード例 #3
0
ファイル: com.c プロジェクト: 8l/insieme
void
printReportHeader ( void )
{
  char *now;
  int nameSize;
  char myProcName[MPI_MAX_PROCESSOR_NAME];

  if ( rank == 0 )
  {
    now = getTimeStr (  );
    MPI_Get_processor_name ( myProcName, &nameSize );

    printSeparator (  );
    printf ( "\n  com Point-to-Point MPI Bandwidth and Latency Benchmark\n" );
    printf ( "  Version %d.%d.%d\n", majorVersion, minorVersion,
             patchVersion );
    printf ( "  Run at %s, with rank 0 on %s\n\n", now, myProcName );
    free ( now );
    printParameters (  );

    if ( presta_check_data == 1 )
    {
      printf
        ( "  *** Verifying operation message buffers.  Benchmark results not valid! ***\n" );
    }

    if ( strlen ( procSrcTitle ) > 0 )
      printf ( "  Using Task Pair file %s\n", procSrcTitle );

    printf ( "\n" );

    if ( strcmp ( argStruct.testList, "Latency" ) != 0 )
    {
      if ( argStruct.sumLocalBW == 1 )
        printf ( "  Bandwidth calculated as sum of process bandwidths.\n" );
      else if ( argStruct.sumLocalBW == 0 )
        printf
          ( "  Bandwidth calculated as total volume / longest task communication.\n" );

      /*  TODO : Not necessary unless providing info about sample time.
         printTimingInfo ( );   
       */
    }
  }


  if ( argStruct.printHostInfo )
    printCommTargets ( argStruct.procsPerNode, argStruct.useNearestRank );

  printSeparator (  );

}
コード例 #4
0
void stopCountingFileTokens(void) {
  tokenCountingOn = false;
  
  if (printTokens) {
    if (strcmp(line, "") != 0) {
      processNewline();
    }

    printSeparator();
    printFileSummary();
    printSeparator();
    fprintf(stderr, "\n");
  }
}
コード例 #5
0
ファイル: main.c プロジェクト: mkerley/deviceconsole
static void SocketCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *data, void *info)
{
    // Skip null bytes
    ssize_t length = CFDataGetLength(data);
    const char *buffer = (const char *)CFDataGetBytePtr(data);
    while (length) {
        while (*buffer == '\0') {
            buffer++;
            length--;
            if (length == 0)
                goto exit;
        }
        size_t extentLength = 0;
        while ((buffer[extentLength] != '\0') && extentLength != length) {
            extentLength++;
        }
        
        if (should_print_message(buffer, extentLength)) {
            printMessage(1, buffer, extentLength);
            printSeparator(1);
        }
        
        length -= extentLength;
        buffer += extentLength;
    }

exit:
    /*
     * It turns out that every time we get here, we've logged one complete log
     * statement. (which could be more than one line, but you get the idea.)
     */
    linesLogged++;

    return;
}
コード例 #6
0
ファイル: main.c プロジェクト: CptFrazz/deviceconsole
static void SocketCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *data, void *info)
{
    // Skip null bytes
    ssize_t length = CFDataGetLength(data);
    const char *buffer = (const char *)CFDataGetBytePtr(data);
    while (length) {
        while (*buffer == '\0') {
            buffer++;
            length--;
            if (length == 0)
                return;
        }
        size_t extentLength = 0;
        while ((buffer[extentLength] != '\0') && extentLength != length) {
            extentLength++;
        }
        
        if (should_print_message(buffer, extentLength)) {
            printMessage(1, buffer, extentLength);
            printSeparator(1);
        }
        
        length -= extentLength;
        buffer += extentLength;
    }
}
コード例 #7
0
ファイル: yamlOutput.c プロジェクト: oxbow-apps/CoHMM
void yamlAppInfo(FILE* file)
{
   if (!PRINT_YAML || !printRank())
      return;
   printSeparator(file);
   fprintf(file,"Mini-Application Name    : %s\n", CoMDVariant);
   fprintf(file,"Mini-Application Version : %s\n", CoMDVersion);
   fprintf(file,"Platform:\n");
   fprintf(file,"  hostname: %s\n",         CoMD_HOSTNAME);
   fprintf(file,"  kernel name: %s\n",      CoMD_KERNEL_NAME);
   fprintf(file,"  kernel release: %s\n",   CoMD_KERNEL_RELEASE);
   fprintf(file,"  processor: %s\n",        CoMD_PROCESSOR);
   fprintf(file,"Build:\n");
   fprintf(file,"  CC: %s\n",               CoMD_COMPILER);
   fprintf(file,"  compiler version: %s\n", CoMD_COMPILER_VERSION);
   fprintf(file,"  CFLAGS: %s\n",           CoMD_CFLAGS);
   fprintf(file,"  LDFLAGS: %s\n",          CoMD_LDFLAGS);
   fprintf(file,"  using MPI: %s\n",        builtWithMpi() ? "true":"false");
   fprintf(file,"  Threading: none\n");
   fprintf(file,"  Double Precision: %s\n", (sizeof(real_t)==sizeof(double)?"true":"false"));
   char timestring[32];
   getTimeString(timestring);
   fprintf(file,"Run Date/Time: %s\n", timestring);
   fprintf(file, "\n");
   fflush(file);
}
コード例 #8
0
ファイル: main.c プロジェクト: mkerley/deviceconsole
void simulator_write_callback(char *p, size_t size){
    char buffer[size];
    bzero(buffer, sizeof(buffer));
    memcpy(&buffer, p, size);


    if (should_print_message(buffer, size)) {
        printMessage(1, buffer, size);
        printSeparator(1);
    }
}
コード例 #9
0
ファイル: CoMD_lib.c プロジェクト: oxbow-apps/CoHMM
/// 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);      
}
コード例 #10
0
ファイル: CONTAIN.CPP プロジェクト: EstebanAO/Subir
void Container::printOn( ostream& outputStream ) const
{
    ContainerIterator& printIterator = initIterator();
    printHeader( outputStream );
    while( printIterator != 0 )
        {
        printIterator++.printOn( outputStream );
        if ( printIterator != 0 )
            printSeparator( outputStream );
        else
            break;
        }
    printTrailer( outputStream );
    delete &printIterator;
}
コード例 #11
0
ファイル: CoMD.c プロジェクト: shamouda/ocr-apps
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;
}
コード例 #12
0
void startCountingFileTokens(const char* filename) {
  static bool firstCall = true;

  if (firstCall) {
    firstCall = false;
    initTokenCount();
  }

  tokenCountingOn = true;

  if (countTokens) {
    clearFile();
    clearLine();
    if (printTokens) {
      fprintf(stderr, "%s\n", filename);
      printSeparator();
    }
  }
}
コード例 #13
0
void AbstractArray::printContentsOn( ostream& outputStream ) const
{
    ContainerIterator& printIterator = initIterator();
    printHeader( outputStream );
    while( printIterator != 0 )
        {
        Object& arrayObject = printIterator++;
        if( arrayObject != NOOBJECT )
            {
            arrayObject.printOn( outputStream );
            if( printIterator != 0 )
                printSeparator( outputStream );
            else
                break;
            }
        }
    printTrailer( outputStream );
    delete &printIterator;
}
コード例 #14
0
ファイル: wadutil.c プロジェクト: Vraiment/VROOM
int main(int argc, const char * argv[]) {
	arguments_t arguments;
	
	atexit(cleanUp);
	parseArguments(argc - 1, &argv[1], &arguments);
	
	if (!arguments.fileName) {
		printManual();
		return 0;
	}
	
	if (!readWad(&wad, arguments.fileName)) {
		printf("could not open %s.\n", argv[1]);
		return -1;
	}
	
	if (wad.type != NOWAD) {
		printf("reading file %s.\n", wad.name);
	} else {
		printf("%s is not a valid wad file.", wad.name);
		return -1;
	}
	
	if (arguments.badArgument) {
		printf("\n\"%s\" is not a valid option.\n\n", arguments.badArgument);
		printHelp();
		return 0;
	}
	
	if (arguments.flags == ARG_NONE) {
		printf("\nnothing to do.\n\n");
		printHelp();
		return 0;
	}
	
	if (arguments.flags & ARG_HEADER) {
		printSeparator();
		printHeader(&wad);
	}
	
	if (arguments.flags & ARG_DIRECTORY) {
		printSeparator();
		printDirectory(&wad);
	}
	
	if (arguments.flags & ARG_PNAMES) {
		printSeparator();
		printPNames(&wad);
	}
	
	if (arguments.flags & ARG_TEXTURE1) {
		printSeparator();
		printTextures(&wad, "TEXTURE1");
	}
	
	if (arguments.flags & ARG_TEXTURE2) {
		printSeparator();
		printTextures(&wad, "TEXTURE2");
	}
	
	if (arguments.flags & ARG_COLORMAP) {
		printSeparator();
		printColormaps(&wad);
	}
	
    return 0;
}
コード例 #15
0
ファイル: com.c プロジェクト: 8l/insieme
int
main ( int argc, char *argv[] )
{
  int *messList = NULL;
  int testIdx, doTestLoop;
  int i;

  executableName = "com";

  MPI_Init ( &argc, &argv );
  MPI_Get_processor_name ( hostName, &i );

  /* Set global wsize and rank values */
  MPI_Comm_size ( MPI_COMM_WORLD, &wsize );
  MPI_Comm_rank ( MPI_COMM_WORLD, &rank );

  if ( !initAllTestTypeParams ( &testParams ) )
  {
    MPI_Finalize (  );
    exit ( 1 );
  }

  argStruct.testList = "Bidirectional, BidirAsync";

  if ( !processArgs ( argc, argv ) )
  {
    if ( rank == 0 )
      printUse (  );

    MPI_Finalize (  );
    exit ( 1 );
  }

  /* If using a source directory of process rank target files,
   * get the next appropriate file.
   */
  if ( targetDirectory != NULL && getNextTargetFile (  ) == 0 )
  {
    prestaAbort ( "Failed to open target file in target directory %s\n",
                  targetDirectory );
  }

  doTestLoop = 1;
  while ( doTestLoop )
  {
    if ( !setupTestListParams (  ) || !initAllTestTypeParams ( &testParams ) )
    {
      if ( rank == 0 )
        printUse (  );

      MPI_Finalize (  );
      exit ( 1 );
    }

#ifdef PRINT_ENV
    if ( rank == 0 )
      printEnv();
#endif

    printReportHeader (  );

    for ( testIdx = 0; testIdx < TYPETOT; testIdx++ )
    {
      if ( argStruct.testList == NULL
           || ( argStruct.testList != NULL
                && strstr ( argStruct.testList,
                            testParams[testIdx].name ) != NULL ) )
      {
        prestaRankDebug ( 0, "running test index %d\n", testIdx );
        runTest ( &testParams[testIdx] );
      }
    }

    if ( presta_check_data == 1 )
    {
      MPI_Reduce ( &presta_data_err_total, &presta_global_data_err_total,
                   1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD );
    }

    if ( targetDirectory == NULL || getNextTargetFile (  ) == 0 )
    {
      doTestLoop = 0;
    }
  }

  printSeparator (  );

  freeBuffers ( &testParams );
  free ( messList );

  MPI_Finalize (  );

  exit ( 0 );
}
コード例 #16
0
void DataInterface::sendData(const char data[])
{
  printSeparator();
  print(data);
}
コード例 #17
0
void DataInterface::sendData(int data)
{
  printSeparator();
  print(data);
}