Configure MATLAB Job Scheduler Using Command-Line Scripts - MATLAB & Simulink (original) (raw)
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.
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 themjs
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.
In releases before R2019a, the service is calledmdce
. 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_`oldmatlabroot`_/toolbox/parallel/bin/mjs_def.sh
file to point to a folder for which you have write privileges:CHECKPOINTBASE
,LOGBASE
,PIDBASE
, andLOCKBASE
if applicable. In releases before R2019a, this file is_`oldmatlabroot`_/toolbox/distcomp/bin/mdce_def.sh
instead. - On 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 calledmdce
. 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
Service
You must install themjs
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: - Start the
mjs
service by typing the command: - Repeat the instructions of this step on all worker nodes.
As an alternative to items a-d, you can install and start themjs
service on nodes remotely from one machine by typing:
cd _matlabroot_\toolbox\parallel\bin
ssh hostA mjs install
ssh hostA mjs start
wherehostA
refers to a remote host. For more information on yourssh
utility, see the usage reminder by typing:
Once installed, themjs
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 theMATLAB 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 -remotehost -v - Verify that the MATLAB Job Scheduler is running on the intended host.
nodestatus -remotehost
Note
If you are executingstartjobmanager
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.
- In your Windows command prompt, navigate to the folder with the startup scripts:
- Start the Workers
Note
Before you can start a worker on a machine, themjs
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
-jobmanager -remotehost -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 - Verify that the workers are running.
nodestatus -remotehost - 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 aboutmjs
, MATLAB Job Scheduler, and worker processes, such as how to shut them down or customize them, see MATLAB Job Scheduler Configuration and Management.
- Navigate to the folder with the startup scripts:
Start mjs
Service, MATLAB Job Scheduler, and Workers (UNIX)
- Start the
mjs
Service
On each cluster node, start themjs
service by typing the commands:
cd matlabroot/toolbox/parallel/bin
./mjs start
Alternatively, you can start themjs
service on nodes remotely from one machine by typing
cd 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
wherehostA
,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 yourssh
utility, see the usage reminder by typing:
Alternatively, you can access the system reference manual by typing: - 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 theMATLAB 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 -remotehost -v - Verify that the MATLAB Job Scheduler is running on the intended host:
./nodestatus -remotehost
Note
If you have more than one MATLAB Job Scheduler on your cluster, each must have a unique name.
- Navigate to the folder with the startup scripts:
- Start the Workers
Note
Before you can start a worker on a machine, themjs
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
-jobmanager -remotehost -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 - Verify that the workers are running. Repeat this command for each worker node:
./nodestatus -remotehost
MATLAB Parallel Server supports MATLAB Job Scheduler clusters with up to 10,000 workers. (since R2023b)
For more information aboutmjs
, MATLAB Job Scheduler, and worker processes, such as how to shut them down or customize them, see MATLAB Job Scheduler Configuration and Management.
- Navigate to the folder with the startup scripts:
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).