/mobile Handheld Friendly website
Ubuntu : Intel® Q6600® quad-core |
Each table row shows performance measurements for this Perl program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 500 | 8.76 | 2.36 | 4,568 | 846 | 97% 97% 97% 98% |
| 3,000 | 328.34 | 82.77 | 6,776 | 846 | 100% 99% 99% 100% |
| 5,500 | 1,068.38 | 269.36 | 7,976 | 846 | 100% 99% 99% 100% |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read spectral-norm benchmark to see what this program should do.
This is perl 5, version 18, subversion 0 (v5.18.0) built for i686-linux-thread-multi
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_ITHREADS
USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO
USE_PERL_ATOF USE_REENTRANT_API
# The Computer Language Benchmarks Game # http://benchmarksgame.alioth.debian.org/ # # Contributed by Andrew Rodland use strict; use IO::Select; our ($n, $size_of_float, $threads, @ranges, $begin, $end); sub eval_A { use integer; my $div = ( ($_[0] + $_[1]) * ($_[0] + $_[1] + 1) / 2) + $_[0] + 1; no integer; 1 / $div; } sub multiplyAv { return map { my ($i, $sum) = ($_); $sum += eval_A($i, $_) * $_[$_] for 0 .. $#_; $sum; } $begin .. $end; } sub multiplyAtv { return map { my ($i, $sum) = ($_); $sum += eval_A($_, $i) * $_[$_] for 0 .. $#_; $sum; } $begin .. $end; } sub do_parallel { my $func = shift; my @out; my (@fd, @ptr, %fh2proc); for my $proc (0 .. $threads - 1) { ($begin, $end) = @{ $ranges[$proc] }; my $pid = open $fd[$proc], "-|"; if ($pid == 0) { print pack "F*", $func->( @_ ); exit 0; } else { $fh2proc{ $fd[$proc] } = $proc; $ptr[$proc] = $begin; } } my $select = IO::Select->new(@fd); while ($select->count) { for my $fh ($select->can_read) { my $proc = $fh2proc{$fh}; while (read $fh, my $data, $size_of_float) { $out[ $ptr[$proc] ++ ] = unpack "F", $data; } $select->remove($fh) if eof($fh); } } return @out; } sub multiplyAtAv { my @array = do_parallel(\&multiplyAv, @_); return do_parallel(\&multiplyAtv, @array); } sub num_cpus { open my $fh, '</proc/cpuinfo' or return; my $cpus; while (<$fh>) { $cpus ++ if /^processor\s+:/; } return $cpus; } sub init { $size_of_float = length pack "F", 0; $n = @ARGV ? $ARGV[0] : 500; $threads = num_cpus() || 1; if ($threads > $n) { $threads = $n; } for my $i (0 .. $threads - 1) { use integer; $ranges[$i][0] = $n * $i / $threads; $ranges[$i][1] = $n * ($i + 1) / $threads - 1; no integer; } } init(); my @u = (1) x $n; my @v; for (0 .. 9) { @v = multiplyAtAv( @u ); @u = multiplyAtAv( @v ); } my ($vBv, $vv); for my $i (0 .. $#u) { $vBv += $u[$i] * $v[$i]; $vv += $v[$i] ** 2; } printf( "%0.9f\n", sqrt( $vBv / $vv ) );
Wed, 22 May 2013 11:15:18 GMT COMMAND LINE: /usr/local/src/perl-5.18.0/bin/perl spectralnorm.perl-3.perl 5500 PROGRAM OUTPUT: 1.274224153