주요 콘텐츠

fetchCloudClusters

Retrieve clusters in cloud

    Description

    c = fetchCloudClusters retrieves an MJSComputeCloud cluster object that represents a personal or shareable MathWorks® Cloud Center cluster that is online and running, and that you own.

    If you own more than one online running Cloud Center cluster, the fetchCloudClusters function returns an array of MJSComputeCloud cluster objects.

    MATLAB® might prompt you to provide your MathWorks Account login to identify the appropriate clusters.

    The fetchCloudClusters function does not return any shareable Cloud Center clusters owned by others, even if you have access to them. To use a shareable cloud cluster owned by someone else, the owner must share the cluster profile with you.

    For more information about Cloud Center and clusters in the cloud, see Getting Started with Cloud Center.

    You can also discover cloud clusters by using the Discover Clusters option in the Parallel menu.

    example

    Examples

    collapse all

    Start your cluster in Cloud Center. In the MATLAB client, use the fetchCloudClusters function to retrieve the cluster object of the cloud cluster.

    c = fetchCloudClusters
    c = 
    
     MJSComputeCloud Cluster
     
        Properties:
    
                          Name: MyCluster
                         State: online
                       Profile: 
                      Modified: true
                   SharedState: Personal
                          Host: ec2-111-11-11-11.compute-1.amazonaws.com
                    ShutDownAt: idle
              
                 MaxNumWorkers: 32
           NumWorkersRequested: 32
      
                    NumWorkers: 32
                    NumThreads: 1
                NumBusyWorkers: 0
                NumIdleWorkers: 32
    
            JobStorageLocation: Database on MyCluster@ec2-111-11-11-11.compute-1.amazonaws.com
             ClusterMatlabRoot: /mnt/matlab
               OperatingSystem: unix
       RequiresOnlineLicensing: true
       PreferredPoolNumWorkers:
    
        Associated Jobs:
    
          Number Pending: 0
           Number Queued: 0
          Number Running: 0
         Number Finished: 0

    Create a cluster profile from the cluster object.

    saveAsProfile(c,"myCloudCluster");

    Fetch all running cloud clusters that you have access to. If you have access to multiple running cloud clusters, the fetchCloudClusters function returns an array of cluster objects for all running cloud clusters.

    cloudclusters = fetchCloudClusters
    cloudclusters = 
    
     1x3 MJSComputeCloud array:
     
                      Type    Profile                Name
           ----------------------------------------------
        1  MJSComputeCloud             smallCloudCluster
        2  MJSComputeCloud             largeCloudCluster
        3  MJSComputeCloud             mediumCloudCluster

    To use the cloud cluster with the name LargeCloudCluster, specify the cluster object with the Name property value of LargeCloudCluster to another variable with the name largeCluster.

    largeCluster = cloudclusters(2);

    Create and submit a job to the selected cloud cluster.

    j = batch(largeCluster,@rand,1,{10});

    Wait for the job to finish and retrieve the results data from the cloud.

    wait(j)
    data = fetchOutputs(j);

    Output Arguments

    collapse all

    Cloud cluster, returned as a MJSComputeCloud object or an array of MJSComputeCloud objects that represent personal or shareable running Cloud Center clusters that you own.

    To learn about MJSComputeCloud object functions and properties, see parallel.Cluster.

    Version History

    Introduced in R2012a