Debian Codegraph @

hmmer/test-speed/component-benchmark.pl

raw
1 #! /usr/bin/perl
2
3 # Component speed benchmarks
4 #
5 # Usage: ./component-benchmark.pl <top_builddir> <top_srcdir>
6 # Example: ./component-benchmark.pl ../build-icc-mpi .. > component-benchmark.out
7 #
8 # For a range of models of different sizes, run a speed benchmark for
9 # each component of H3's pipeline. Output an ASCII summary table to
10 # stdout.
11 #
12 # SRE, Thu Mar 10 09:07:38 2011
13
14 $top_builddir = shift;
15 $top_srcdir = shift;
16
17 #@benchmarks = ( "./generic_fwdback_benchmark -F", "./msvfilter_benchmark" );
18
19 @benchmarks = ( "src/impl/msvfilter_benchmark",
20 "src/impl/vitfilter_benchmark",
21 "src/impl/fwdback_benchmark -PF",
22 "src/impl/fwdback_benchmark -PB",
23 "src/impl/fwdback_benchmark -F",
24 "src/impl/fwdback_benchmark -B",
25 "src/impl/decoding_benchmark",
26 "src/impl/null2_benchmark",
27 "src/impl/null2_benchmark -t",
28 "src/impl/optacc_benchmark",
29 "src/generic_msv_benchmark",
30 "src/generic_viterbi_benchmark",
31 "src/generic_fwdback_benchmark -F",
32 "src/generic_fwdback_benchmark -B",
33 "src/generic_decoding_benchmark",
34 "src/generic_null2_benchmark",
35 "src/generic_optacc_benchmark" );
36
37 @models = ("XYPPX", "RRM_1", "Caudal_act", "LuxC", "Patched", "SMC_N");
38
39 printf("%30s ", "");
40 foreach $model (@models) { printf("%23s ", $model); }
41 printf("\n");
42 printf("%30s ", "");
43 foreach $model (@models) { printf("%23s ", "-----------------------"); }
44 printf("\n");
45
46 foreach $benchmark (@benchmarks)
47 {
48 ($benchmark_name) = ($benchmark =~ /\/([^\/]+_benchmark.*)$/);
49 printf("%-30s ", $benchmark_name);
50 foreach $model (@models)
51 {
52 $output = `${top_builddir}/$benchmark ${top_srcdir}/testsuite/$model.hmm`;
53 ($cputime, $M, $Mcs) = &get_results($output);
54 printf("%8s (%7s Mc/s) ", $cputime, $Mcs);
55 }
56 printf("\n");
57 }
58
59
60 sub get_results {
61 my($output) = @_;
62
63 if ($output =~ /^\# CPU time:\s+(\S+)/) { $cputime = $1; }
64 if ($output =~ /^\# M\s+=\s+(\d+)/) { $M = $1; }
65 if ($output =~ /\# (\S+) Mc\/s/) { $Mcs = $1; }
66 ($cputime, $M, $Mcs);
67 }