/* find the global sum of the squares */
MPI_Reduce( &my_sum, &sum, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD ); /* let rank 0 compute the root mean square */
/* rank 0 broadcasts the RMS to the other nodes */
MPI_Bcast( &rms, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD ); /* perform filtering operation (contrast enhancement) */
/* gather back to rank 0 */
MPI_Gather( recvbuf, my_count, MPI_UNSIGNED_CHAR, pixels, my_count, MPI_UNSIGNED_CHAR, 0, MPI_COMM_WORLD );
/* write image to file */
MPI_Finalize();
}
This code uses collective operations (broadcast, scatter, reduce and gather) to employ multiple processes to perform operations on a image. For example, the figure below (Figure
|
|
|
original | processed image |
Figure 4-1: A ultrasound image before and after contrast enhancement
4.2 Tracing
Tracing enables features in Scali MPI Connect’s implementataion of MPI that report detail about the MPI calls. By capturing the printout of the tracing information the user can monitor the development of the application run, perform analysis of the application run, figure out how the application uses the communication mechanisms, and discover details that can be used to improve performance.
4.2.1 Using Scali MPI Connect built-in trace
To use
Trace beginning and end of each MPI_call | |
Start trace after <seconds> seconds | |
End trace after <seconds> seconds | |
Start trace after <calls>MPI_calls | |
End trace after <calls>MPI_calls | |
Special modes for trace | |
| <mode> = “sync”: Synchronize with MPI_Barrier before starting |
| the collective call |
Enable for process(es): 'n,m,o..' = (list) or |
Scali MPI Connect Release 4.4 Users Guide | 38 |