Changeset 104


Ignore:
Timestamp:
06/01/10 06:56:05 (4 years ago)
Author:
faltet
Message:

New version of benchmark for specifying the threads in the suite.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bench/bench.c

    r103 r104  
    161161  printf("********************** Run info ******************************\n"); 
    162162  printf("Blosc version: %s (%s)\n", BLOSC_VERSION_STRING, BLOSC_VERSION_DATE); 
    163   printf("Using synthetic with %d significant bits (out of 32)\n", rshift); 
     163  printf("Using synthetic data with %d significant bits (out of 32)\n", rshift); 
    164164  printf("Dataset size: %d bytes\tType size: %d bytes\n", size, elsize); 
    165165  printf("Working set: %.1f MB\t\t", (size*NCHUNKS) / (float)MB); 
     
    270270  int j; 
    271271 
    272   if ((argc == 2) && strcmp(argv[1], "suite") == 0) { 
     272  if ((argc >= 2) && (strcmp(argv[1], "suite") == 0)) { 
    273273    suite = 1; 
    274   } 
    275   else if ((argc == 2) && strcmp(argv[1], "hard_suite") == 0) { 
     274    if (argc == 3) { 
     275      nthreads = atoi(argv[2]); 
     276    } 
     277  } 
     278  else if ((argc >= 2) && (strcmp(argv[1], "hard_suite") == 0)) { 
    276279    hard_suite = 1; 
    277   } 
    278   else if (argc >= 2) { 
    279     nthreads = atoi(argv[1]); 
    280   } 
    281  
    282   if (argc >= 3) { 
    283     size = atoi(argv[2])*1024; 
    284     if (size > 2*1024*1024) { 
    285       printf("The test is going to require more than 256 MB of RAM!\n"); 
    286     } 
    287   } 
    288   if (argc >= 4) { 
    289     elsize = atoi(argv[3]); 
    290   } 
    291   if (argc >= 5) { 
    292     rshift = atoi(argv[4]); 
    293   } 
    294   if (argc >= 6) { 
    295     printf("Usage: bench 'suite' | 'hard_suite' | [nthreads [bufsize(KB) [typesize [sbits ]]]]\n"); 
    296     exit(1); 
    297   } 
    298  
    299   if (suite) { 
    300     for (nthreads=1; nthreads <= 6; nthreads++) { 
    301       for (size=64*KB; size <= 4*MB; size *=2) { 
    302         for (elsize=1; elsize <= 16; elsize *=2) { 
    303           do_bench(nthreads, size, elsize, rshift); 
    304         } 
    305       } 
    306     } 
    307   } 
    308   else if (hard_suite) { 
    309     for (nthreads=1; nthreads < 10; nthreads++) { 
    310       for (size=32*KB; size < 8*MB; size *=2) { 
    311         for (elsize=1; elsize < 32; elsize *=2) { 
     280    if (argc == 3) { 
     281      nthreads = atoi(argv[2]); 
     282    } 
     283  } 
     284  else { 
     285    if (argc >= 2) { 
     286      nthreads = atoi(argv[1]); 
     287    } 
     288    if (argc >= 3) { 
     289      size = atoi(argv[2])*1024; 
     290      if (size > 2*1024*1024) { 
     291        printf("The test is going to require more than 256 MB of RAM!\n"); 
     292      } 
     293    } 
     294    if (argc >= 4) { 
     295      elsize = atoi(argv[3]); 
     296    } 
     297    if (argc >= 5) { 
     298      rshift = atoi(argv[4]); 
     299    } 
     300    if (argc >= 6) { 
     301      printf("Usage: bench 'suite' [nthreads] | 'hard_suite' [nthreads] | [nthreads [bufsize(KB) [typesize [sbits ]]]]\n"); 
     302      exit(1); 
     303    } 
     304  } 
     305 
     306  if (hard_suite) { 
     307    for (j=1; j <= nthreads; j++) { 
     308      for (size=32*KB; size <= 8*MB; size *=2) { 
     309        for (elsize=1; elsize < 32; elsize +=2) { 
    312310          for (rshift=0; rshift < 32; rshift++) { 
    313             do_bench(nthreads, size, elsize, rshift); 
     311            do_bench(j, size, elsize, rshift); 
    314312          } 
    315313        } 
     
    317315    } 
    318316  } 
     317  else if (suite) { 
     318    for (j=1; j <= nthreads; j++) { 
     319        do_bench(j, size, elsize, rshift); 
     320    } 
     321  } 
    319322  else { 
    320     for (j=1; j <= nthreads; j++) { 
    321       do_bench(j, size, elsize, rshift); 
    322     } 
     323    do_bench(nthreads, size, elsize, rshift); 
    323324  } 
    324325 
Note: See TracChangeset for help on using the changeset viewer.