performance measurements

Each table row shows performance measurements for this Erlang HiPE program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
5001.111.1113,480507  4% 94% 1% 3%
3,00035.1235.1213,972507  1% 0% 100% 1%
5,500114.35114.3831,488507  0% 100% 0% 1%

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.

 notes

Erlang/OTP 17 [erts-6.2] [source] [async-threads:10] [hipe] [kernel-poll:false]

 spectral-norm Erlang HiPE program source code

% The Computer Language Benchmarks Game
% http://benchmarksgame.alioth.debian.org/
%   contributed by Isaac Gouy (Erlang novice)

-module(spectralnorm).
-export([main/1]).

main([Arg]) ->
    N = list_to_integer(Arg),
    {U,V} = powerMethod(N,10, array(1.0,N,[]), array(0.0,N,[]) ),
    io:format("~.9f\n",[ loop(N,U,V,0.0,0.0) ]),
    erlang:halt(0).

% eigenvalue of V
loop(0,_,_,VBV,VV) -> math:sqrt(VBV/VV);
loop(I,U,V,VBV,VV) -> 
   VI = element(I,V),
   loop(I-1,U,V, VBV + element(I,U)*VI, VV + VI*VI).

% 2I steps of the power method
powerMethod(_,0,A,B) -> {A,B};
powerMethod(N,I,A,B) -> 
   V = atav(N,A,B), 
   U = atav(N,V,A),
   powerMethod(N,I-1,U,V).

% return element i,j of infinite matrix A
a(II,JJ) ->
   I = II-1.0, J = JJ-1.0,
   1.0/((I+J)*(I+J+1.0)/2.0 +I+1.0).

% multiply vector v by matrix A
av(_,0,_,AV) -> AV;
av(N,I,V,AV) -> 
   av(N,I-1,V, setelement(I,AV, avloop(N,I,V,0.0) )).

avloop(0,_,_,X) -> X;
avloop(J,I,V,X) -> 
   avloop(J-1,I,V, X + a(I,J)*element(J,V) ).

% multiply vector v by matrix A transposed
atv(_,0,_,ATV) -> ATV;
atv(N,I,V,ATV) -> 
   atv(N,I-1,V, setelement(I,ATV, atvloop(N,I,V,0.0) )).

atvloop(0,_,_,X) -> X;
atvloop(J,I,V,X) -> atvloop(J-1,I,V, X + a(J,I)*element(J,V) ).

% multiply vector v by matrix A and then by matrix A transposed
atav(N,V,ATAV) ->
   atv(N,N, av(N,N,V,array(0.0,N,[])) ,ATAV).

% initialize a list and convert it to a tuple
array(_,0,L) -> list_to_tuple(L);
array(X,N,L) -> array(X,N-1,[X|L]).

 make, command-line, and program output logs

Wed, 26 Nov 2014 21:03:50 GMT

MAKE:
mv spectralnorm.hipe spectralnorm.erl
/usr/local/src/otp_src_17.3/bin/erlc +native +"{hipe, [o3]}"  spectralnorm.erl
rm spectralnorm.erl
0.60s to complete and log all make actions

COMMAND LINE:
/usr/local/src/otp_src_17.3/bin/erl -smp enable -noshell -run  spectralnorm main 5500

PROGRAM OUTPUT:
1.274224153

Revised BSD license

  Home   Conclusions   License   Play