| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #!/usr/bin/perl
- use strict;
- my %workingon = ();
- my @probmults = ();
- my $totMmults = 0;
- my @probend = ();
- my @Nfiles = ('N-44', 'N-54', 'N-60', 'N-66', 'N-72', 'N-76', 'N-80',
- 'N-84', 'N-88');
- # Read the moduli for each of the subproblems
- my @moduli = (0);
- my $f;
- for (1..20) {
- foreach $f (@Nfiles) {
- open(N, $f);
- while(<N>) {
- if (/^\[(\d+\s*)+\]/) {
- while(/(\d+)/g) {
- push @moduli, $1;
- }
- }
- }
- close(N);
- push @probend, [$#moduli, $f];
- }
- }
- while(<>) {
- chomp;
- next unless /^(\d+\.\d+):(.*?):(.*)$/;
- my ($ts, $node, $line) = ($1,$2,$3);
- if ($line =~ /Subproblem (\d+)/) {
- $workingon{$node} = $1;
- }
- if ($line =~ /(\d+) us \/ (\d+) = \d+ us \/ (\d+) = \d+ ns/) {
- my $numMmults = $2 * $3 / 1000000;
- my $elapsed = $1;
- if ($workingon{$node} > 0) {
- $probmults[$workingon{$node}] += $numMmults;
- $totMmults += $numMmults;
- $workingon{$node} = 0;
- } else {
- warn "Node $node completed at $ts but not working\n";
- }
- }
- }
- my $p;
- my $tpm = 0;
- for ($p=1; $p <= $#probmults; ++$p) {
- my $m = $probmults[$p];
- $tpm += $m;
- my $r = $moduli[$p];
- my $lr = int(log($r)/log(2))+1;
- my $l = log($m*1000000)/log(2);
- my $k = $m*1000000/sqrt($r);
- printf "%4d %15.1f Mmults = 2^%.1f = %10.2f * sqrt(r_%d)\n",
- $p, $m, $l, $k, $lr;
- if ($p == $probend[0]->[0]) {
- printf "\n%4s %15.1f Mmults = 2^%.1f\n\n", $probend[0]->[1],
- $tpm, log($tpm*1000000)/log(2);
- $tpm = 0;
- shift @probend;
- }
- }
- printf "\n tot %15.1f Mmults = 2^%.1f\n",
- $totMmults, log($totMmults*1000000)/log(2);
|