Documentation

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

mpiprofileenables or disables the parallel profiler data collection on a MATLAB®worker running a communicating job.mpiprofileaggregates statistics on execution time and communication times. The statistics are collected in a manner similar to running theprofilecommand 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.

mpiprofiletakes the following options.

Option Description

-detail mmex

-detail builtin

This option specifies the set of functions for which profiling statistics are gathered.-detail mmex(默认)记录的信息功能,local functions, and MEX-functions.-detail builtinadditionally records information about built-in functions such aseigorlabReceive.

-messagedetail default

-messagedetail simplified

This option specifies the detail at which communication information is stored.

-messagedetail defaultcollects information on a per-lab instance.

-messagedetail simplifiedturns off collection for*PerLabdata 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-lab communication plots in the viewer.

For information about the structure of returned data, seempiprofile infobelow.

-history

-nohistory

-historysize

mpiprofilesupports these options in the same way as the standardprofile.

No otherprofileoptions are supported bympiprofile. These three options have no effect on the data displayed bympiprofile viewer.

mpiprofile offstops the parallel profiler. To reset the state of the profiler and disable collecting communication information, you should also callmpiprofile reset.

mpiprofile resumerestarts the profiler without clearing previously recorded function statistics. This works only in pmode or in the same MATLAB worker session.

mpiprofile clearclears the profile information.

mpiprofile statusreturns a valid status when it runs on the worker.

mpiprofile resetturns 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 inforeturns a profiling data structure with additional fields to the one provided by the standardprofile infoin theFunctionTableentry. All these fields are recorded on a per-function and per-line basis, except for the*PerLabfields.

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*PerLabfields 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 vieweris 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 structureneeds be passed in as the second argument, which is an array ofmpiprofile infostructures. SeepInfoVectorin the Examples section below.

mpiprofiledoes not accept-timer clockoptions, 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 infoby 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);

Introduced in R2007b

Was this topic helpful?