Como tarea en un grupo de la facultad del que formo parte tenemos que resolver ejercicios de MPI, como yo algo de idea de MPI tengo decidí también resolverlos en erlang para seguir aprendiendo mas de este lenguaje, acá van los enunciados del primer ejercicio y las resoluciones de ambos.
Write a program that uses MPI and has each MPI process print
Hello world from process i of nusing the rank in MPI_COMM_WORLD for i and the size of MPI_COMM_WORLD for n. You can assume that all processes support output for this example.
-module(ej1).
-export([run/1]).
run(Total, Total) -> ok;
run(Count, Total) ->
spawn(fun() -> salute(Total) end),
run(Count + 1, Total).
run(Total) -> run(0, Total).
salute(Total) ->
io:format("Hello world from ~p of ~p~n", [self(), Total]).