General Comments about Homework 1 All Problems Some students had not yet access to an MPI machine. Naming of files was all over the place. Some produced sub-directories. Please, follow the guidelines. I use scripts to unpack your work to help me expedite the process. When I ask for just a function like My_Comm_size(). It must compile like this: mpicc -Wall -c ex_01.c so I can link it with my test program. Some students did not use the ex_01.c, etc. naming scheme. My scripts expect that, and I have to do extra work if you don't follow the assignment description. (I don't like extra work ;-) Also, your file must include mpi.h and any other include files, such as stdio.h or unistd.h that you need to compile your program. This is also true for assignments where you turn in only a function. Many of the programs compile with warnings. Use -Wall to get rid of them! Some students had poor indentation. Be consistent and make your code readable. Some codes did not compile! I fixed them when I could do so quickly. Starting with homework 3, anything that does not compile goes back un-graded! Some codes caused segmentation fault. That's bad! When you use non-blocking communication, you need to finish ALL of them with an MPI_Wait*() or MPI_Test*() to clear out the request. You must do some basic input checking. If the problem says to read the command line and during testing nothing is given on the command line, then you should abort cleanly and print an error message. Homeworks are not collaborative! If you need help, ask me, but don't blindly copy code from your fellow students. (Especially when it is broken code!) When you do a non-blocking send and immediately MPI_Wait for it, you might as well use MPI_Send(); it saves code with the same result. Problem 1 This one was difficult. Students who attend class and paid attention to the hints I gave for this problem were usually able to solve it. If you turned anything in, a non-working program, or a description of how you might try to solve it, you got 5 points. Problem 2 Mostly no problem at all. Some students had a many-to-one pattern which we need to avoid. Some students retained the sleep(1) from my example program. Feel free to use my example programs, but get rid of everything that you don't need for the assignment; e.g. unused variables. Problem 3 Some students assumed the string submitted to print_string() is the same on all nodes. If that were the case, communication would not really be necessary... Some students allocated nproc * 1024 bytes of storage. That is too much, since rank 0 gets at most 1024 bytes at a time. Problem 4 Most programs assume both tokens travel equally fast. Each node waits for one token and then the other. If the first token went around and arrived before the second token, it would be stalled until the second token arrives. Look at ex_phello.c for an example on how to read command line arguments in Unix. Best solution is to have one receive (can be blocking). When one of the tokens comes in, figure out which direction it is traveling, and send it on. Problem 5 Measuring is hard! ;-) Some students assumed MPI_Wtime resolution is fine enough to measure one round-trip. Putting the starting and ending of the timer outside the loop is probably better. Measuring how long it takes to send a message is not enough. You really need to measure a ping/pong and divide by two. Some people used ex_wait.c as an example. That example does not measure what was required for this exercise.