mpiprofile
Profile parallel communication and execution times
Syntax
mpiprofile
mpiprofile on
mpiprofile off
mpiprofile resume
mpiprofile clear
mpiprofile status
mpiprofile reset
mpiprofile info
mpiprofile viewer
mpiprofile('viewer',
Description
mpiprofile
enables or disables the parallel profiler data collection on a MATLAB®worker running a communicating job.mpiprofile
aggregates statistics on execution time and communication times. The statistics are collected in a manner similar to running theprofile
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. This command in general should be executed in pmode or as part of a task in a communicating job.
mpiprofile on
starts the parallel profiler and clears previously recorded profile statistics.
mpiprofile
takes the following options.
Option | Description |
---|---|
|
This option specifies the set of functions for which profiling statistics are gathered. |
|
This option specifies the detail at which communication information is stored.
For information about the structure of returned data, see |
|
No other |
mpiprofile off
stops the parallel profiler. To reset the state of the profiler and disable collecting communication information, you should also callmpiprofile reset
.
mpiprofile resume
restarts the profiler without clearing previously recorded function statistics. This works only in pmode or in the same MATLAB worker session.
mpiprofile clear
clears the profile information.
mpiprofile status
returns a valid status when it runs on the worker.
mpiprofile reset
turns off the parallel profiler and resets the data collection back to the standard profiler. If you do not callreset
, subsequent profile commands will collect MPI information.
mpiprofile info
returns a profiling data structure with additional fields to the one provided by the standardprofile info
in theFunctionTable
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 |
记录数据的数量 |
TimeWasted |
Records communication waiting time |
CommTime |
Records the communication time |
CommTimePerLab |
Vector of communication receive time for each lab |
TimeWastedPerLab |
Vector of communication waiting time for each lab |
BytesReceivedPerLab |
Vector of data received from each lab |
The three*PerLab
fields are collected only on a per-function basis, and can be turned off by typing the following command in pmode:
mpiprofile on -messagedetail simplified
mpiprofile viewer
is used in pmode after running user code withmpiprofile on
. Calling the 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:
Column 1 indicates the number of calls to that line.
Column 2 indicates total time spent on the line in seconds.
Columns 3–6 contain the communication information specific to the parallel profiler
mpiprofile('viewer',
in function form can be used from the client. A structure
needs be passed in as the second argument, which is an array ofmpiprofile info
structures. SeepInfoVector
in the Examples section below.
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, seeProfiling Parallel Code.
Examples
In pmode, turn on the parallel profiler, run your function in parallel, and call the viewer:
mpiprofileon;% call your function;mpiprofileviewer;
If you want to obtain the profiler information from a communicating job outside of pmode (i.e., in the MATLAB client), you need to return output arguments ofmpiprofile info
by using the functional form of the command. Define your functionfoo()
, and make it the task function in a communicating job:
function[pInfo,yourResults] = foo mpiprofileoninitData = (rand(100, codistributor())...* rand(100,codistributor())); pInfo = mpiprofile('info'); yourResults = gather(initData,1)
After the job runs andfoo()
is evaluated on your cluster, get the data on the client:
A = fetchOutputs(yourJob);
Then view parallel profile information:
pInfoVector = [A{:,1}]; mpiprofile('viewer',pInfoVector);