[erlang-questions] Idle question

French, Mike <>
Fri Nov 27 13:23:18 CET 2009

Idle Thoughts of an Idle Fellow (and Erlang novice) ....

> -----Original Message-----
> > On 24/11/09 Richard O'Keefe wrote:
> >> Suppose Erlang were available on BlueFern
> >> (the BlueGene machine at the University of Canterbury,
> >> see http://www.bluefern.canterbury.ac.nz/ ).  
> >> What would you use it for?  
> >> What science or technology would it advance?

Erlang should have a good headstart for parallel processing 
because of the usual suspects: share nothing process isolation,
message passing and asynchronicity (as Jung would have called it, 
had he been an Erlang hacker - Jungerl ?)

But Erlang is also bad for HPC because of:
 - no dense numerical data structures with pointer arithmetic:
   vectors, matrices, multidimensional arrays
 - memory overhead for lists, hence also for strings,
   so no dense character data structure with pointer arithmetic
   (implement string processing over binaries ?!)
 - no mutable in-place (zero-copy) data structures 
   even when isolated in a single process thread of control
 - message copy overhead even when local (except large binaries)
 - no control over process locality ?

So I conclude that dense numerical computation in Erlang  
will always be slower than C, C++, Fortran, ... Fortress ?

I also conclude that if Erlang is just used for coordination of 
compute processes implemented in other languages, then extra copies 
required by Erlang message passing will always be slower than just 
using MPI directly between the compute processes ?

So what is Erlang good for in the HPC arena ?

A suggestion would be to avoid problems that need tight computational 
inner loops over multi-dimensional arrays, and look for problems requiring:
 - complex decisions (conditionals in your loops)
 - across uncorrelated pathways (no advantage for dense structures)
 - over arbitrary graphs of data (communicating processes are graphs)

A place to start would be to look at the 13 Dwarfs (should be Dwarves!)
which are patterns of computation extracted from common HPC problems:


Then follow the related architectural design process outlined here:

(best overall summary slide is 23/75)

and mark Erlang on its strengths and weaknesses 
as you make decisions about HPC design patterns.

When you come across ... task decomposition, arbitrary task graph, 
event-based, pipe and filter, graph algorithms, dynamic programming, 
map-reduce, graph traversal, finite state machines, divide & conquer, 
backtrack branch & bound, task parallelism, discrete event, pipeline,
master/worker, CSP, message passing .... then Erlang has potential.

Notice how Erlang is better 'above the line' in the Productivity Layer
rather than 'below the line' in the Efficiency Layer.

Of course, it would also be fun to speculate how Erlang could be 
improved with dense multidimensional arrays, zero copy local messages,
mutation BIFs (like HiPE hacks), SIMD map and fold, etc.
... but maybe it wouldn't be Erlang any more.



Thales UK Ltd (Wells) DISCLAIMER: The information contained in this e-mail
is confidential. It may also be legally privileged. It is intended only for
the stated addressee(s) and access to it by any other person is
unauthorised. If you are not an addressee, you must not disclose, copy,
circulate or in any other way use or rely on the information contained in
this e-mail. Such unauthorised use may be unlawful. We may monitor all
e-mail communications through our networks. If you have received this e-mail
in error, please inform us immediately on sender's telephone number above
and delete it and all copies from your system. We accept no responsibility
for changes to any e-mail which occur after it has been sent.  Attachments
to this e-mail may contain software viruses which could damage your system.
We therefore recommend you virus-check all attachments before opening.
Thales UK Ltd. Registered Office: 2 Dashwood Lang Road, The Bourne Business
Park, Addlestone, Weybridge, Surrey KT15 2NX Registered in England No.

More information about the erlang-questions mailing list