Skip to Main Content Skip to Search
Product Documentation

createParallelJob - Create parallel job object

Syntax

pjob = createParallelJob()
pjob = createParallelJob(scheduler)
pjob = createParallelJob(..., 'p1', v1, 'p2', v2, ...)
pjob = createParallelJob(..., 'configuration', 'ConfigurationName',...)

Arguments

pjob

The parallel job object.

scheduler

The scheduler object created by findResource.

p1, p2

Object properties configured at object creation.

v1, v2

Initial values for corresponding object properties.

Description

pjob = createParallelJob() creates a parallel job using the scheduler identified by the default parallel configuration and sets the property values of the job as specified in the default configuration.

pjob = createParallelJob(scheduler) creates a parallel job object at the data location for the identified scheduler, or in the job manager. When you specify a scheduler without using the 'configuration' option, no configuration is used, so no configuration properties are applied to the job object.

pjob = createParallelJob(..., 'p1', v1, 'p2', v2, ...) creates a parallel job object with the specified property values. For a listing of the valid properties of the created object, see the paralleljob object reference page (if using a job manager) or simpleparalleljob object reference page (if using a third-party scheduler). If an invalid property name or property value is specified, the object will not be created.

Property value pairs can be in any format supported by the set function, i.e., param-value string pairs, structures, and param-value cell array pairs. Future modifications to the job object result in a remote call to the job manager or modification to data at the scheduler's data location.

pjob = createParallelJob(..., 'configuration', 'ConfigurationName',...) creates a parallel job object using the scheduler identified by the configuration and sets the property values of the job as specified in that configuration. For details about defining and applying configurations, see Cluster Profiles.

Examples

Construct a parallel job object using the default configuration.

pjob = createParallelJob();

Add the task to the job.

createTask(pjob, 'rand', 1, {3});

Set the number of workers required for parallel execution.

set(pjob,'MinimumNumberOfWorkers',3);
set(pjob,'MaximumNumberOfWorkers',3);

Run the job.

submit(pjob);

Wait for the job to finish running, and retrieve the job results.

waitForState(pjob);
out = getAllOutputArguments(pjob);

Display the random matrices.

celldisp(out);
out{1} =
    0.9501    0.4860    0.4565
    0.2311    0.8913    0.0185
    0.6068    0.7621    0.8214
out{2} =
    0.9501    0.4860    0.4565
    0.2311    0.8913    0.0185
    0.6068    0.7621    0.8214
out{3} =
    0.9501    0.4860    0.4565
    0.2311    0.8913    0.0185
    0.6068    0.7621    0.8214

Destroy the job.

destroy(pjob);

See Also

createJob | createTask | findJob | findResource | submit

  


Free Parallel Computing Interactive Kit

See how to solve large problems with minimal effort and reduce simulation time.

Get free kit

Trials Available

Try the latest versions of parallel computing products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS