next up previous
Next: fifth.c in detail Up: Lesson 4 -- Previous: The synopsis of

Compiling and running fifth.c under LAM

In order to compile fifth.c type

<mpi 235 $ hcc -o fifth fifth.c -lmpi /usr/ucblib/libucb.a
gustav@jupiter:~/mpi/simplempi 236 $

Observe that my bash command line scrolled to the left, as the input line became longer. This time we also link the program with /usr/ucblib/libucb.a in order to attach the BSD function random(). This will work under Solaris 2.3, but you may have to modify this compilation procedure if you have a different system.

To run the program type:

gustav@jupiter:~/mpi/simplempi 238 $ mpirun -w N `pwd`/fifth -- `uname -n`
Greetings to the master (jupiter, 5) from (cisr, 0)
Greetings to the master (jupiter, 5) from (mercury, 1)
Greetings to the master (jupiter, 5) from (venus, 2)
Greetings to the master (jupiter, 5) from (earth, 3)
Greetings to the master (jupiter, 5) from (mars, 4)
Greetings to the master (jupiter, 5) from (saturn, 6)
Greetings to the master (jupiter, 5) from (uranus, 7)
Greetings to the master (jupiter, 5) from (bacchus, 8)
Greetings to the master (jupiter, 5) from (ceres, 9)
Greetings to the master (jupiter, 5) from (diana, 10)
Greetings to the master (jupiter, 5) from (minerva, 11)
Greetings to the master (jupiter, 5) from (vesta, 12)
epsilon = 0.0001
pi =  3.14161904761904775000
points: 126000
in: 98961, out: 27039
gustav@jupiter:~/mpi/simplempi 239 $



Zdzislaw Meglicki
Tue Feb 28 15:07:51 EST 1995