Scali MPI Connect Release 4.4 Users Guide 38
/* 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 4-1:) shows
the result of processing an ultrasonic image of a fetus.
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 built-in trace-facility you need to set the mpimon-option -trace “<options>”
specifying what options you want to apply. The following options can be specified: (<...-list>
is a semicolon-separated list of Posix-regular-expressions.)
-bTrace beginning and end of each MPI_call
-s <seconds> Start trace after <seconds> seconds
-S <seconds> End trace after <seconds> seconds
-c <calls> Start trace after <calls>MPI_calls
-C <calls> End trace after <calls>MPI_calls
-m <mode> Special modes for trace
<mode> = “sync”: Synchronize with MPI_Barrier before starting
the collective call
-p <selection> Enable for process(es): 'n,m,o..' = (list) or 'n-m' = (range) or 'all'
original processed image