/mobile Handheld Friendly website
Ubuntu : Intel® Q6600® one core |
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 |
|---|---|---|---|---|---|
| 500 | 0.61 | 0.62 | 7,864 | 507 | 0% 0% 3% 100% |
| 3,000 | 20.56 | 20.58 | 11,120 | 507 | 0% 0% 0% 100% |
| 5,500 | 59.14 | 59.16 | 13,652 | 507 | 0% 0% 0% 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.
Erlang R16B (erts-5.10.1) [source] [async-threads:10] [hipe] [kernel-poll:false]
% 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]).
Mon, 04 Mar 2013 23:11:52 GMT
MAKE:
mv spectralnorm.hipe spectralnorm.erl
/usr/local/src/otp_src_R16B_nosmp/bin/erlc +native +"{hipe, [o3]}" spectralnorm.erl
rm spectralnorm.erl
0.73s to complete and log all make actions
COMMAND LINE:
/usr/local/src/otp_src_R16B_nosmp/bin/erl -smp disable -noshell -run spectralnorm main 5500
PROGRAM OUTPUT:
1.274224153