Configure MATLAB Job Scheduler Using Command-Line Scripts
You can start MATLAB® Job Scheduler using a graphical interface or the command line. For instructions on how to use the graphical interface, see Configure the MATLAB Job Scheduler. To use the graphical interface, Admin Center, you must run it on a computer that has direct network connectivity to all the nodes of your cluster. If you cannot run Admin Center on such a computer, you must use the command-line interface. For instructions on how to use the command-line interface, follow the next steps.
Note
If you're setting up a MATLAB Job Scheduler cluster for the first time, for a basic configuration suitable for testing and evaluation, see Install for MATLAB Job Scheduler with Network License Manager.
In the following instructions, matlabroot
refers to the
location of your installed MATLAB
Parallel Server™ software. Where you see this term used in the instructions that follow,
substitute the path to your location.
Stop mjs
Services of Old Installation
If you have an older version of MATLAB
Parallel Server running on your cluster nodes, you should stop the
mjs
services before starting the services of the new
installation.
Stop mjs
on Windows
Open a Windows® command window with administrator privileges.
In the command window, navigate to the folder of the old installation that contains the control scripts.
cd oldmatlabroot\toolbox\parallel\bin
Stop and uninstall the old service and remove its associated files by typing the following command.
mjs uninstall -clean
In releases before R2019a, the service is called
mdce
. Type the following commands instead.cd oldmatlabroot\toolbox\distcomp\bin mdce uninstall -clean
Note
Using the
-clean
flag permanently removes all existing job data. Be sure this data is no longer needed before removing it.Repeat the instructions of this step on all worker nodes.
Stop mjs
on UNIX
Log in as
root
. If you cannot log in asroot
, you must alter the following parameters in the
file to point to a folder for which you have write privileges:oldmatlabroot
/toolbox/parallel/bin/mjs_def.shCHECKPOINTBASE
,LOGBASE
,PIDBASE
, andLOCKBASE
if applicable. In releases before R2019a, this file is
instead.oldmatlabroot
/toolbox/distcomp/bin/mdce_def.shOn each cluster node, stop the
mjs
service and remove its associated files by typing the commands:cd oldmatlabroot/toolbox/parallel/bin ./mjs stop -clean
In releases before R2019a, the service is called
mdce
. Type the following command instead.cd oldmatlabroot/toolbox/distcomp/bin ./mdce stop -clean
Note
Using the
-clean
flag permanently removes all existing job data. Be sure this data is no longer needed before removing it.
Customize MATLAB Job Scheduler
Before starting the mjs
service on your cluster nodes, you can
customize additional features for your MATLAB Job Scheduler to meet your organization’s needs. To learn more about
the customizable features, see MATLAB Job Scheduler Customization and Cluster Security and Authentication.
Start mjs
Service, MATLAB Job Scheduler, and Workers (Windows)
Start the
mjs
ServiceYou must install the
mjs
service on all nodes (head node and worker nodes). Begin on the head node.Open a Windows command window with administrator privileges.
In the Windows command window, navigate to the folder with the control scripts:
cd matlabroot\toolbox\parallel\bin
Install the
mjs
service by typing the command:mjs install
Start the
mjs
service by typing the command:mjs start
Repeat the instructions of this step on all worker nodes.
As an alternative to items a-d, you can install and start the
mjs
service on nodes remotely from one machine by typing:cd matlabroot\toolbox\parallel\bin ssh hostA mjs install ssh hostA mjs start
where
hostA
refers to a remote host. For more information on yourssh
utility, see the usage reminder by typing:ssh
Once installed, the
mjs
service starts running each time the machine reboots. The mjs service continues to run until explicitly stopped or uninstalled, regardless of whether a MATLAB Job Scheduler or worker session is running.Start the MATLAB Job Scheduler
To start the MATLAB Job Scheduler, enter the following commands in a Windows command prompt. You do not have to be at the machine on which the MATLAB Job Scheduler runs, as long as you have access to the MATLAB Parallel Server installation.
In your Windows command prompt, navigate to the folder with the startup scripts:
cd matlabroot\toolbox\parallel\bin
Start the MATLAB Job Scheduler, using any unique text you want for the name
<MyMJS>
:startjobmanager -name <MyMJS> -remotehost <MATLAB Job Scheduler host name> -v
Verify that the MATLAB Job Scheduler is running on the intended host.
nodestatus -remotehost <MATLAB Job Scheduler host name>
Note
If you are executing
startjobmanager
on the host where the MATLAB Job Scheduler runs, you do not need to specify the-remotehost
flag.If you have more than one MATLAB Job Scheduler on your cluster, each must have a unique name.
Start the Workers
Note
Before you can start a worker on a machine, the
mjs
service must already be running on that machine. If you are using the network license manager, it must be running on the network.For each node you use as a worker, enter the following commands in a Windows command prompt. You do not have to be at the machines that run the MATLAB workers, as long as you have access to the MATLAB Parallel Server installation.
Navigate to the folder with the startup scripts:
cd matlabroot\toolbox\parallel\bin
Start the workers on each node, using the text for
<MyMJS>
that identifies the name of the MATLAB Job Scheduler you want this worker registered with. Enter this text on a single line:startworker -jobmanagerhost <MATLAB Job Scheduler host name> -jobmanager <MyMJS> -remotehost <worker host name> -v
To run more than one worker session on the same machine, specify the number of workers to start using the
-num
option. The worker names have'_1'
,'_2'
, and so on, appended to them.startworker ... -num <numWorkers>
Verify that the workers are running.
nodestatus -remotehost <worker host name>
Repeat items 2–3 for all worker nodes.
MATLAB Parallel Server supports MATLAB Job Scheduler clusters with up to 10,000 workers. (since R2023b)
For more information about
mjs
, MATLAB Job Scheduler, and worker processes, such as how to shut them down or customize them, see MATLAB Job Scheduler Configuration and Management.
Start mjs
Service, MATLAB Job Scheduler, and Workers (UNIX)
Start the
mjs
ServiceOn each cluster node, start the
mjs
service by typing the commands:cd matlabroot/toolbox/parallel/bin ./mjs start
Alternatively, you can start the
mjs
service on nodes remotely from one machine by typingcd matlabroot/toolbox/parallel/bin ssh hostA matlabroot/toolbox/parallel/bin/mjs start ssh hostB matlabroot/toolbox/parallel/bin/mjs start ssh hostC matlabroot/toolbox/parallel/bin/mjs start
where
hostA
,hostB
, andhostC
refers to your remote host names. For a long list of host names, you can start themjs
service on several nodes remotely from one machine by typing:for host in hostA hostB hostC; do ssh $host matlabroot/toolbox/parallel/bin/mjs start; done
For more information on your
ssh
utility, see the usage reminder by typing:ssh
Alternatively, you can access the system reference manual by typing:
man ssh
Start the MATLAB Job Scheduler
To start the MATLAB Job Scheduler, enter the following commands. You do not have to be at the machine on which the MATLAB Job Scheduler runs, as long as you have access to the MATLAB Parallel Server installation.
Navigate to the folder with the startup scripts:
cd matlabroot/toolbox/parallel/bin
Start the MATLAB Job Scheduler, using any unique text you want for the name
<MyMJS>
. Enter this text on a single line../startjobmanager -name <MyMJS> -remotehost <MATLAB Job Scheduler host name> -v
Verify that the MATLAB Job Scheduler is running on the intended host:
./nodestatus -remotehost <MATLAB Job Scheduler host name>
Note
If you have more than one MATLAB Job Scheduler on your cluster, each must have a unique name.
Start the Workers
Note
Before you can start a worker on a machine, the
mjs
service must already be running on that machine. If you are using the network license manager, it must be running on the network.For each computer hosting a MATLAB worker, enter the following commands. You do not have to be at the machines where the MATLAB workers run, as long as you have access to the MATLAB Parallel Server installation.
Navigate to the folder with the startup scripts:
cd matlabroot/toolbox/parallel/bin
Start the workers on each node, using the text for
<MyMJS>
that identifies the name of the MATLAB Job Scheduler you want this worker registered with. Enter this text on a single line:./startworker -jobmanagerhost <MATLAB Job Scheduler host name> -jobmanager <MyMJS> -remotehost <worker host name> -v
To run more than one worker session on the same machine, specify the number of workers to start using the
-num
option. The worker names have'_1'
,'_2'
, and so on, appended to them../startworker ... -num <numWorkers>
Verify that the workers are running. Repeat this command for each worker node:
./nodestatus -remotehost <worker host name>
MATLAB Parallel Server supports MATLAB Job Scheduler clusters with up to 10,000 workers. (since R2023b)
For more information about
mjs
, MATLAB Job Scheduler, and worker processes, such as how to shut them down or customize them, see MATLAB Job Scheduler Configuration and Management.
Validate Installation with MATLAB Job Scheduler
To verify that your MATLAB Parallel Server products are installed and configured correctly, create a cluster profile and validate it. For instructions, see Connect MATLAB Client to MATLAB Parallel Server Cluster. You can specify the number of workers to use when validating your profile, to avoid occupying the whole cluster. If your validation does not pass, contact the MathWorks Install Support Team, or see Troubleshoot Common Problems.
After you create a cluster profile, you can make any modifications appropriate for
your applications, such as NumWorkersRange
,
AttachedFiles
, or AdditionalPaths
. To
save your profile for other users, in the Cluster Profile Manager, select the
profile and click Export, then save your profile to a file in a
convenient location. Later, when running the Cluster Profile Manager, other users
can import your profile by clicking Import. For more
information about cluster profiles, see Discover Clusters and Use Cluster Profiles (Parallel Computing Toolbox).