Contenido principal

Access Cloud Clusters Using the Command-Line

When your cloud cluster in Cloud Center is starting or online, you can access the Cloud Cluster in MATLAB® using the command-line in MATLAB. Alternatively, you can let MATLAB discover clusters for you. For details, see Discover Clusters. You can also access clusters created by others in MATLAB using the cluster profile. For details, see Import Cluster Profiles and Access Cloud Clusters.

Find Clusters on Cloud

You can use the fetchCloudClusters function to create cluster objects in MATLAB for your own clusters on the cloud. A pop-up dialog box might require you to log in to your MathWorks® account when you execute this command. If you have more than one cluster running on the cloud, fetchCloudClusters returns an array of cluster objects; if you have only one cluster running, it returns just a single object:

c = fetchCloudClusters

MJSComputeCloud Cluster Information
===================================

            Profile: 
           Modified: true
               Host: ec2-107-21-71-51.compute-1.amazonaws.com
          NumWorkers: 32
  JobStorageLocation: Database on MyCluster@ec2-107-21-71-51.compute-1.amazonaws.com
   ClusterMatlabRoot: /mnt/matlab
     OperatingSystem: unix

 - Assigned Jobs

      Number Pending: 0
       Number Queued: 0
      Number Running: 0
     Number Finished: 0

 - MJSComputeCloud Specific Properties

                Name: MyCluster
               State: online
      NumBusyWorkers: 0
      NumIdleWorkers: 32

Now you can use the cluster object to create jobs and tasks in the usual manner. For example:

parpool(c,8)

or

createJob(c)

If you are the cluster owner, you can also start and stop cloud clusters using the cluster object, using the functions start (Parallel Computing Toolbox) and shutdown (Parallel Computing Toolbox). You are the cluster owner if you created the cluster. The function wait (Parallel Computing Toolbox) enables you to wait to submit jobs until all cluster workers are available.

See Also

Topics