[erlang-questions] [Fwd: Message passing benchmark on smp emulator]

Chandru chandrashekhar.mullaparthi@REDACTED
Tue Oct 24 19:16:14 CEST 2006


Hi,

I tried this benchmark on a 8-CPU (4 dual core) AMD Opteron server running
Solaris 10. Here are the results. It looks pretty good.

elastigirl:chandru 92 # /usr/local/otp_R11B-1/bin/erl -smp
Erlang (BEAM) emulator version 5.5.1 [source] [64-bit] [smp:8]
[async-threads:0]

Eshell V5.5.1  (abort with ^G)
1> big:bang(50).
16759                        % 16 ms
2> big:bang(100).
100620                       % 100 ms
3> big:bang(300).
927302                       % 927 ms
4> big:bang(500).
2384194                     % 2.4 secs
5> big:bang(600).
3780862                     % 3.8 secs
6> big:bang(700).
5359640                     % 5.3 secs
7> big:bang(800).
7995201                     % 8 secs
8> big:bang(900).
9918226                     % 9.9 secs
9> big:bang(1000).
14688772                   % 14.6 secs
11> big:bang(2000).
111368322                  % 111 secs

cheers
Chandru

On 07/03/06, Rickard Green <rickard.s.green@REDACTED> wrote:
>
> Trying again...
>
> -------- Original Message --------
> Subject: Message passing benchmark on smp emulator
> Date: Tue, 07 Mar 2006 17:30:40 +0100
> From: Rickard Green <rickard.s.green@REDACTED>
> Newsgroups: erix.mailing-list.erlang-questions
>
> The message passing benchmark used in estone (and bstone) isn't very
> well suited for the smp emulator since it sends a message in a ring
> (more or less only 1 process runnable all the time).
>
> In order to be able to take advantage of an smp emulator I wrote another
> message passing benchmark. In this benchmark all participating processes
> sends a message to all processes and waits for replies on the sent
> messages.
>
> I've attached the benchmark. Run like this:
> big:bang(NoOfParticipatingProcesses).
>
> I ran the benchmark on a machine with two hyperthreaded Xeon 2.40GHz
> processors.
>
> big:bang(50):
> * r10b completed after about 0.014 seconds.
> * p11b with 4 schedulers completed after about 0.018 seconds.
>
> big:bang(100):
> * r10b completed after about 0.088 seconds.
> * p11b with 4 schedulers completed after about 0.088 seconds.
>
> big:bang(300):
> * r10b completed after about 2.6 seconds.
> * p11b with 4 schedulers completed after about 1.0 seconds.
>
> big:bang(500):
> * r10b completed after about 10.7 seconds.
> * p11b with 4 schedulers completed after about 3.5 seconds.
>
> big:bang(600):
> * r10b completed after about 18.0 seconds.
> * p11b with 4 schedulers completed after about 5.8 seconds.
>
> big:bang(700):
> * r10b completed after about 27.0 seconds.
> * p11b with 4 schedulers completed after about 9.3 seconds.
>
> Quite a good result I guess.
>
> Note that this is a special case and these kind of speedups are not
> expected for an arbitrary Erlang program.
>
> If you want to try yourself download a P11B snapshot at:
> http://www.erlang.org/download/snapshots/
> remember to enable smp support:
> ./configure --enable-smp-support --disable-lock-checking
>
> You can change the number of schedulers used by passing the
> +S<NO_OF_SCHEDULERS> command line argument to erl or by calling:
> erlang:system_flag(schedulers, NoOfSchedulers) -> {ok|PosixError,
> CurrentNo, OldNo}
>
> /Rickard Green, Erlang/OTP
>
>
>
>
> %%%-------------------------------------------------------------------
> %%% File    : big.erl
> %%% Author  : Rickard Green <rickard.s.green@REDACTED>
> %%% Description : A simple message passing benchmark
> %%%
> %%% Created : 30 Dec 2005 by Rickard Green <rickard.s.green@REDACTED>
> %%%-------------------------------------------------------------------
> -module(big).
>
> -export([bang/1]).
>
> pinger([], [], true) ->
>     receive
>         {procs, Procs, ReportTo} ->
>             pinger(Procs, [], ReportTo)
>     end;
> pinger([], [], false) ->
>     receive {ping, From} -> From ! {pong, self()} end,
>     pinger([],[],false);
> pinger([], [], ReportTo) ->
>     ReportTo ! {done, self()},
>     pinger([],[],false);
> pinger([],[Po|Pos] = Pongers, ReportTo) ->
>     receive
>         {ping, From} ->
>             From ! {pong, self()},
>             pinger([], Pongers, ReportTo);
>         {pong, Po} ->
>             pinger([], Pos, ReportTo)
>     end;
> pinger([Pi|Pis], Pongers, ReportTo) ->
>     receive {ping, From} -> From ! {pong, self()}
>     after 0 -> ok
>     end,
>     Pi ! {ping, self()},
>     pinger(Pis, [Pi|Pongers], ReportTo).
>
> spawn_procs(N) when N =< 0 ->
>     [];
> spawn_procs(N) ->
>     [spawn_link(fun () -> pinger([],[],true) end) | spawn_procs(N-1)].
>
> send_procs([], Msg) ->
>     Msg;
> send_procs([P|Ps], Msg) ->
>     P ! Msg,
>     send_procs(Ps, Msg).
>
> receive_msgs([]) ->
>     ok;
> receive_msgs([M|Ms]) ->
>     receive
>         M ->
>             receive_msgs(Ms)
>     end.
>
> bang(N) when integer(N) ->
>     Procs = spawn_procs(N),
>     RMsgs = lists:map(fun (P) -> {done, P} end, Procs),
>     Start = now(),
>     send_procs(Procs, {procs, Procs, self()}),
>     receive_msgs(RMsgs),
>     Stop = now(),
>     lists:foreach(fun (P) -> exit(P, normal) end, Procs),
>     timer:now_diff(Stop, Start).
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20061024/c4a834b9/attachment.htm>


More information about the erlang-questions mailing list