Clusters and Cluster Profiles

Cluster Profile Manager

Cluster profiles let you define certain properties for your cluster, then have these properties applied when you create cluster, job, and task objects in the MATLAB® client. Some of the functions that support the use of cluster profiles are

To create, edit, and import cluster profiles, you can use the Cluster Profile Manager. To open the Cluster Profile Manager, on the Home tab in the Environment section, click Parallel > Manage Cluster Profiles.

Use Cluster Profiles

Parallel Computing Toolbox™ comes pre-configured with two cluster profiles:

  • local: for running on your local desktop machine.

  • MATLABParallel Computing Toolbox: for MATLAB Parallel Cloud clusters running on Amazon EC2. This offering is initially available only in the United States and Canada. Updates on availability can be found here.

    MATLAB Parallel Cloud initially supports interactive parpool - based parallelism.

    You can discover other clusters running on your network or on Amazon EC2 using the Parallel > Discover Clusters User Interface.

    If you have trouble connecting to MATLAB Parallel Cloud, click Parallel > Test Cloud Connection (see screen shot above).

    Click here to download a usage report for MATLAB Parallel Cloud.

Discover Clusters

You can let MATLAB discover clusters for you. Use either of the following techniques to discover those clusters which are available for you to use:

  • On the Home tab in the Environment section, click Parallel > Discover Clusters.

  • In the Cluster Profile Manager, click Discover Clusters.

This opens the Discover Clusters dialog box, where you can search for MATLAB Distributed Computing Server™ clusters:

If you select On your network, you see a new window. Select this option if your clusters use a MATLAB job scheduler (MJS) or Microsoft Windows HPC server. As clusters are discovered, they populate a list for your selection. If you already have a profile for any of the listed clusters, those profile names are included in the list. If you want to create a new profile for one of the discovered clusters, select the name of the cluster you want to use, and click Next. The subsequent dialog box lets you choose if you want to set the new profile as your default.

If you select On Amazon EC2, you search for clusters running on Amazon EC2. To access these clusters, you must provide your MathWorks Account login information:

Requirements for Cluster Discovery

Cluster discovery is supported only for MATLAB job schedulers (MJS), Microsoft® Windows® HPC Server, and Amazon EC2 cloud clusters. The following requirements apply to these clusters.

  • MJS — MJS clusters support two different means of discovery:

    • Multicast: The discover clusters functionality uses the multicast networking protocol from the client to search for head nodes where an MJS is running. This requires that the multicast networking protocol is enabled and working on the network that connects the MJS head nodes (where the schedulers are running) and the client machines. This form of discovery might be limited to the client local subnet, and therefore not always able to discover an MJS elsewhere in your network.

    • DNS SRV: An alternative discovery technique is to search for clusters by DNS service records.

      The Domain Name System (DNS) is a standard for identifying host names with IP addresses, either on the Internet or in a private network. Using DNS allows discovery of MJS clusters by identifying specific hosts rather than broadcasting across your network.

      A DNS service (SRV) record defines the location of hosts and ports of services, such as those related to the clusters you want to discover. Your system administrator creates DNS SRV records in your organization's DNS infrastructure. For a description of the required record, and validation information, see DNS SRV Record.

  • HPC Server — Discover clusters functionality uses Active Directory Domain Services to discover head nodes. HPC Server head nodes are added to the Active Directory during installation of the HPC Server software.

  • Amazon EC2 — Discover clusters functionality requires a working network connection between the client and the Cloud Center web services running in

Import and Export Cluster Profiles

Cluster profiles are stored as part of your MATLAB preferences, so they are generally available on an individual user basis. To make a cluster profile available to someone else, you can export it to a separate .settings file. In this way, a repository of profiles can be created so that all users of a computing cluster can share common profiles.

To export a cluster profile:

  1. In the Profile Clusters Manager, select (highlight) the profile you want to export.

  2. Click Export > Export. (Alternatively, you can right-click the profile in the listing and select Export.)

    If you want to export all your profiles to a single file, click Export > Export All

  3. In the Export profiles to file dialog box, specify a location and name for the file. The default file name is the same as the name of the profile it contains, with a .settings extension appended; you can alter the names if you want to.

Profiles saved in this way can then be imported by other MATLAB users:

  1. In the Cluster Profile Manager, click Import.

  2. In the Import profiles from file dialog box, browse to find the .settings file for the profile you want to import. Select the file and click Open.

    The imported profile appears in your Cluster Profile Manager list. Note that the list contains the profile name, which is not necessarily the file name. If you already have a profile with the same name as the one you are importing, the imported profile gets an extension added to its name so you can distinguish it.

You can also export and import profiles programmatically with the parallel.exportProfile and parallel.importProfile functions.

Export Profiles for MATLAB Compiler

You can use an exported profile with MATLAB Compiler™ and MATLAB Compiler SDK™ to identify cluster setup information for running compiled applications on a cluster. For example, the setmcruserdata function can use the exported profile file name to set the value for the key ParallelProfile. For more information and examples of deploying parallel applications, see Pass Parallel Computing Toolbox Profile at Run Time in the MATLAB Compiler documentation, and Use Parallel Computing Toolbox in Deployed Applications in the MATLAB Compiler SDK documentation.

A compiled application has the same default profile and the same list of alternative profiles that the compiling user had when the application was compiled. This means that in many cases the profile file is not needed, as might be the case when using the local profile for local workers. If an exported file is used, the first profile in the file becomes the default when imported. If any of the imported profiles have the same name as any of the existing profiles, they are renamed during import (though their names in the file remain unchanged).

Create and Modify Cluster Profiles

The first time you open the Cluster Profile Manager, it lists only one profile called local, which is the initial default profile having only default settings at this time.

The following example provides instructions on how to create and modify profiles using the Cluster Profile Manager.

Suppose you want to create a profile to set several properties for jobs to run in an MJS cluster. The following example illustrates a possible workflow, where you create two profiles differentiated only by the number of workers they use.

  1. In the Cluster Profile Manager, select Add > Custom > MATLAB Job Scheduler (MJS). This specifies that you want a new profile for an MJS cluster.

    This creates and displays a new profile, called MJSProfile1.

  2. Double-click the new profile name in the listing, and modify the profile name to be MyMJSprofile1.

  3. Click Edit in the tool strip so that you can set your profile property values.

    In the Description field, enter the text MJS with 4 workers, as shown in the following figure. Enter the host name for the machine on which the MJS is running, and the name of the MJS. If you are entering information for an actual MJS already running on your network, enter the appropriate text. If you are unsure about the MJS (formerly known as a job manager) names and locations on your network, ask your system administrator for help.

      Note   If the MJS is using a nondefault BASE_PORT setting as defined in the mdce_def file, the Host property in the cluster profile must be appended with this BASE_PORT number. For example, MJS-Host:40000.

  4. Scroll down to the Workers section, and for the Range of number of workers, enter the two-element vector [4 4]. This specifies that jobs using this profile require at least four workers and no more than four workers. Therefore, a job using this profile runs on exactly four workers, even if it has to wait until four workers are available before starting.

    You might want to edit other properties depending on your particular network and cluster situation.

  5. Click Done to save the profile settings.

To create a similar profile with just a few differences, you can duplicate an existing profile and modify only the parts you need to change, as follows:

  1. In the Cluster Profile Manager, right-click the profile name MyMJSprofile1 in the list and select Duplicate.

    This creates a duplicate profile with a name based on the original profile name appended with _Copy.

  2. Double-click the new profile name and edit its name to be MyMJSprofile2.

  3. Click Edit to allow you to change the profile property values.

  4. Edit the description field to change its text to MJS with any workers.

  5. Scroll down to the Workers section, and for the Range of number of workers, clear the [4 4] and leave the field blank, as highlighted in the following figure:

  6. Click Done to save the profile settings and to close the properties editor.

You now have two profiles that differ only in the number of workers required for running a job.

When creating a job, you can apply either profile to that job as a way of specifying how many workers it should run on.

You can see examples of profiles for different kinds of supported schedulers in the MATLAB Distributed Computing Server installation instructions at Configure Your Cluster.

Validate Cluster Profiles

The Cluster Profile Manager includes the ability to validate profiles. Validation assures that the MATLAB client session can access the cluster, and that the cluster can run the various types of jobs with the settings of your profile.

To validate a profile, follow these steps:

  1. Open the Cluster Profile Manager on the Home tab in the Environment section, by clicking Parallel > Manage Cluster Profiles.

  2. In the Cluster Profile Manager, click the name of the profile you want to test. You can highlight a profile without changing the selected default profile. So a profile selected for validation does not need to be your default profile.

  3. Click Validate.

Profile validation includes five stages:

  1. Connects to the cluster (parcluster)

  2. Runs an independent job (createJob) on the cluster using the profile

  3. Runs an SPMD-type communicating job on the cluster using the profile

  4. Runs a pool-type communicating job on the cluster using the profile

  5. Runs a parallel pool job on the cluster using the profile

While the tests are running, the Cluster Profile Manager displays their progress as shown here:

    Note   Validation will fail if you already have a parallel pool open.

When the tests are complete, you can click Show Details to get more information about test results. This information includes any error messages, debug logs, and other data that might be useful in diagnosing problems or helping to determine proper network settings.

The Validation Results tab keeps the test results available until the current MATLAB session closes.

Apply Cluster Profiles in Client Code

In the MATLAB client where you create and define your parallel computing cluster, job, and task objects, you can use cluster profiles when creating these objects.

Select a Default Cluster Profile

Some functions support default profiles, so that if you do not specify a profile for them, they automatically apply the default. There are several ways to specify which of your profiles should be used as the default profile:

  • On the Home tab in the Environment section, click Parallel > Default Cluster, and from there, all your profiles are available. The default profile is indicated. You can select any profile in the list as the default.

  • 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:




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.
Was this topic helpful?