Main Content

startworker

R2026b

Start MATLAB worker process

After starting the mjs service on a worker node, use the startworker script to launch workers on that node. Workers execute tasks assigned by a job manager. Each worker registers with a specified job manager and waits for tasks. As a best practice, start as many workers as you have physical cores on the worker node.

The startworker executable resides in the folder matlabroot\toolbox\parallel\bin (Windows® operating system) or matlabroot/toolbox/parallel/bin (Linux® operating system). Enter the command at a Windows or Linux command-line prompt, respectively.

Syntax

startworker
startworker --options

Description

startworker starts a MATLAB® worker process under the mjs service. The mjs service must already be running on the target computer.

startworker --options accepts the following input options. You can use multiple options together in the same command, except where noted. Precede each option with two dashes (--).

Before R2026b: To specify an option, use a single dash (-).

OptionOperation
--name <worker_name>

Specify the name of the MATLAB worker. The default is the value of the DEFAULT_WORKER_NAME parameter in the mjs_def file.

--jobmanager <job_manager_name>

Specify the name of the job manager the worker registers with. The worker receives tasks from this job manager. The default is the value of DEFAULT_JOB_MANAGER_NAME in the mjs_def file.

--jobmanagerhost <job_manager_hostname>

Specify the host where the job manager is running. When you use this option, the worker uses unicast to contact the job manager lookup process on that host during registration. This option overrides the JOB_MANAGER_HOST parameter in the worker node's mjs_def file.

--clean

Delete checkpoint information from previous instances of the worker with the same name.

--num <num_workers>

Specifies the number of workers to start. The default is one. When starting multiple workers, the worker name is appended with 01, 02, and so on.

--remotehost <hostname>

Specify the host on which to start the MATLAB worker. If you do not specify a host, the worker is started on the local host.

--baseport <port_number>

Specify the base port used by the mjs service on the remote host. Use this option only when the remote host's base port differs from the local BASE_PORT value in the mjs_def file.

--secretfile <path_to_shared_secret_file>

Specify the path to the shared secret file to use to sign the command. This option is required when the mjs_def file of the mjs service has REQUIRE_SCRIPT_VERIFICATION=true. If you do not use this option and the mjs services requires script verification, the command attempts to use the secret file in the default location:

$CHECKPOINTBASE/security/secret

--verbose, -v

Display detailed progress information about the command execution.

Examples

Start a worker on the local host, using the default worker name, registering with the job manager named MyJobManager on the host JMHost.

startworker --jobmanager MyJobManager --jobmanagerhost JMHost

Start a worker on the host WorkerHost, using the default worker name, and registering with the job manager named MyJobManager on the host JMHost.

startworker --jobmanager MyJobManager --jobmanagerhost JMHost --remotehost WorkerHost

Start two workers, named worker_1 and worker_2, on the host WorkerHost, registering with the job manager named MyJobManager that is running on the host JMHost.

startworker --num 2 --name worker --remotehost WorkerHost --jobmanager MyJobManager --jobmanagerhost JMHost