User`s guide
6 Programming Overview
6-24
• The Cluster Profile Manager indicates which is the default profile. You can select any
profile in the list, then click Set as Default.
• You can get or set the default profile programmatically by using the
parallel.defaultClusterProfile function. The following sets of commands
achieve the same thing:
parallel.defaultClusterProfile('MyMJSprofile1')
parpool
or
parpool('MyMJSprofile1')
Create Cluster Object
The parcluster function creates a cluster object in your workspace according to the
specified profile. The profile identifies a particular cluster and applies property values.
For example,
c = parcluster('myMJSprofile')
This command finds the cluster defined by the settings of the profile named
myMJSprofile and sets property values on the cluster object based on settings in the
profile. By applying different profiles, you can alter your cluster choices without changing
your MATLAB application code.
Create Jobs and Tasks
Because the properties of cluster, job, and task objects can be defined in a profile, you
do not have to explicitly define them in your application. Therefore, your code can
accommodate any type of cluster without being modified. For example, the following code
uses one profile to set properties on cluster, job, and task objects:
c = parcluster('myProfile1');
job1 = createJob(c); % Uses profile of cluster object c.
createTask(job1,@rand,1,{3}) % Uses profile of cluster object c.