[erlang-questions] MPI and Erlang. (fun experiment)

Ale <>
Fri Jun 17 05:07:21 CEST 2011

Hello all,

Just sharing with whom might ever be interested, a fun (for me, might
not be for you) experiment. I tried to port a MPI implementation of
Simpson's rule[0], I had made for a course in HPC, to Erlang. I wasn't
expecting Erlang to beat C... but, well see the results:

MPI: https://github.com/alep/Experiments/blob/master/simpson/c-mpi/simpsons_rule_mpi.c
$ time mpirun -np 2 mpisimpson 0 10 100000000
's password:
proc[0]: iterating from: 0 to: 50000000
proc[0]: result: 1.83907152907611348702
proc[1]: iterating from: 50000000 to: 100000000

real 0m7.016s
user 0m3.288s
sys 0m0.072s

Erlang:  https://github.com/alep/Experiments/blob/master/simpson/erlang/simpsonrule.erl
$ time ./run.sh
Hostname: dell-desktop
Proc[0]: iterating from 0 to 50000000
Proc[1]: iterating from 50000000 to 100000000
Result: 1.8390715290761146

real 0m25.047s
user 0m22.713s
sys 0m0.116s

FAIL! :-D But it was fun.

Now is there a way to make it a bit faster? What am I doing wrong? How
can I improve it? Ideas....? Thanks

[0] http://en.wikipedia.org/wiki/Simpson%27s_rule

More information about the erlang-questions mailing list