Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

After logging into the cluster, start MATLAB.  Configure MATLAB to run parallel jobs on your cluster by calling configCluster, which only needs to be called once per version of MATLAB.  Please be aware that running configCluster more than once per version will reset your cluster profile back to default settings and erase any saved modifications to the profile. 

>> configCluster

ALTERNATE:

After logging into the cluster, configure MATLAB to run parallel jobs on your cluster by calling the shell script configCluster.sh   This only needs to be called once per version of MATLAB.

...

Prior to submitting the job, we can specify various parameters to pass to our jobs, such as queue, e-mail, walltime, etc.  None of these are Only walltime is required.

>> % Get a handle to the cluster
>> c = parcluster;

[REQUIRED]

>> % Specify the walltime (e.g. 5 hours)
>> c.AdditionalProperties.WallTime = '05:00:00';

[OPTIONAL]

>> % Specify an account to use for MATLAB jobs
>> c.AdditionalProperties.AccountName = 'account-name';

>> % Specify e-mail address to receive notifications about your job
>> c.AdditionalProperties.EmailAddress = 'user-id@company.compl';

>> % Specify type of GPU
>> c.AdditionalProperties.GpuCard = 'gpu-card-name';

>> % Specify number of GPUs
>> c.AdditionalProperties.GpusPerNode = 1;

>> % Specify localfs option
>> c.AdditionalProperties.LocalFs = true;

>> % Specify memfs option
>> c.AdditionalProperties.MemFs = true;

>> % Specify memory to use for MATLAB jobs, per core (MB)
>> c.AdditionalProperties.MemUsage = '4000';

>> % Specify a queue to use for MATLAB jobs                
>> c.AdditionalProperties.QueueName = 'queue-name';
>>
Save %changes Specifyafter the walltime (e.g. 5 hours)
>> c.AdditionalProperties.WallTime = '05:00:00';

...

modifying AdditionalProperties for the above changes to persist between MATLAB sessions.

>> c.saveProfile

To see the values of the current configuration options, display AdditionalProperties.

...

>> % Turn off email notifications 
>> c.AdditionalProperties.EmailAddress = '';
>> c.saveProfile

INTERACTIVE JOBS - MATLAB client on the cluster

...

>> % Delete the pool
>> p.delete

INDEPENDENT BATCH JOB

Use the batch command to submit asynchronous jobs to the cluster.  The batch command will return a job object which is used to access the output of the submitted job.  See the MATLAB documentation for more help on batch.

...

>> % Fetch results for job with ID 2
>> j2.fetchOutputs{:}

PARALLEL BATCH JOB

Users can also submit parallel workflows with the batch command.  Let’s use the following example for a parallel job, which is saved as parallel_example.m.   

function [t, A] = parallel_example(iter)

if nargin==0
    iter = 8;
end


disp('Start sim')
t0 = tic;
parfor idx = 1:iter
    A(idx) = idx;
    pause(2)
    idx
end
t = toc(t0);

disp('Sim completed')

save RESULTS A

end

...

Alternatively, to retrieve job results via a graphical user interface, use the Job Monitor (Parallel > Monitor Jobs).  

DEBUGGING

If a serial job produces an error, call the getDebugLog method to view the error log file.  When submitting independent jobs, with multiple tasks, specify the task number. 

...