mpiprofile - Profile parallel communication and execution times - MATLAB (original) (raw)

Profile parallel communication and execution times

Syntax

mpiprofile mpiprofile on <options> mpiprofile off mpiprofile reset mpiprofile viewer mpiprofile resume mpiprofile clear mpiprofile status stats = mpiprofile('info') mpiprofile('viewer',stats)

Description

mpiprofile enables or disables the parallel profiler data collection on a MATLAB® worker running in a parallel pool. You can use mpiprofile either from the MATLAB client or directly from the worker from within an spmd block. When you run mpiprofile from the MATLAB client, mpiprofile performs the action on the MATLAB workers.

mpiprofile aggregates statistics on execution time and communication times. mpiprofile collects statistics in a manner similar to running the profile command on each MATLAB worker. By default, the parallel profiling extensions include array fields that collect information on communication with each of the other workers.

mpiprofile on <options> starts the parallel profiler and clears previously recorded profile statistics.

mpiprofile takes the following options.

Option Description
-messagedetail default-messagedetail simplified-messagedetail off This option specifies the detail at which communication information is stored. -messagedetail default collects information on a per-worker instance. -messagedetail simplified turns off collection for *PerLab data fields, which reduces the profiling overhead. If you have a very large cluster, you might want to use this option; however, you will not get all the detailed inter-worker communication plots in the viewer.Note that changing -messagedetail will clear any previously stored data.For information about the structure of returned data, see mpiprofile info below.
-history-nohistory-historysize mpiprofile supports these options in the same way as the standard profile.No other profile options are supported by mpiprofile. These three options have no effect on the data displayed by mpiprofile viewer.

mpiprofile off stops the parallel profiler. To reset the state of the profiler and disable collecting communication information, use mpiprofile reset.

mpiprofile reset turns off the parallel profiler and resets the data collection back to the standard profiler. If you do not call reset, subsequent profile commands will collect MPI information.

mpiprofile viewer stops the profiler and opens the graphical profile browser with parallel options. The output is an HTML report displayed in the profiler window. The file listing at the bottom of the function profile page shows several columns to the left of each line of code. In the summary page:

mpiprofile resume restarts the profiler without clearing previously recorded function statistics.

mpiprofile clear clears the profile information.

mpiprofile status returns the status of the parallel profiler.

stats = mpiprofile('info') stops the parallel profiler and returns a structure containing the profiler statistics. stats contains the same fields as returned by profile('info'), with the following additional fields in the FunctionTable entry. All these fields are recorded on a per-function and per-line basis, except for the *PerLab fields.

Field Description
BytesSent Records the quantity of data sent
BytesReceived Records the quantity of data received
TimeWasted Records communication waiting time
CommTime Records the communication time
CommTimePerLab Vector of communication receive time for each worker
TimeWastedPerLab Vector of communication waiting time for each worker
BytesReceivedPerLab Vector of data received from each worker

The three *PerLab fields are collected only on a per-function basis, and you can turn them off by typing the following command:

mpiprofile on -messagedetail simplified

When you run it from the MATLAB client, stats = mpiprofile('info') returns information from all workers. When you run it on a worker, mpiprofile('info') returns the profile information specific to that worker.

mpiprofile('viewer',stats) opens the graphical profile browser showing the profiling information contained in stats. You can use stats = mpiprofile('info') on the client to create the structure array.

mpiprofile does not accept -timer clock options, because the communication timer clock must be real.

For more information and examples on using the parallel profiler, see Profiling Parallel Code.

Examples

collapse all

Profile Parallel Code

Turn on the profiler. With default preferences, turning on the profiler will create a parallel pool automatically if there is not one already created.

Run your parallel code.

A = rand(1000,'distributed'); b = sum(A, 2); x = A\b;

Show the collected profile information.

Analyze Parallel Profiler Data

The parallel profiler collects information about the execution of code on each worker and the communications between the workers. After you profile your parallel code with mpiprofile, start the graphical viewer by calling mpiprofile viewer.

R = rand(1e3,'distributed'); mpiprofile on R = R*R; mpiprofile viewer

The viewer has three types of pages or views.

The parallel profile viewer, opens with the Function Summary Report first, in the same way as the standard profiler. In this view you can see profile information from any single lab or from multiple labs simultaneously. It initially shows all functions executed on lab 1. You can then choose via the listbox options to see profiling information from any lab.

In this view you can see Aggregate information using the Manual Comparison Selection listboxes. When you select an Aggregate in this view, the profiler accumulates and displays the specified data about all of the executed functions. For example,

The Manual Comparison Selection listbox, showing the comparison options min total time, min comm time, min time >0 aggregate, max total time, max comm time, and max time aggregate.

Here are a few things to keep in mind in this view:

The Function Detail Report displays information on the individual lines executed inside the current function for each lab. This includes a Busy Lines table which can be used to compare the top five lines of code on different labs. This report is only fully functional if the profiled MATLAB files are available on the client MATLAB path.

The Function Detail Report is different from the Function Summary Report in several ways:

The Plot View is shown whenever you click a plot option in the Show Figures listbox. The plots show communication and timing information from all the labs for the given function. There are two types of plots (Histograms and Per Worker Images). The Plot Time Histograms and Plot All Per Worker Communication options show three figures using the corresponding communication fields returned by the mpiprofile info command.

Plotting Per Function or Per Session

There are two modes for the plots:

You can always tell which plot mode you are using by looking at the titles of each figure. The titles show the name of the current function (or all functions when showing data for the entire session). The titles also include the name of the profiling field being displayed (e.g., Communication Time, Total Time). If you want to see the data for the entire profiling session after having selected a specific function, click Home to go back to the Function Summary Report then select your desired plot (using the listbox shown below).

The Show Figures (all workers) listbox showing the no plot, plot time histograms, plot all per worker communication, and plot communication time per worker options.

Version History

Introduced in R2007b