next up previous
Next: About barrier synchronisation Up: third.cor second.c Previous: The listing of

Compilation and running of third.c

In order to compile third.c type

gustav@jupiter:~/mpi/simplempi 228 $ hcc -o third third.c -lmpi
gustav@jupiter:~/mpi/simplempi 229 $
To run it type:
gustav@jupiter:~/mpi/simplempi 245 $ mpirun -w N `pwd`/third -- `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)
Enter the number of intervals: (0 quits) 100000
pi is approximately 3.1415926535981265
computation time 0.0446860790252686
communication time 0.2531449794769287
Enter the number of intervals: (0 quits) 1000000
pi is approximately 3.1415926535898757
computation time 0.4425549507141113
communication time 1.1623179912567139
Enter the number of intervals: (0 quits) 10000000
pi is approximately 3.1415926535897714
computation time 4.1224819421768188
communication time 11.3426218032836914
Enter the number of intervals: (0 quits) 0
gustav@jupiter:~/mpi/simplempi 246 $

Observe that this time we have modified the logic of the program somewhat, so that now we can repeat the computations without having to go through selection of the master process. The program also times both computations and communication operations.



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