Use Parallel Computing Toolbox in Deployed Applications

There are two ways to pass a cluster profile to a standalone application that uses the Parallel Computing Toolbox™:

  1. Save the cluster profile to your MATLAB® preferences.

    The cluster profile will be automatically bundled with the generated application and available to the Parallel Computing Toolbox code.

  2. Embed the cluster profile in the application.

Embed Parallel Computing Toolbox Profile in the Application

To embed a Parallel Computing Toolbox profile in an application, you must ensure that the application loads a Parallel Computing Toolbox profile. You have two options for loading a profile:

  • load the cluster profile in the compiled MATLAB function

    function run_parallel_funct
    setmcruserdata('ParallelProfile', 'profile');
    a = parallel_funct
    end
  • load the cluster profile in the application calling the MATLAB function

    mxArray *key = mxCreateString("ParallelProfile"); 
    mxArray *value = mxCreateString("\usr\userdir\config.settings");
    if (!setmcruserdata(key, value))
    {
        fprintf(stderr, 
                "Could not set MCR user data: \n %s ",
                mclGetLastErrorMessage());
        return -1;
    }

When you package and deploy an application that uses Parallel Computing Toolbox you must ensure that the Parallel Computing Toolbox profile is included along with the application. The profile must also be placed in the location expected by the application.

Was this topic helpful?