Main Content

Integrate MATLAB Online Server with Parallel Computing Toolbox and MATLAB Parallel Server

Intended Audience

IT administrators configuring Parallel Computing Toolbox™ and MATLAB® Parallel Server™ for end users. For information on using these products in the MATLAB Online Server™ environment, see Perform Database Queries in MATLAB Online Hosted by Your Organization.

Using MATLAB Parallel Server and Parallel Computing Toolbox, your MATLAB Online™ end users can use parallel computing to speed up their workflows. To enable parallel computing, you must update the MATLAB Online Server configuration in the MATLAB pool override file.

Configure Support in MATLAB Pool

To enable a version of MATLAB to have access to parallel computing resources, in the matlab-pool.yaml file of your MATLAB Online Server install overrides directory, specify these fields:

pct:
  enabled: true
  defaultPoolSize: 2
  defaultPoolAutoCreate: true

matlabProcessConfiguration:
  enableLocalParCluster: true

These values configure the installation so that:

  • Parallel Computing Toolbox is available to all MATLAB Online Server users.

  • The default pool size of the Parallel Computing Toolbox pools is 2.

  • If the user runs MATLAB code containing 'parfor' or 'spmd', the server automatically creates a default parallel pool using parpool.

  • The default parcluster, accessed through parpool, is set to 'local'.

Additionally, this configuration enables the MATLAB process to use local MATLAB workers on the same Kubernetes® node that the MATLAB Docker® containers are running on.

To configure MATLAB instances to use an on-premises cluster but not enable the use of local MATLAB workers on the Kubernetes nodes running MATLAB, set these values instead.

pct:
  enabled: true

matlabProcessConfiguration:
  enableLocalParCluster: false

Enable Use of On-Premises MATLAB Job Scheduler

By default, MATLAB Online Server allows the MATLAB process access to the minimum number of network ports required for it to run properly. To enable use of the MATLAB Job Scheduler, update the configuration YAML files to allow egress from the Kubernetes cluster to the ports required to run the scheduler. For more details on the MATLAB Job Scheduler, see How Parallel Computing Software Runs a Job (Parallel Computing Toolbox)

  1. Update the matlab-pool.yaml overrides file with the required port information for the scheduler. Make your changes in the networkPolicy section of the YAML file. For more details, see Configure Network Policies. For example:

    networkPolicy:
      enabled: true
      additionalAllowedPorts:
      # Replace XXXX with required port configuration
      - port: XXXX
        protocol: "TCP"
      - port: XXXX
        protocol: "UDP"
      # Specify any additional port configurations
    
  2. Deploy the change to the cluster using the following command. Replace <namespace-name> with your MATLAB Online Server namespace.

    ./mosadm upgrade matlab-pool --namespace <namespace-name>
  3. Validate the change by confirming that your changes appear in the Kubernetes network policy. To view this network policy, run this command, replacing <namespace-name> with your MATLAB Online Server namespace.

    kubectl describe networkPolicy --namespace <namespace-name>

Enable Use of Third-Party Schedulers

MATLAB Online Server supports third-party schedulers with limited functionality. To learn more and to get help enabling third-party schedulers in MATLAB Online Server, contact support. See Contact Technical Support About MATLAB Online Server Issues.

End-User Support

After you integrate MATLAB with Parallel Computing Toolbox and MATLAB Parallel Server, provide end users with information on using parallel computing in the MATLAB Online Server environment. See Use Parallel Computing in MATLAB Online Hosted by Your Organization.

If you are administering the MATLAB Parallel Server cluster, for information on uploading cluster profiles for Parallel Computing Toolbox end users, see Set Up Resources in Admin Center (MATLAB Parallel Server).

Related Topics