[erlang-questions] Clarify: HiPE auto-spawning?

Philip Robinson <>
Fri Nov 16 13:01:14 CET 2007


Does HiPE automatically spread (spawn) a program across multiple cores?

For example, if I have a function:

test(A, B) ->
    {A + B, A * B}.

Will HiPE convert it into something like the following?

test(A, B) ->
    PidThis = self(),
    Pid1 = spawn(fun() -> PidThis ! {self(), A + B} end),
    Pid2 = spawn(fun() -> PidThis ! {self(), A * B} end),
    Tmp1 = receive {Pid1, Result1} -> Result1 end,
    Tmp2 = receive {Pid2, Result2} -> Result2 end,
    {Tmp1, Tmp2}.

I suspect not, but I cannot find any confirmation.  My Google-fu is
very weak this evening. :-/

Thanks in advance,
Philip



More information about the erlang-questions mailing list