Tom Kelliher, CS 325
30 points, due Feb. 8, 2012
The objective of this assignment is to continue your familiarization with the Open MPI system on the condor cluster. I suggest that you create a separate folder on condor for working on this assignment.
hello1.c
source program. Compile it using
mpicc
:
mpicc -o hello1 hello1.cand run four instances of it:
mpirun -n 4 hello1Note that each process prints its own message. Take a screenshot of the program's output (see below).
Run the program a few times. Note that the order of the messages changes from run to run. Explain.
hello1.c
so that the the slave processes send their rank
to the master process, which prints a ``Hello message'' on their behalf.
(The slave processes will no longer print anything.) The program output
should look something like:
Master: Hello slaves, give me your messages. Message received from process 1: Hello back. Message received from process 2: Hello back. Message received from process 3: Hello back.Hint: use C's
sprintf()
function to convert rank
, which is an
integer, to a string. Alternatively, modify the MPI_Send()
and
MPI_Recv
calls to send/receive an integer.
Again, run four processes and take a screenshot of the program's output.
Master: Hello slaves, give me your messages. Message received from process 1: Hello, I am John. Message received from process 2: Hello, I am Mary. Message received from process 3: Hello, I am Susan.
Again, run four processes and take a screenshot of the program's output.
Write an Open MPI program in which the master process sends a single
integer to the (one) slave process, which immediately sends the integer
back to the master. The master process should record the current time
(using MPI_Wtime()
) just before it sends its message, then record
the current time as soon as it has received the message from the slave
process, then print the elapsed time.
Run this program using a hostfile (see the documentation for mpirun
to learn how to do so) with these two lines:
condor condorRun the program several times and calculate the average elapsed time.
Repeat using a hostfile with these two lines:
condor n0Comment on any differences in the elapsed times.
The easiest way of taking a screenshot is to use ``Take Screenshot'' under the Accessories menu. That will save your screenshot as a PNG file, which you can insert into an MS Word document. For more control, you could use ``The Gimp'' (GNU Image Manipulation Program) under the Graphics menu.
Prepare a document showing that you successfully completed all parts of the assignment. This document will include your screenshots, answers to questions posed in the assignment, and your properly documented source code. This document should be emailed to me by the start of class on the 8th.
Condor has OpenOffice Writer installed (look under the Office menu). It is quite similar in operation to MS Word, before Microsoft introduced the ``Ribbon.'' I would suggest you use Writer to prepare your assignment document. One note of caution: By default, Writer saves documents in ODF format. I would suggest you use ``Save As'' and save your document in MS Word (DOC) format.