Main Content

pctconfig

Configure settings for Parallel Computing Toolbox client session or MATLAB Parallel Server workers

Description

example

pctconfig(Name,Value) sets configuration properties for the client session or workers using name-value arguments.

Name-value arguments can be in any format supported by the set function, i.e., character vectors, structures, and cell arrays. If you provide name-value arguments using a structure, the structure field names must be the property names and the field values must specify the property values.

config = pctconfig(Name,Value,...) also returns configuration settings as the structure config. The field names of the config contain the property names, while the field values contain the property values.

config = pctconfig() returns the current configuration settings as the structure config. If you have not set any values, these are the default values.

Examples

collapse all

This example shows how to configure the settings for a Parallel Computing Toolbox™ client session.

View the default settings for hostname and ports.

config = pctconfig()
config = 

  struct with fields:

           portrange: [27370 28370]
            hostname: 'machine-32'
    poolstarttimeout: 20 min

Set the current client session port range to 21000-22000 with hostname fdm4.

pctconfig('hostname','fdm4','portrange',[21000 22000]);

Set the client hostname to a fully qualified domain name.

pctconfig('hostname','desktop24.subnet6.companydomain.com');

Since R2023a

This example shows how to specify which listening ports a MATLAB® Parallel Server™ worker must open.

Set the worker to open a listening port in the range 27350 – 27424 using the poolStartup.m file.

The poolStartup.m file runs automatically on a worker each time the worker forms part of a parallel pool. For information about the poolStartup.m file, see poolStartup. Add the following code to the poolStartup.m file:

pctconfig(portrange=[27350 27424])

Input Arguments

collapse all

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'hostname','desktop24.subnet6.companydomain.com'

Name of host of the client session, specified as a character vector.

This property is useful when the client computer is known by more than one hostname. Specify a hostname by which the cluster nodes can contact the client computer. Parallel Computing Toolbox supports both short hostnames and fully qualified domain names.

Range of ports to use when opening a listening port, specified as one of the following:

  • two-element vector — Specify the range of ports to use, in the form [minport, maxport]

  • 0 — Specify ephemeral ports

By default, the client session searches for available ports to communicate with MATLAB Parallel Server workers.

In R2023a: MATLAB Parallel Server workers use the range of port numbers to listen for connections from the client session when you create an interactive parallel pool. To open a listening port on a worker, specify a value for 'portrange' in the poolStartup file. For an example, see Configure Settings on Worker.

Output Arguments

collapse all

Configuration settings, returned as a structure.

Tips

The values set by this function do not persist between MATLAB client or worker sessions. To ensure your configuration settings are correct, use pctconfig before calling any other Parallel Computing Toolbox functions.

Version History

Introduced in R2008a

expand all