Skip to Main Content Skip to Search
Product Documentation

createJob - Create distributed or independent job

Syntax

obj = createJob(cluster)
obj = createJob()
obj = createJob(scheduler)
obj = createJob(..., 'p1', v1, 'p2', v2, ...)
job = createJob(..., 'Profile', 'profileName', ...)
obj = createJob(..., 'configuration', 'ConfigurationName', ...)

Arguments

obj

The job object.

scheduler

The scheduler object created by findResource.

cluster

The cluster object created by parcluster.

p1, p2

Object properties configured at object creation.

v1, v2

Initial values for corresponding object properties.

Description

obj = createJob(cluster) creates an independent job object for the identified cluster.

obj = createJob() creates a job using the scheduler identified by the default cluster profile and sets the property values of the job as specified in that profile.

obj = createJob(scheduler) creates a 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.

obj = createJob(..., 'p1', v1, 'p2', v2, ...) creates a job object with the specified property values. For a listing of the valid properties of the created object, see the job object reference page (if using a job manager or MJS) or simplejob 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.

Note that the 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. If a structure is used, the structure field names are job object property names and the field values specify the property values.

If you are using a third-party scheduler instead of a job manager, the job's data is stored in the location specified by the scheduler's DataLocation property, or the cluster's JobStorageLocation property.

job = createJob(..., 'Profile', 'profileName', ...) creates an independent job object with the property values specified in the profile 'profileName'. If a profile is not specified and the cluster has a value specified in its 'Profile' property, the cluster's profile is automatically applied. For details about defining and applying profiles, see Cluster Profiles.

obj = createJob(..., 'configuration', 'ConfigurationName', ...) creates a job object using the scheduler identified by the configuration and sets the property values of the job as specified in that configuration.

Examples

Independent Job

Construct an independent job object using the default profile.

c = parcluster
j = createJob(c);

Add tasks to the job.

for i = 1:10
    createTask(j, @rand, 1, {10});
end

Run the job.

submit(j);

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

wait(j);
out = fetchOutputs(j);

Display the random matrix returned from the third task.

disp(out{3});

Delete the job.

delete(j);

Distributed Job

Construct a distributed job object using the default profile.

j2 = createJob();

Add tasks to the job.

for i = 1:10
    createTask(j2, @rand, 1, {10});
end

Run the job.

submit(j2);

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

waitForState(j2);
out = getAllOutputArguments(j2);

Display the random matrix returned from the third task.

disp(out{3});

Destroy the job.

destroy(j2);

See Also

createParallelJob | createTask | findJob | findResource | parcluster | 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