Next: Dividing the Pie
Up: Greetings, Master
Previous: Greetings, Master
- 1
- Modify program
greetings discussed in section 5.2.2 so
that the master process receives the messages not
out of order but in the order that agrees with the ranking of the
senders.
- 2
- Write an MPI program in which processes fill their send buffers
with random integers instead of greeting strings. Make the send
buffers (and the corresponding receive buffer of the master process)
1,048,576 integers long. Make the master process append the
received strings of random integers to an external file, the way
that the program
mkrandfile discussed in section
3.4.3worked.
- Hint
- You will have to replace
MPI_CHAR with MPI_INT
in MPI_Send and MPI_Recv. Remember that
the length of send and receive buffers must be given
in terms of the number of items of a type specified by
the next argument, not in bytes.
- Hint
- Use the process rank number so that a different
seed for function
srand is generated within
each MPI process. Otherwise they will all generate
identical strings of pseudo-random integers.
- Hint
- Do not make the master process generate any numbers.
It will be busy enough collecting data and writing the file.
Next: Dividing the Pie
Up: Greetings, Master
Previous: Greetings, Master
Zdzislaw Meglicki
2004-04-29