|
Assignment
Your assignment is to use TotalView to locate
an error in the following program.
This is a 4-processor MPI example. It uses gather
for process 1 ( root = 1) to collect the results from the individual process. It does
not produce correct results.
The correct output is:
0 0 204 204 408 408 612 612
Details
cut and paste the code into the file gather.c
icc -g -lmpi -o gather gather.c
mpirun -np 4 ./gather
Tips
- Launch Totalview with:
totalview mpirun -a -np 4 ./gather
A solution
It has been a common mistake that in the use of MPI_gather function
one sets the receive account is n times of the send count, where n
is the number of processes (n=4 in this example) when no derived
datatype is used. For the simple datatype used in this example,
rcound should be equal to scount.
|