We described the various message-passing programming options and defined the distinction processes and processors, outlining the SPMD programming model.
Our first program is of course Hello World!. A screenshot of the session goes as follows:
prompt] mpicc hello.c -o hello prompt] mpirun -np 10 hello Hello world from processor 0 out of 10. Hello world from processor 2 out of 10. Hello world from processor 4 out of 10. Hello world from processor 8 out of 10. Hello world from processor 6 out of 10. Hello world from processor 1 out of 10. Hello world from processor 7 out of 10. Hello world from processor 5 out of 10. Hello world from processor 3 out of 10. Hello world from processor 9 out of 10. prompt]We illustrated the broadcast with broadcast_integer.c and broadcast_doubles.c. Note that, as we are working in a distributed memory computer, every node (not just the manager node) must allocate memory for the array of doubles.
Bibliography