When your cloud cluster is running, you access it and workers in the same way you access a cluster in your own onsite network. You can discover clusters on Amazon EC2 from your desktop MATLAB. You can also import cluster profiles or use parallel computing functions to identify available clusters for creating and submitting jobs.
You can let MATLAB discover clusters for you. You need a working network connection between the client and the Cloud Center web services running in mathworks.com.
Use either of the following to discover clusters 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
Both options open the Discover Clusters wizard, where you can search for MATLAB® Parallel Server™ clusters.
Select On Amazon EC2 and click Next. MATLAB searches for clusters running on Amazon EC2. To access these clusters, you must provide your MathWorks Account login information. Clusters appear in the list as they are discovered.
Select the name of the cluster you want to use, and click Next. On the next screen, click Finish. If you do not want to set the new cluster profile as your default, you can clear the check box. You can set the default cluster at any time later using the Parallel menu. Parallel applications in your MATLAB session can use the desired cloud cluster by default.
You can use the Cluster Profile Manager to import any MATLAB cluster profile downloaded from the Cloud Center. The cluster does not have to be in your account.
On your MATLAB desktop, select Parallel > Manage Cluster Profiles.
Click Import in the toolbar.
Navigate to the location where you saved the profile you downloaded from the Cloud
Center, and select the profile with its
Select the newly imported profile in the Profile Manager list of profiles, then click Set As Default in the toolbar. Setting a profile as a default allows your parallel computing code to use this profile and its cluster with minimal code changes.
With your cloud cluster profile selected, you can test your cloud cluster by running a validation of the profile:
If the profile manager is not already open, on your MATLAB desktop, select Parallel > Manage Cluster Profiles.
Select the name of your cloud profile and click Validate in the toolbar. This automatically displays the Validation Results tab so you can view the tests in progress. A pop-up dialog box might require you to log in to your MathWorks account to validate your cluster profile.
With your cloud cluster profile set as your default, you can now run parallel
computing applications on the cloud with functions such as
As an alternative to downloading a profile and importing it through the Profile
Manager, 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
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:
You can also start and stop cloud clusters using the cluster object, using the
(cluster) enables you to wait to submit jobs until all cluster workers are
As an alternative to
fetchCloudClusters, you can use the a profile
downloaded from the Cloud Center to identify the cluster you want to access.
example, suppose you downloaded the profile settings file to a file named
C:\temp\MyCluster.settings. You can access and use this profile
parallel.importProfile('C:\temp\MyProfile') c = parcluster('MyProfile')
Then proceed to use this cluster for creating jobs or running parallel algorithms: