discover clusters and use cluster profiles -凯发k8网页登录

main content

discover clusters and use cluster profiles

parallel computing toolbox™ comes pre-configured with the cluster profiles processes and threads for running parallel code on your local desktop machine.

control parallel behavior using the parallel menu on the matlab® home tab.

the parallel menu, including menu entries for selecting parallel environment, discovering clusters, creating and managing clusters, monitoring jobs, and inspecting your parallel preferences.

you can use the parallel menu to:

  • discover other clusters running on your network or on cloud center. click parallel > discover clusters. for more information, see discover clusters.

  • create and manage cluster profiles using the cluster profile manager. click parallel > create and manage clusters. for more information, see create and manage cluster profiles.

create and manage cluster profiles

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

manage cluster profiles using the cluster profile manager. to open the cluster profile manager, on the home tab, in the environment section, select parallel > create and manage clusters.

the cluster profile manager, showing the create, manage profile, validate, cloud, and help sections at the top, and details of the cluster profiles below.

you can use the cluster profile manager to:

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, select parallel > discover clusters

  • in the cluster profile manager, select discover clusters

this opens the discover clusters dialog box, where you can search for matlab parallel server™ clusters:

discover clusters dialog box, asking

if you select on your network, you see a new window. select this option if your clusters use a matlab job scheduler, microsoft® windows® hpc server or other third-party scheduler cluster. 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 select next. the subsequent dialog box lets you choose if you want to set the created profile as your default. this option is not supported in .

if you select on mathworks cloud center, you search for clusters running on cloud center. to access these clusters, you must provide your mathworks account login information.

requirements for cluster discovery

cluster discovery is supported for matlab job schedulers, microsoft windows hpc server clusters, other third-party scheduler clusters, and mathworks cloud center clusters. if you need to integrate your scheduler with matlab parallel server, or create a cluster profile for a different supported scheduler, see get started with matlab parallel server (matlab parallel server). the following requirements apply to cluster discovery:

  • matlab job scheduler — matlab job scheduler 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 a matlab job scheduler is running. this requires that the multicast networking protocol is enabled and working on the network that connects the matlab job scheduler 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 a matlab job scheduler 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 matlab job scheduler 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 (matlab parallel server).

  • hpc server — the 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.

  • third-party schedulers – the discover clusters functionality uses a configuration file to discover third-party scheduler clusters. for more information, see (matlab parallel server).

  • cloud center — the discover clusters functionality requires a working network connection between the client and the cloud center web services running in mathworks.com.

create cloud cluster

you can create clusters in cloud center cloud services directly from the cluster profile manager. in the cluster profile manager, select create cloud cluster.

the cluster profile manager menu, showing the create cloud cluster button in the create section.

sign up with your mathworks® account and complete the required steps. then, you can create a cloud cluster and configure parameters, such as the number of machines or the number of workers per machine. for more information on each of the available parameters, see . when you complete all the steps, matlab creates a new cluster profile for you. you can modify its properties from the cluster profile manager.

to manage your licenses, test cloud connectivity, or manage your cloud clusters in mathworks cloud center, go to cluster profile manager toolstrip > cloud section.

add and modify cluster profiles

with the cluster profile manager, you can add a cluster profile for a matlab job scheduler or a third-party scheduler. if you need to set up your cluster for use with matlab, see get started with matlab parallel server (matlab parallel server).

the following example provides instructions on how to add and modify profiles using the cluster profile manager.

suppose you want to create a profile to set several properties for jobs to run in a matlab job scheduler 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 cluster profile > matlab job scheduler. this specifies that you want a new profile for a matlab job scheduler cluster.

    the cluster profile manager, showing the options for adding a cluster profile, including using matlab job scheduler, local machine processes, and specific and general third party schedulers.

    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. select 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 matlab job scheduler is running, and the name of the matlab job scheduler. if you are entering information for an actual matlab job scheduler already running on your network, enter the actual names. if you are unsure about the matlab job scheduler names and locations on your network, ask your system administrator for help.

    the cluster profile manager, showing the properties of a matlab job scheduler cluster profile including a description of the cluster.

    note

    if the matlab job scheduler is using a nondefault base_port setting as defined in the mjs_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.

    the cluster profile manager, showing the properties of a matlab job scheduler cluster profile including the numworkersrange property.

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

  5. select 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. select 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.

  6. select 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 parallel server installation instructions at (matlab parallel server).

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 .mlsettings 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 cluster profile manager, select (highlight) the profile you want to export.

  2. select 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, select 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 .mlsettings extension appended; you can alter the names if you want to.

note that you cannot export profiles for cloud center personal clusters.

profiles saved in this way can then be imported by other matlab users:

  1. in the cluster profile manager, select import.

  2. in the import profiles from file dialog box, browse to find the .mlsettings file for the profile you want to import. select the file and select 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 and 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 (matlab compiler) 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 (matlab compiler), and (matlab compiler sdk).

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 processes 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).

edit number of workers and cluster settings

after you create a cluster profile, you can specify the number of workers and other profile properties:

  • numworkers: the number of workers to start a pool. the actual pool size might be limited by licensing, cluster size, and cluster profile settings. see

  • numthreads: the number of computational threads to use on each worker. you can change numthreads, so that your workers can run in multithreaded mode and use all the cores on your cluster. this allows you to increase the number of computational threads numthreads on each worker, without increasing the number of workers numworkers. if you have more cores available, increase numthreads to take full advantage of the built-in parallelism provided by the multithreaded nature of many of the underlying matlab libraries. for details, see .

    note

    do not increase the number of threads across all workers on a machine to exceed the number of physical cores. in other words, make sure that numworkers x numthreads ≤ number of physical cores on your machine. otherwise you might have reduced performance.

use your cluster from matlab

to run parallel language functions, such as parpool or batch, on a cluster, set the cluster profile as default, or use cluster objects.

specify default cluster

to set a cluster profile as the default, use one of the following ways:

  • on the home tab in the environment section, select parallel > select a 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 select set as default.

  • you can get or set the default profile programmatically by using the function. the following sets of commands achieve the same thing:

    parallel.defaultclusterprofile('mymjsprofile1')
    parpool

    or

    parpool('mymjsprofile1')

specify cluster programmatically (parcluster)

the 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('mymjsprofile1')

this command finds the cluster defined by the settings of the profile named mymjsprofile1 and sets property values on the cluster object based on settings in the profile. use a cluster object in functions such as parpool or . by applying different profiles, you can alter your cluster choices without changing your matlab application code.

see also

| | | | (matlab compiler) | | |

related examples

more about

external websites

    网站地图