Each process initializes a one-dimensional array by giving to all the elements the value of its rank+1. Then the root process (task 0) performs two reduce operations (sum and then product) to the arrays of all the processes. Finally, each process generates a random number and root process finds (and prints) the maximum value among these random values.
Modify the code to perform a simple scalability test using MPI_Wtime. Notice what happens when you go up with the number of processes involved.
HINTS: |
|
C |
|
MPI_REDUCE |
|
MPI_INIT |
|
MPI_COMM_SIZE | |
MPI_COMM_RANK |
|
MPI_FINALIZE |
|
MPI_WTIME |
|
|
|
MPI_REDUCE |
|
MPI_INIT |
|
MPI_COMM_SIZE |
MPI_COMM_SIZE(COMM, SIZE, IERROR) |
MPI_COMM_RANK |
MPI_COMM_RANK(COMM, RANK, IERROR) |
MPI_FINALIZE |
|
MPI_WTIME |