@@ -99,6 +99,11 @@ my $RESULTDIR = getDir('UB_RESULTDIR', $FindBin::Bin . "/results");
9999# Directory where the tests are executed.
100100my $TESTDIR = getDir(' UB_TESTDIR' , $FindBin::Bin . " /testdir" );
101101
102+ # System information
103+ my $systemInfo = getSystemInfo();
104+
105+ # Multi-parallel literal
106+ my $multiParallel = " Multi-parallel copies" ;
102107
103108# ###########################################################################
104109# TEST SPECIFICATIONS
@@ -255,6 +260,7 @@ my $testParams = {
255260 " cat" => ' system' ,
256261 " repeat" => ' long' ,
257262 " options" => " 10" ,
263+ " system_capacity_parallel_factor" => 2,
258264 },
259265 " pipe" => {
260266 " logmsg" => " Pipe Throughput" ,
@@ -900,6 +906,7 @@ sub parseArgs {
900906 # Generate the requested list of bench programs.
901907 my $opt ;
902908 my $word ;
909+ my $copies ;
903910 while ($word = shift (@words )) {
904911 if ($word !~ m / ^-/ ) { # A test name.
905912 if ($word eq " all" ) {
@@ -922,7 +929,9 @@ sub parseArgs {
922929 if (!defined ($params -> {' copies' })) {
923930 $params -> {' copies' } = [ ];
924931 }
925- push (@{$params -> {' copies' }}, shift (@words ));
932+ $copies = shift (@words );
933+ abortRun(" -c copies should be positive integer" ) if ($copies !~ m / ^\d +$ / || $copies <= 0);
934+ push (@{$params -> {' copies' }}, );
926935 } else {
927936 die (" Run: unknown option $word \n " );
928937 }
@@ -1342,7 +1351,7 @@ sub runBenchmark {
13421351 $params -> {' command' } = $command ;
13431352
13441353 # Set up the benchmark results structure.
1345- my $bresult = { ' name' => $bench , ' msg' => $params -> {' logmsg' } };
1354+ my $bresult = { ' name' => $bench , ' msg' => $params -> {' logmsg' }, ' copies ' => $copies };
13461355
13471356 if ($verbose > 0) {
13481357 printf " \n %d x %s " , $copies , $params -> {' logmsg' };
@@ -1416,13 +1425,22 @@ sub runTests {
14161425 abortRun(" unknown benchmark \" $bench \" " );
14171426 }
14181427
1428+ my $benchCopies = $copies ;
1429+ if ($benchCopies == 0) {
1430+ $benchCopies = $systemInfo -> {' numCpus' };
1431+ my $pFactor = $params -> {' system_capacity_parallel_factor' };
1432+ if (defined $pFactor ) {
1433+ $benchCopies *= $pFactor ;
1434+ }
1435+ }
1436+
14191437 # If the benchmark doesn't want to run with this many copies, skip it.
14201438 my $cat = $params -> {' cat' };
14211439 my $maxCopies = $testCats -> {$cat }{' maxCopies' };
1422- next if ($maxCopies > 0 && $copies > $maxCopies );
1440+ next if ($maxCopies > 0 && $benchCopies > $maxCopies );
14231441
14241442 # Run the benchmark.
1425- my $bresult = runBenchmark($bench , $params , $verbose , $logFile , $copies );
1443+ my $bresult = runBenchmark($bench , $params , $verbose , $logFile , $benchCopies );
14261444 $results -> {$bench } = $bresult ;
14271445 }
14281446 $results -> {' end' } = time ();
@@ -1450,7 +1468,8 @@ sub runTests {
14501468# Display a banner indicating the configuration of the system under test
14511469# to the given file desc.
14521470sub displaySystem {
1453- my ( $info , $fd ) = @_ ;
1471+ my ( $fd ) = @_ ;
1472+ my $info = $systemInfo ;
14541473
14551474 # Display basic system info.
14561475 printf $fd " System: %s : %s \n " , $info -> {' name' }, $info -> {' system' };
@@ -1487,9 +1506,9 @@ sub logResults {
14871506 # Display the individual test scores.
14881507 foreach my $bench (@{$results -> {' list' }}) {
14891508 my $bresult = $results -> {$bench };
1490-
1491- printf $outFd " %-40s %12.1f %-5s (%.1f s, %d samples)\n " ,
1492- $bresult -> {' msg' },
1509+ my $copiesInfo = number( $bresult -> { ' copies ' }, " copy " , " copies " );
1510+ printf $outFd " %-55s %12.1f %-5s (%.1f s, %d samples)\n " ,
1511+ $bresult -> {' msg' }. " ( $copiesInfo ) " ,
14931512 $bresult -> {' score' },
14941513 $bresult -> {' scorelabel' },
14951514 $bresult -> {' time' },
@@ -1520,21 +1539,22 @@ sub logIndexCat {
15201539 # scores, or a partial set.
15211540 my $head = $testCats -> {$cat }{' name' } .
15221541 ($full ? " Index Values" : " Partial Index" );
1523- printf $outFd " %-40s %12s %12s %8s\n " ,
1542+ printf $outFd " %-55s %12s %12s %8s\n " ,
15241543 $head , " BASELINE" , " RESULT" , " INDEX" ;
15251544
15261545 # Display the individual test scores.
15271546 foreach my $bench (@{$results -> {' list' }}) {
15281547 my $bresult = $results -> {$bench };
15291548 next if $bresult -> {' cat' } ne $cat ;
1549+ my $copiesInfo = number($bresult -> {' copies' }, " copy" , " copies" );
15301550
15311551 if (defined ($bresult -> {' iscore' }) && defined ($bresult -> {' index' })) {
1532- printf $outFd " %-40s %12.1f %12.1f %8 .1f\n " ,
1533- $bresult -> {' msg' }, $bresult -> {' iscore' },
1552+ printf $outFd " %-55s %12.1f %12.1f %8 .1f\n " ,
1553+ $bresult -> {' msg' }. " ( $copiesInfo ) " , $bresult -> {' iscore' },
15341554 $bresult -> {' score' }, $bresult -> {' index' };
15351555 } else {
1536- printf $outFd " %-40s %12s %12.1f %8s\n " ,
1537- $bresult -> {' msg' }, " ---" ,
1556+ printf $outFd " %-55s %12s %12.1f %8s\n " ,
1557+ $bresult -> {' msg' }. " ( $copiesInfo ) " , " ---" ,
15381558 $bresult -> {' score' }, " ---" ;
15391559 }
15401560 }
@@ -1544,8 +1564,8 @@ sub logIndexCat {
15441564 if (!$full ) {
15451565 $title .= " (Partial Only)" ;
15461566 }
1547- printf $outFd " %-40s %12s %12s %8s\n " , " " , " " , " " , " ========" ;
1548- printf $outFd " %-66s %8 .1f\n " , $title , $iscore ;
1567+ printf $outFd " %-55s %12s %12s %8s\n " , " " , " " , " " , " ========" ;
1568+ printf $outFd " %-81s %8 .1f\n " , $title , $iscore ;
15491569
15501570 printf $outFd " \n " ;
15511571}
@@ -1564,7 +1584,7 @@ sub logIndex {
15641584
15651585# Dump the given run results into the given report file.
15661586sub summarizeRun {
1567- my ( $systemInfo , $ results , $verbose , $reportFd ) = @_ ;
1587+ my ( $results , $verbose , $reportFd ) = @_ ;
15681588
15691589 # Display information about this test run.
15701590 printf $reportFd " ------------------------------------------------------------------------\n " ;
@@ -1574,7 +1594,7 @@ sub summarizeRun {
15741594 strftime(" %H :%M :%S " , localtime ($results -> {' end' }));
15751595 printf $reportFd " %s in system; running %s of tests\n " ,
15761596 number($systemInfo -> {' numCpus' }, " CPU" ),
1577- number($results -> {' copies' }, " parallel copy" , " parallel copies" );
1597+ $results -> { ' copies ' } == 0 ? $multiParallel : number($results -> {' copies' }, " parallel copy" , " parallel copies" );
15781598 printf $reportFd " \n " ;
15791599
15801600 # Display the run scores.
@@ -1597,7 +1617,8 @@ sub summarizeRunCsvHeader {
15971617 # Write CSV Headers of test.
15981618 foreach my $bench (@{$results -> {' list' }}) {
15991619 my $bresult = $results -> {$bench };
1600- printf $reportFd " ,%s " , $bresult -> {' msg' };
1620+ my $copiesInfo = number($bresult -> {' copies' }, " copy" , " copies" );
1621+ printf $reportFd " ,%s " , $bresult -> {' msg' }." ($copiesInfo )" ;
16011622 }
16021623 printf $reportFd " \n " ;
16031624}
@@ -1633,7 +1654,7 @@ sub summarizeRunCsvRows {
16331654
16341655# Dump the given run results into the given report file.
16351656sub runHeaderHtml {
1636- my ( $systemInfo , $ reportFd ) = @_ ;
1657+ my ( $reportFd ) = @_ ;
16371658
16381659 # Display information about this test run.
16391660 my $title = sprintf " Benchmark of %s / %s on %s " ,
@@ -1680,7 +1701,8 @@ EOF
16801701# Display a banner indicating the configuration of the system under test
16811702# to the given file desc.
16821703sub displaySystemHtml {
1683- my ( $info , $fd ) = @_ ;
1704+ my ( $fd ) = @_ ;
1705+ my $info = $systemInfo ;
16841706
16851707 printf $fd " <h3>Test System Information</h3>\n " ;
16861708 printf $fd " <p><table>\n " ;
@@ -1834,7 +1856,7 @@ sub logResultsHtml {
18341856
18351857# Dump the given run results into the given report file.
18361858sub summarizeRunHtml {
1837- my ( $systemInfo , $ results , $verbose , $reportFd ) = @_ ;
1859+ my ( $results , $verbose , $reportFd ) = @_ ;
18381860
18391861 # Display information about this test run.
18401862 my $time = $results -> {' end' } - $results -> {' start' };
@@ -1901,15 +1923,15 @@ sub main {
19011923 createDirrectoriesIfNotExists(@creatingDirectories );
19021924
19031925 preChecks();
1904- my $systemInfo = getSystemInfo();
19051926
19061927 # If the number of copies to run was not set, set it to 1
1907- # and the number of CPUs in the system (if > 1).
1928+ # and the system capacity based on number of CPUs in the system
1929+ # (if > 1) and per benchmark characteristic.
19081930 my $copies = $params -> {' copies' };
19091931 if (!$copies || scalar (@$copies ) == 0) {
19101932 push (@$copies , 1);
19111933 if (defined ($systemInfo -> {' numCpus' }) && $systemInfo -> {' numCpus' } > 1) {
1912- push (@$copies , $systemInfo -> { ' numCpus ' } );
1934+ push (@$copies , 0 );
19131935 }
19141936 }
19151937
@@ -1950,23 +1972,23 @@ sub main {
19501972 }
19511973
19521974 printf $reportFd " BYTE UNIX Benchmarks (Version %s )\n\n " , $version ;
1953- runHeaderHtml($systemInfo , $ reportFd2 );
1975+ runHeaderHtml($reportFd2 );
19541976
19551977 # Dump information about the system under test.
1956- displaySystem($systemInfo , $ reportFd );
1957- displaySystemHtml($systemInfo , $ reportFd2 );
1978+ displaySystem($reportFd );
1979+ displaySystemHtml($reportFd2 );
19581980
19591981 # Run the tests! Do a test run once for each desired number of copies;
19601982 # for example, on a 2-CPU system, we may do a single-processing run
19611983 # followed by a dual-processing run.
19621984 foreach my $c (@$copies ) {
19631985 if ($verbose > 1) {
1964- printf " Run with %s \n " , number($c , " copy" , " copies" );
1986+ printf " Run with %s \n " , $c == 0 ? $multiParallel : number($c , " copy" , " copies" );
19651987 }
19661988 my $results = runTests($tests , $verbose , $logFile , $c );
19671989
1968- summarizeRun($systemInfo , $ results , $verbose , $reportFd );
1969- summarizeRunHtml($systemInfo , $ results , $verbose , $reportFd2 );
1990+ summarizeRun($results , $verbose , $reportFd );
1991+ summarizeRunHtml($results , $verbose , $reportFd2 );
19701992
19711993 if ($isOutputFormatCsv ) {
19721994 if ( $is_csv_header_written == 0 ) {
0 commit comments