Interactive Parallel Command Window
pmode start numworkers
pmode start prof numworkers
pmode client2lab clientvar workers workervar
pmode lab2client workervar worker clientvar
pmode cleanup prof
pmode allows the interactive parallel execution of MATLAB® commands.
pmode achieves this by defining and
submitting a communicating job, and opening a Parallel Command Window connected to
the workers running the job. The workers then receive commands entered in the
Parallel Command Window, process them, and send the command output back to the
Parallel Command Window. Variables can be transferred between the MATLAB client and the workers. For more details about program development in
pmode and its interactive features, see Run Communicating Jobs Interactively Using pmode.
pmode start starts pmode, using the default profile to define
the cluster and number of workers. (The initial default profile is
local; you can change it by using the function
parallel.defaultClusterProfile.) You can also specify the
number of workers using
pmode start numworkers.
pmode start prof numworkers starts pmode using the Parallel
Computing Toolbox™ profile
prof to locate the cluster, submits a
communicating job with the number of workers identified by
numworkers, and connects the Parallel Command Window with the
workers. If the number of workers is specified, it overrides the minimum and maximum
number of workers specified in the profile.
pmode quit or
pmode exit stops the pmode
job, deletes it, and closes the Parallel Command Window. You can enter this command
at the MATLAB prompt or the
pmode client2lab clientvar
workers workervar copies the
clientvar from the MATLAB client to the variable
workervar on the workers
omitted, the copy is named
can be either a single index or a vector of indices. You can enter this command at
the MATLAB prompt or the
pmode lab2client workervar
worker clientvar copies the
workervar from the worker identified by
worker, to the variable
clientvar on the
MATLAB client. If
clientvar is omitted, the copy is named
workervar. You can enter this command at the MATLAB prompt or the
pmode prompt. Note: If you use this
command in an attempt to transfer a codistributed array to the client, you get a
warning, and only the local portion of the array on the specified worker is
transferred. To transfer an entire codistributed array, first use the
gather function to assemble the
whole array into the worker workspaces.
pmode cleanup prof deletes all communicating jobs created by
pmode for the current user running on the cluster specified
in the profile
prof, including jobs that are currently running.
The profile is optional; the default profile is used if none is specified. You can
enter this command at the MATLAB prompt or the
You can invoke
pmode as either a command or a function, so the
following are equivalent.
pmode start prof 4 pmode('start','prof',4)
In the following examples, the
P>>) indicates commands entered in the Parallel
Command Window. Other commands are entered in the MATLAB Command Window.
pmode using the default profile to identify the cluster
and number of workers.
pmode using the
local profile with
four local workers.
pmode start local 4
pmode using the profile
eight workers on the cluster.
pmode start myProfile 8
Execute a command on all workers.
P>> x = 2*labindex;
Copy the variable
x from worker 7 to the MATLAB client.
pmode lab2client x 7
Copy the variable
y from the MATLAB client to workers 1 through 8.
pmode client2lab y 1:8
Display the current working directory of each worker.