Main Content

parallel.Cluster

Access cluster properties and behaviors

Constructors

parcluster

getCurrentCluster (in the workspace of the MATLAB worker)

Container Hierarchy

Parent

None

Children

parallel.Job, parallel.Pool

Description

A parallel.Cluster object provides access to a cluster, which controls the job queue, and distributes tasks to workers for execution.

Types

The two categories of clusters are the MATLAB® Job Scheduler and common job scheduler (CJS). The MATLAB Job Scheduler is available in the MATLAB Parallel Server™. The CJS clusters encompass all other types, including the local, generic, and third-party schedulers.

Use MJSComputeCloud objects to interact with MATLAB Parallel Server for Amazon EC2® clusters.

The following table describes the available types of cluster objects.

Cluster TypeDescription
parallel.cluster.MJSInteract with MATLAB Job Scheduler cluster on-premises
parallel.cluster.MJSComputeCloudInteract with MATLAB Parallel Server for Amazon EC2 cluster
parallel.cluster.LocalInteract with CJS cluster running locally on client machine
parallel.cluster.HPCServerInteract with CJS cluster running Windows Microsoft HPC Server
parallel.cluster.LSFInteract with CJS cluster running LSF
parallel.cluster.PBSProInteract with CJS cluster running Altair PBS Pro or OpenPBS
parallel.cluster.TorqueInteract with CJS cluster running TORQUE
parallel.cluster.SlurmInteract with CJS cluster running Slurm
parallel.cluster.GenericInteract with CJS cluster using the generic interface

Methods

Common to All Cluster Types

batchRun MATLAB script or function on worker
createCommunicatingJobCreate communicating job on cluster
createJobCreate independent job on cluster
findJobFind job objects stored in cluster
isequalTrue if clusters have same property values
parpoolCreate parallel pool on cluster
saveAsProfileSave cluster properties to specified profile
saveProfileSave modified cluster properties to its current profile

MATLAB Job Scheduler

changePasswordPrompt MATLAB Job Scheduler password change
demoteDemote job in cluster queue
logoutLog out of MATLAB Job Scheduler cluster
promotePromote job in MATLAB Job Scheduler cluster queue
resumeResume processing queue in MATLAB Job Scheduler

MJSComputeCloud

shutdown Shut down cloud cluster
startStart cloud cluster
wait (cluster)Wait for cloud cluster to change state

HPC Server, PBS Pro, LSF, TORQUE, Slurm, and Local Clusters

getDebugLogRead output messages from job run in CJS cluster

Generic

getDebugLogRead output messages from job run in CJS cluster
getJobClusterDataGet specific user data for job on generic cluster
getJobFolderFolder on client where jobs are stored
getJobFolderOnClusterFolder on cluster where jobs are stored
getLogLocationLog location for job or task
setJobClusterDataSet specific user data for job on generic cluster

Properties

Common to All Cluster Types

The following properties are common to all cluster object types.

PropertyDescription
ClusterMatlabRootSpecifies path to MATLAB for workers to use
HostHost name of the cluster head node
JobStorageLocationLocation where cluster stores job and task information
JobsList of jobs contained in this cluster
LicenseNumberLicense number to use when running jobs with this cluster
ModifiedTrue if any properties in this cluster have been modified
NumThreadsNumber of computational threads for workers
NumWorkersNumber of workers available for this cluster
OperatingSystemOperating system of nodes used by cluster
PreferredPoolNumWorkersPreferred number of workers in a parallel pool
ProfileProfile used to build this cluster
RequiresOnlineLicensingTrue if the cluster is using online licensing
TypeType of this cluster
UserDataInformation associated with cluster object within client session

Specify the JobStorageLocation property as one of the following.

  • If you use the generic scheduler interface in remote mode to interact with a third-party scheduler, and the client and workers use different operating systems, specify a structure. The structure must have the fields 'windows' and 'unix'. The fields are the Windows and Unix path corresponding to the folder where the cluster stores job and task information. The following structure specifies the same folder using a Windows UNC path ('\\organization\some\path') and a Unix path ('/organization/some/path'):

    struct('windows', '\\organization\some\path', 'unix', '/organization/some/path')

  • Otherwise, use a character vector or string to specify the folder where the cluster stores job and task information.

MATLAB Job Scheduler

MJS cluster objects have the following properties in addition to the common properties:

PropertyDescription
AllHostAddressesIP addresses of the cluster host
BusyWorkersWorkers currently running tasks
IdleWorkersWorkers currently available for running tasks
HasSecureCommunicationTrue if cluster is using secure communication
MaxNumWorkers

Maximum number of workers this cluster can have.

  • When you use a cluster without automatic resizing, this value is the number of workers in the cluster.

  • When you use a cluster with automatic resizing, workers are added automatically up to this maximum value as necessary. For more information on automatic resizing, see Set up MATLAB Job Scheduler Cluster for Auto-Resizing (MATLAB Parallel Server).

NameName of this cluster
NumBusyWorkersNumber of workers currently running tasks
NumIdleWorkersNumber of workers available for running tasks
PromptForPasswordTrue if system should prompt for password when authenticating user
SecurityLevelDegree of security applied to cluster and its jobs. For descriptions of security levels, see Set MATLAB Job Scheduler Cluster Security (MATLAB Parallel Server).
StateCurrent state of cluster
UsernameUser accessing cluster

MJSComputeCloud

MJSComputeCloud cluster objects have the following properties in addition to the common properties:

PropertyDescription
BusyWorkersWorkers currently running tasks
CertificateCluster SSL certificate
HasSecureCommunicationTrue if cluster is using secure communication
IdentifierUnique cluster identifier
IdleWorkersWorkers currently available for running tasks
MatlabVersionVersion of MATLAB running on the workers
MaxNumWorkers

Maximum number of workers this cluster can have.

  • When you use a cluster without automatic resizing, this value is the number of workers when you started the cluster.

  • When you use a cluster with automatic resizing, workers are added automatically up to this maximum value as necessary. For more information on automatic resizing, see Resize Clusters Automatically.

NameName of this cluster
NumBusyWorkersNumber of workers currently running tasks
NumIdleWorkersNumber of workers available for running tasks
NumWorkersRequestedNumber of workers requested for this cluster. The cluster adds or removes workers as soon as possible to reach this number.
SharedState

The shared state of the cluster, which can be:

  • Personal – Only you can use this cluster, so long as you created it.

  • Shareable – Anyone can use this cluster.

ShutdownAtShutdown time or event
StateCurrent state of cluster
UsernameUser accessing cluster

Local

Local cluster objects have no editable properties beyond the properties common to all clusters.

HPC Server

HPCServer cluster objects are supported on clients running Windows.

HPCServer cluster objects have the following properties in addition to the common properties:

PropertyDescription
ClusterVersionVersion of Microsoft Windows HPC Server running on the cluster
HasSharedFilesystemSpecify whether client and cluster nodes share JobStorageLocation
JobDescriptionFileName of XML job description file to use when creating jobs
JobTemplateName of job template to use for jobs submitted to HPC Server
NameName of this cluster
UseSOAJobSubmissionAllow service-oriented architecture (SOA) submission on HPC Server

PBS Pro and TORQUE

PBSPro cluster objects are supported on clients running Windows or Linux. Torque cluster objects are supported on clients running Linux.

PBSPro and Torque cluster objects have the following properties in addition to the common properties:

PropertyDescription
CommunicatingJobWrapperScript that cluster runs to start workers
RcpCommandCommand to copy files to and from client
ResourceTemplateSpecify qsub options to request resources during job submission
RshCommandRemote execution command used on worker nodes during communicating job
HasSharedFilesystemSpecify whether client and cluster nodes share JobStorageLocation
ProcsPerNode

Number of processors per node, specified as a finite positive integer scalar.

When you submit a job to the cluster, the number of cores per node that MATLAB requests is guaranteed to be less than or equal to ProcsPerNode. Set ProcsPerNode equal to the maximum number of processors you want MATLAB to request from each cluster node.

MATLAB requests the smallest number of cores per node required to run the job.

  • If the NumThreads property of the cluster is less than or equal to ProcsPerNode, MATLAB requests NumThreads processors per worker, then maximizes the number of workers per node. For example if ProcsPerNode is 16 and NumThreads is 5, MATLAB requests 15 cores, the largest multiple of 5 that is less than ProcsPerNode.

  • If NumThreads of the cluster is greater than ProcsPerNode, MATLAB requests ProcsPerNode processors per node.

    When NumThreads is greater than ProcsPerNode, you might encounter performance issues. As a best practice, set NumThreads less than or equal to ProcsPerNode. For more information, see Edit Number of Workers and Cluster Settings.

SubmitArgumentsSpecify additional arguments to use when submitting jobs

LSF

LSF cluster objects are supported on clients running Windows, macOS, or Linux.

LSF cluster objects have the following properties in addition to the common properties:

PropertyDescription
ClusterNameName of LSF cluster
CommunicatingJobWrapperScript that the cluster runs to start workers
HasSharedFilesystemSpecify whether client and cluster nodes share JobStorageLocation
ResourceTemplateSpecify bsub options to request resources during job submission
SubmitArgumentsSpecify additional arguments to use when submitting jobs

Slurm

Slurm cluster objects are supported on clients running Linux.

Slurm cluster objects have the following properties in addition to the common properties:

PropertyDescription
ClusterNameName of the Slurm cluster
CommunicatingJobWrapperScript that the cluster runs to start workers
ResourceTemplateSpecify sbatch options to request resources during job submission
SubmitArgumentsSpecify additional arguments to use when submitting jobs

Generic

Generic cluster objects are supported on clients running Windows, macOS, or Linux.

If you create a generic cluster object from an R2017a or later profile, you have the following properties in addition to the common properties:

PropertyDescription
AdditionalPropertiesAdditional properties for plugin scripts
HasSharedFilesystemSpecify whether client and cluster nodes share JobStorageLocation
PluginScriptsLocationFolder containing scheduler plugin scripts

If you create a generic cluster object from an R2016b or earlier profile, you have the following properties in addition to the common properties:

PropertyDescription
CancelJobFcnFunction to run when cancelling job
CancelTaskFcnFunction to run when cancelling task
CommunicatingSubmitFcnFunction to run when submitting communicating job
DeleteJobFcn Function to run when deleting job
DeleteTaskFcnFunction to run when deleting task
GetJobStateFcnFunction to run when querying job state
HasSharedFilesystemSpecify whether client and cluster nodes share JobStorageLocation
IndependentSubmitFcnFunction to run when submitting independent job

Help

For further help on cluster objects, including links to help for specific cluster types and object properties, type:

help parallel.Cluster

Version History

Introduced in R2012a