<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=ks_c_5601-1987">
<STYLE>.hmmessage P {
PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
BODY.hmmessage {
FONT-SIZE: 9pt; FONT-FAMILY: ±¼¸²
}
</STYLE>
<META content="MSHTML 6.00.2900.3492" name=GENERATOR></HEAD>
<BODY class=hmmessage>
<DIV dir=ltr align=left><SPAN class=721303323-16022009><FONT face=Arial
color=#0000ff size=2>Are you sure that MPI was using the TCP layer over the same
interconnect? Otherwise it could be using a custom driver and/or hardware
to provide faster messaging. If it is the same interconnect and path
through TCP, then wouldn't the delay be due to the VM
scheduling?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=721303323-16022009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=721303323-16022009><FONT face=Arial
color=#0000ff size=2>Kilim might also require investigation on the Java side of
things (since they claim to be faster than Erlang):</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=721303323-16022009><FONT face=Arial
color=#0000ff size=2><A
href="http://www.malhar.net/sriram/kilim/">http://www.malhar.net/sriram/kilim/</A></FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> erlang-questions-bounces@erlang.org
[mailto:erlang-questions-bounces@erlang.org] <B>On Behalf Of </B>ext
KangMikyung<BR><B>Sent:</B> Friday, February 13, 2009 12:34 PM<BR><B>To:</B>
erlang-questions@erlang.org<BR><B>Subject:</B> [erlang-questions] beginner:
Message Passing Overhead in Erlang<BR></FONT><BR></DIV>
<DIV></DIV>Dear All,<BR><BR>When I tested pingpong test, Erlang takes long time
even though the data size is 0/1/2/4/8 bytes.<BR>MPI takes around 0.0025
microseconds/iteration when the data size 0/1/2/4/8 bytes.<BR>However Erlang
takes around 0.5 microseconds/iteration at least. (within one core)<BR><BR>I
tried to find the underlying reasons that there is higher overhead involved in
message passing in Erlang when compared to MPI,<BR>but I couldn't find it yet at
"The erlang-questions Archives".<BR><BR><B>How can we explain the situation that
Erlang takes long time even though the data size is very small (e.g. 0 or
1)?</B><BR><B>Why the communication overhead is very big?</B> When the data size
is 16KB, Erlang was slower than MPI at least thousands time.<BR><B>Where can I
find the explanation?</B><BR><BR>Also I tested two pingpong case: (1) with
data('a') and (2) without data.<BR>(1) takes 0.336 us, but (2) takes
0.0000000059 us. It's very different.<BR>Can we tell initial data related setup
takes long
time?<BR><BR>Thanks,<BR>Mikyung<BR><BR><BR>(1)<BR>-module(tut15).<BR>-export([run/0]).<BR><BR>-include("imb.hrl").<BR><BR>ping(0,
_, _) -><BR> done;<BR><BR>ping(R, D, Pong)
-><BR> Pong ! {self(), D},<BR>
receive<BR> {Pong, D}
-><BR> ping(R - 1! , D, Pong)<BR>
end.<BR><BR>pong() -><BR>
receive<BR> {From, D} ->
<BR> From !
{self(), D},
<BR>
pong()<BR> end.<BR><BR>run() -><BR> R =
1000,<BR> D = 'a', %D = "abcdefghij",<BR>
Pong = spawn(fun()-> pong() end),<BR> TimeStart =
imb:time_microseconds(),<BR> ping(R, D, Pong),<BR>
TimeEnd = imb:time_microseconds(),<BR> io:format("Time in microseconds:
~p~n", [TimeEnd -
TimeStart]).<BR><BR><BR><BR>(2)<BR>-module(tut15).<BR>-export([start/0, ping/2,
pong/0]).<BR><BR>-include("imb.hrl").<BR><BR>ping(0, Pong_PID)
-><BR> Pong_PID ! finished;<BR><BR>ping(N, Pong_PID)
-><BR> Pong_PID ! {ping, self()},<BR>
receive<BR> pong -><BR>
ping(N - 1, Pong_PID)<BR>
end.<BR><BR>pong() -><BR>
receive<BR> {ping, Ping_PID}
-><BR>
Ping_PID !
pong,<BR>
pong()<BR> end.<BR><BR>start() -><BR> TimeStart =
imb:time_microseconds(),<BR> Pong_PID = spawn(tut15, pong,
[]),<BR> spawn(tut15, ping, [1000, Pong_PID]),<BR>
TimeEnd = imb:time_microseconds(),<BR> io:format("Time in microseconds:
~p~n", [TimeEnd - TimeStart]).<BR><BR><BR>**<BR><PRE>time_microseconds() -><BR> {MS, S, US} = now(),<BR> (MS * 1.0e+12) + (S * 1.0e+6) + US.<BR></PRE><BR><BR>
<HR>
°·ÂÇØÁø º¸¾È¼º, ¾Æ¿ô·èÀ» ´à¾Æ Æí¸®ÇØÁø ±â´Éµé·Î ¹«ÀåÇÑ Windows Live Hotmail! <A
href="http://www.hotmail.com" target=_new>¶ß°Å¿î ¸ÞÀÏ ÇÖ¸ÞÀÏ, Windows Live Hotmail·Î
µ¹¾Æ¿À´Ù!</A> </BODY></HTML>