Before you compile fourth.c you should edit the file and change the name of the log file, which the worker processes will open in their ``/tmp'' directories, to something more suitable for your system. In this program the name of the log file is hardwired -- not an elegant procedure in general, but simple enough to fit on one line of code.
Search for the line:
log_file = fopen ("/tmp/gustav_log", "w");and change
"/tmp/gustav_log"
, for example to
"/tmp/<whatever your login name is>_log"
. The name of the file
should be unique to your uid, in case more than one user
works with this tutorial on the same system at the same time. You must
also write that file in /tmp
, so that processes running on
different machines would not overwrite one another's log files.
In particular, do not
open the log file in your home directory, if it is mounted on other
machines participating in the farm under the same name.
After you have modified fourth.c, compile it as follows:
gustav@jupiter:~/mpi/simplempi 241 $ hcc -o fourth fourth.c -lmpi gustav@jupiter:~/mpi/simplempi 242 $
Running fourth.c will produce a copious amount of output. For this reason we shall discuss it in a separate section.