@@ -40,7 +40,7 @@ our @EXPORT = qw(system_identity suite_run calc_scalability);
40
40
our $datadir = dist_dir(" Benchmark-DKbench" );
41
41
my $mono_clock = $^O !~ / win/i || $Time::HiRes::VERSION >= 1.9764;
42
42
43
- our $VERSION = ' 2.3 ' ;
43
+ our $VERSION = ' 2.4 ' ;
44
44
45
45
=head1 NAME
46
46
@@ -143,11 +143,13 @@ options to control number of threads, iterations, which benchmarks to run etc:
143
143
--multi, -m : Multi-threaded using all your CPU cores/threads.
144
144
--max_threads <i> : Override the cpu detection to specify max cpu threads.
145
145
--iter <i>, -i <i> : Number of suite iterations (with min/max/avg at the end).
146
+ --stdev : Show relative standard deviation (for iter > 1).
146
147
--include <regex> : Run only benchmarks that match regex.
147
148
--exclude <regex> : Do not run benchmarks that match regex.
148
149
--time, -t : Report time (sec) instead of score.
149
150
--quick, -q : Quick benchmark run (implies -t).
150
151
--no_mce : Do not run under MCE::Loop (implies -j 1).
152
+ --scale <i>, -s <i> : Scale the bench workload by x times.
151
153
--skip_bio : Skip BioPerl benchmarks.
152
154
--skip_prove : Skip Moose prove benchmark.
153
155
--time_piece : Run optional Time::Piece benchmark (see benchmark details).
@@ -165,18 +167,26 @@ multi vs single threaded scalability.
165
167
The scores are calibrated such that a reference CPU (Intel Xeon Platinum 8481C -
166
168
Sapphire Rapids) would achieve a score of 1000 in a single-core benchmark run using
167
169
the default software configuration (Linux/Perl 5.36.0 built with multiplicity and
168
- threads, with reference CPAN module versions).
170
+ threads, with reference CPAN module versions). Perl built without thread support and
171
+ multi(plicity) will be a bit faster (usually in the order of ~3-4%), while older Perl
172
+ versions will most likely be slower. Different CPAN module versions will also impact
173
+ scores, using C<setup_dkbench > is a way to ensure a reference environment for more
174
+ meaningful hardware comparisons.
169
175
170
- The multi-thread scalability should approach 100% if each thread runs on a full core
171
- (i.e. no SMT), and the core can maintain the clock speed it had on the single-thread
172
- runs. Note that the overall scalability is an average of the benchmarks that drops
173
- non-scaling outliers (over 2*stdev less than the mean).
176
+ The multi-thread scalability calculated by the suite should approach 100% if each
177
+ thread runs on a full core (i.e. no SMT), and the core can maintain the clock speed
178
+ it had on the single-thread runs. Note that the overall scalability is an average
179
+ of the benchmarks that drops non-scaling outliers (over 2*stdev less than the mean).
180
+
181
+ If you want to reduce the effects of thermal throttling, which will lower the speed
182
+ of (mainly multi-threaded) benchmarks as the CPU temperature increases, the C<sleep >
183
+ option can help by adding cooldown time between each benchmark.
174
184
175
185
The suite will report a Pass/Fail per benchmark. A failure may be caused if you have
176
186
different CPAN module version installed - this is normal, and you will be warned.
177
187
178
- The suite uses L<MCE::Loop> to run on the desired number of parallel threads, although
179
- there is an option to disable it, which forces a single-thread run.
188
+ L<MCE::Loop> is used to run on the desired number of parallel threads, with minimal
189
+ overhead., There is an option to disable it, which forces a single-thread run.
180
190
181
191
=head2 C<setup_dkbench >
182
192
@@ -306,6 +316,9 @@ Prints out software/hardware configuration and returns then number of cores dete
306
316
Runs the benchmark suite given the C<%options > and prints results. Returns a hash
307
317
with run stats.
308
318
319
+ The options accepted are the same as the C<dkbench > script (in their long form),
320
+ except C<help > , C<setup > and C<max_threads > which are command-line only.
321
+
309
322
=head2 C<calc_scalability >
310
323
311
324
calc_scalability(\%options, \%stat_single, \%stat_multi);
@@ -331,7 +344,7 @@ actual workload.
331
344
=head2 SCORES
332
345
333
346
Some sample DKbench score results from various systems for comparison (all on
334
- reference setup with Perl 5.36.0):
347
+ reference setup with Perl 5.36.0 thread-multi ):
335
348
336
349
CPU Cores/HT Single Multi Scalability
337
350
Intel i7-4750HQ @ 2.0 (MacOS) 4/8 612 2332 46.9%
@@ -423,7 +436,7 @@ sub suite_run {
423
436
my $opt = shift ;
424
437
$datadir = $opt -> {datapath } if $opt -> {datapath };
425
438
$opt -> {threads } //= 1;
426
- $opt -> {repeat } //= 1;
439
+ $opt -> {scale } //= 1;
427
440
$opt -> {f } = $opt -> {time } ? ' %.3f' : ' %5.0f' ;
428
441
my %stats = (threads => $opt -> {threads });
429
442
@@ -529,15 +542,15 @@ sub mce_bench_run {
529
542
MCE-> gather([$time , $res ]);
530
543
}
531
544
}
532
- (1 .. $opt -> {threads } * $opt -> {repeat });
545
+ (1 .. $opt -> {threads } * $opt -> {scale });
533
546
534
547
my ($res , $time ) = (' Pass' , 0);
535
548
foreach (@stats ) {
536
549
$time += $_ -> [0];
537
550
$res = $_ -> [1] if $_ -> [1] ne ' Pass' ;
538
551
}
539
552
540
- return $time /($opt -> {threads }*$opt -> {repeat } || 1), $res ;
553
+ return $time /($opt -> {threads }*$opt -> {scale } || 1), $res ;
541
554
}
542
555
543
556
sub bench_run {
@@ -1033,6 +1046,7 @@ sub total_stats {
1033
1046
my $display = $opt -> {time } ? ' times' : ' scores' ;
1034
1047
my $title = $opt -> {time } ? ' Time (sec)' : ' Score' ;
1035
1048
print " Aggregates:\n " .pad_to(" Benchmark" ,24).pad_to(" Avg $title " ).pad_to(" Min $title " ).pad_to(" Max $title " );
1049
+ print pad_to(" stdev %" ) if $opt -> {stdev };
1036
1050
print pad_to(" Pass %" ) unless $opt -> {time };
1037
1051
print " \n " ;
1038
1052
foreach my $bench (sort keys %$benchmarks ) {
@@ -1053,7 +1067,13 @@ sub calc_stats {
1053
1067
my $arr = shift ;
1054
1068
my $pad = shift ;
1055
1069
my ($min , $max , $avg ) = min_max_avg($arr );
1056
- return $avg , join ' ' , map {pad_to(sprintf ($opt -> {f }, $_ ), $pad )} ($avg ,$min ,$max );
1070
+ my $str = join ' ' , map {pad_to(sprintf ($opt -> {f }, $_ ), $pad )} ($avg ,$min ,$max );
1071
+ if ($opt -> {stdev } && $avg ) {
1072
+ my $stdev = avg_stdev($arr );
1073
+ $stdev *= 100/$avg ;
1074
+ $str .= pad_to(sprintf (" %0 .2f%%" , $stdev ), $pad );
1075
+ }
1076
+ return $avg , $str ;
1057
1077
}
1058
1078
1059
1079
sub min_max_avg {
0 commit comments