[erlang-questions] Clarify: HiPE auto-spawning?
Richard Carlsson
richardc@REDACTED
Fri Nov 16 14:39:58 CET 2007
Philip Robinson wrote:
> Does HiPE automatically spread (spawn) a program across multiple cores?
Apart from the semantic differences, as explained by Kostis and Mikael,
it is also a question of how to make the compiler realise when it will
actually pay off to perform some tasks in parallel. Assuming that it
has been able to figure out that the tasks *can* be run in parallel,
i.e., it is sure that they do not interfere with each other and can
be executed in any order (usually only possible for straightforward
side effect free calculations), it still has to be *sure* that in any
case, the program will *not behave worse* if these tasks are parallelized.
Since this is typically very much dependent on the actual values of
variables at run-time (numbers, lengths of lists, size of trees, etc.),
it is rarely the case that you can do this at compile time. After all,
spawning processes and collecting the results will always have some
overhead (especially if data has to be copied between processes).
Using data from profiling could help guide a compiler, though. But in
general, this is not something you should expect any compiler to do for you
except for limited problems like parallelizing number crunching in Fortran.
For the forseeable future, you will have to profile your application and
manually parallelize those parts where it will help, regardless of which
language you are coding in.
/Richard
More information about the erlang-questions
mailing list