Instead of running a Polyspace® analysis on your local desktop, you can send the analysis to a remote cluster. You can use a dedicated cluster for running Polyspace to free up memory on your local desktop.
This topic shows how to use Windows® or Linux® scripts to send the analysis to a remote cluster and download the results to your desktop after analysis.
To offload an analysis from the Polyspace user interface, see Send Polyspace Analysis from Desktop to Remote Servers.
For a simple tutorial that walks through all the steps for offloading a Polyspace analysis, see Send Bug Finder Analysis from Desktop to Locally Hosted Server. In the tutorial, the same computer acts as the client and the server.
![]()
After the initial setup, you can submit a Polyspace analysis from a client desktop to a server. The client-server workflow happens in three steps. All three steps can be performed on the same computer or three different computers.
Client node: You specify Polyspace analysis options and start the analysis on the client desktop. The initial phase of analysis up to compilation runs on the desktop. After compilation, the analysis job is submitted to the server.
You require the Polyspace desktop product, Polyspace Bug Finder™ on the computer that acts as the client node.
Head node: The server consists of a head node and several worker nodes. The head node uses a job scheduler to manage submissions from multiple client desktops. The jobs are then distributed to the worker nodes as they become available.
You require the product MATLAB® Parallel Server™ on the computer that acts as the head node.
Worker nodes: When a worker becomes available, the job scheduler assigns the analysis to the worker. The Polyspace analysis runs on the worker and the results are downloaded back to the client desktop for review.
You require the product MATLAB Parallel Server on the computers that act as worker nodes. You also require the Polyspace server products, Polyspace Bug Finder Server™ and/or Polyspace Code Prover™ Server to run the analysis.
![]()

![]()
Before you run a remote analysis by using scripts, you must set up communication between a desktop and a remote server. See Install Products for Submitting Polyspace Analysis from Desktops to Remote Server.
![]()
To run a remote analysis, use this command:
polyspaceroot\polyspace\bin\polyspace-bug-finder -batch -scheduler NodeHost|MJSName@NodeHost [options] [-mjs-username name]
is the
installation folder of Polyspace desktop products, for instance, polyspacerootC:\Program
Files\Polyspace\R2021a.
is the name of
the computer that hosts the head node of the MATLAB
Parallel Server cluster.NodeHost
is the name of
the MATLAB Job Scheduler on the head node host.MJSName
If you set up communications with a cluster from the Polyspace user interface, you can determine
and
NodeHost from the
user interface. Select Metrics > Metrics and Remote Server Settings. Open the MATLAB
Parallel Server Admin Center. Under MATLAB Job
Scheduler, see the Name and
Hostname columns for
MJSNameMJSName and
NodeHost.
If you use the startjobmanager command to start the
MATLAB Job Scheduler,
is the
argument of the option MJSName-name. For details, see Configure Advanced Options for MATLAB Job Scheduler Integration (MATLAB Parallel Server).
are the analysis
options. These options are the same as that of a local analysis. For
instance, you can use these options:options
-sources-list-file: Specify a text file
with one source file name per line.
-options-file: Specify a text file with
one option per line.
-results-dir: Specify a download folder
for storing results after analysis.
For the full list of options, see Analysis Options in Polyspace Bug Finder. Alternatively, you can:
Start an analysis in the user interface and stop after compilation. You can obtain the text files and scripts for running the analysis at the command line. See Configure Polyspace Analysis Options in User Interface and Generate Scripts.
Enter polyspace-bug-finder -h. The list of
available options with a brief description are
displayed.
Place your cursor over each option on the Configuration pane in the Polyspace user interface. Click the More Help button for information on the option syntax and when the option is required.
is the username
required for job submissions using MATLAB
Parallel Server. hese credentials are required only if you use a security
level of 1 or higher for MATLAB
Parallel Server submissions. See Set MATLAB Job Scheduler Cluster Security (MATLAB Parallel Server).name
The analysis executes locally on your desktop up to the end of the compilation
phase. After compilation, the software submits the analysis job to the cluster and
provides a job ID. You can also read the ID from the file ID.txt
in the results folder. To monitor your analysis, use the
polyspace-jobs-manager command with the job ID.
If the analysis stops after compilation and you have to restart the analysis, to
avoid rerunning the compilation phase, use the option -submit-job-from-previous-compilation-results.
![]()
To manage multiple remote analyses, use the option -batch. For
instance:
polyspaceroot\polyspace\bin\polyspace-jobs-manager action -scheduler schedulerName
Run Bug Finder or
Code Prover analysis on a remote cluster (-batch). Here:
is your
MATLAB installation folder.polyspaceroot
is one of
the following:schedulerName
Name of the computer that hosts the head node of your
MATLAB
Parallel Server cluster
(NodeHost).
Name of the MATLAB Job Scheduler on the head node host
().MJSName@NodeHost
Name of a MATLAB cluster profile
(). ClusterProfile
For more information about clusters, see Discover Clusters and Use Cluster Profiles (Parallel Computing Toolbox)
If you do not specify a job scheduler,
polyspace-job-manager uses the scheduler
specified in the Polyspace preferences. To see the scheduler name, select Tools > Preferences. On the Server Configuration tab, see
the Job scheduler host name.
refers to the
possible action commands to manage jobs on the scheduler:action
listjobs:
Generate a list of Polyspace jobs on the scheduler. For each job, the software produces this information:
ID — Verification or
analysis identifier.
AUTHOR — Name of
user that submitted job.
APPLICATION — Name
of Polyspace product, for example, Polyspace
Code Prover or Polyspace
Bug Finder.
LOCAL_RESULTS_DIR —
Results folder on local computer, specified
through the Tools > Preferences > Server Configuration tab.
WORKER — Local
computer from which job was submitted.
STATUS — Status of
job, for example, running and
completed.
DATE — Date on which
job was submitted.
LANG — Language of
submitted source code.
download -job
ID
-results-folder
FolderPath:
Download results of analysis with specified ID to folder
specified by FolderPath.
When the analysis job is queued on the server, the command
polyspace-bug-finder returns a job id. In
addition, a file ID.txt in the results
folder contains the job ID in this
format:
job_id;server_name:project_name version_number
92;localhost:Demo 1.0.If you do not use the -results-folder
option, the software downloads the result to the folder that
you specified when starting analysis, using the -results-dir option.
After downloading results, use the Polyspace user interface to view the results.
getlog -job
:ID
Open log for job with specified ID.
remove -job
:ID
Remove job with specified ID.
promote -job
:ID
Promote job with specified ID in the queue.
demote -job
ID
Demote job with specified ID in the queue.
![]()
In Windows, to avoid typing the commands each time, you can save the commands in a batch file. In Linux, you can relaunch the analysis by using a shell script. To create a batch file for running analysis:
Save your analysis options in a file
listofoptions.txt. See -options-file.
Create a file launcher.bat in a text editor like
Notepad.
In the file, enter these commands:
echo off set POLYSPACE_PATH=polyspaceroot\polyspace\bin set RESULTS_PATH=C:\Results set OPTIONS_FILE=C:\Options\listofoptions.txt "%POLYSPACE_PATH%\polyspace-bug-finder.exe" -batch -scheduler localhost -results-dir "%RESULTS_PATH%" -options-file "%OPTIONS_FILE%" pause
polyspaceroot is the Polyspace installation folder.
is the
name of the computer that hosts the head node of your MATLAB
Parallel Server cluster. localhost
Replace the definitions of these variables in the file:
POLYSPACE_PATH: Enter the actual
location of the .exe file.
RESULTS_PATH: Enter the path to a
folder. The files generated during compilation are saved in
the folder.
OPTIONS_FILE: Enter the path to the
file listofoptions.txt.
Double-click launcher.bat to run the
analysis.
Tip
If you run a Polyspace analysis, a Windows
.bat or Linux
.sh file is generated. The file is in the
.settings subfolder in your results folder. Instead of
writing a script from scratch, you can relaunch the analysis using this
file.
Run Bug Finder or
Code Prover analysis on a remote cluster (-batch)