Documentation Home Page ◇ ePHASORSIM Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.
Parallel Simulation
Page Content
Introduction
The activated modes of ePHASORSIM’s parallel feature are determined using the following license keys:
| ePHASORSIM parallelizes the computation of generator units (GenUnits) |
---|---|
| ePHASORSIM also parallelizes the nodal equations |
Note: If neither of the above license keys is enabled, no parallelization occurs.
The parallelization is controlled using:
the
EPHASOR_THREADS
environment variableTwo parameters in the https://opal-rt.atlassian.net/wiki/spaces/EUD/pages/23199799/Simulation+settings?atl_f=content-tree tab of the Simulink mask: Number of partitions and Optimize number of threads (Windows only)
On Windows, the recommended way to use parallelism in ePHASORSIM is to enable the Optimize number of threads algorithm option in the Solver mask.
It is not recommended to use the EPHASOR_THREADS
variable so that the algorithm can find the best setting. Defining EPHASOR_THREADS
on Windows restricts the range of number of thread-pool sizes the algorithm will test.
Note: If MATLAB is started in standalone mode (i.e. not through RT-LAB), the EPHASOR_THREADS
variable potentially defined in the RT-LAB project will not be active, unless this variable is defined explicitly as an environment variable of the machine.
On Linux, by default, ePHASORSIM uses the 3rd core (core No. 2 with zero indexing) unless the EPHASOR_THREADS
environment variable is defined. If the performance is not optimal (e.g. if there are overruns) parallelism can be controlled by defining EPHASOR_THREADS
to change the number of threads, or to control core assignment to avoid conflicts with other RT-LAB features such as ARTEMiS or some drivers.
Refer to Parallel simulation rules for a more detailed overview of how to set up parallelism in ePHASORSIM.
Parallel Simulation Rules
The following abbreviations are used throughout this guide:
NP | Number of partitions parameter, set in the mask. |
---|---|
ONT | Optimize number of threads (Windows only) algorithm, set in the mask. |
NC | Number of available physical cores of simulator. |
| |
maxNTH | maximum number of threads that can be used for parallelization. |
| |
NTH | actual number of threads used by ePHASORSIM to parallelize GenUnits (and nodal equations if NP > 1) |
|
The first and second table below summarizes calculations of NTH and also parallelization modes for Windows and Linux targets respectively.
Summary of Parallelization Modes for a Windows Target
ONT | Enabled | Disabled | ||
---|---|---|---|---|
NP |
|
|
| >1 |
NTH is calculated | optimally in the range |
| ||
Parallelization mode is applied to | GenUnits only | Entire Network | GenUnits only | Entire Network |
Summary of Parallelization Modes for a Linux Target
NP |
|
|
---|---|---|
NTH is calculated |
| |
Parallelization mode is applied to | GenUnits only | Entire Network |
EPHASOR_THREADS Syntax
The syntax for EPHASOR_THREADS
is EPHASOR_THREADS=<core_list>
, where the <core_list>
grammar is given in the following table.
Grammar of the EPHASOR_THREADS
variable
<core_list> := <elem> | <elem>,<core_list>
<elem> := <core_id> | <range>
<range> := <core_id>-<core_id>
<core_id> := <positive_integer>
Its meaning is the same on Windows and Linux, with the exception that:
On Linux, it is used to define which cores specifically will be used in the simulation (sets the affinity).
On Windows, it is used only to deduce the number of cores that the simulation will run on, but cannot assign specific cores.
For example, EPHASOR_THREADS=3
and EPHASOR_THREADS=5
mean that we want the simulation to run on only one core. On Linux, it also defines which core should be used (core 3 in the first case, core 5 in the second case).
The following examples are all valid values:
| in this case, we want to use 3 cores (on Linux, cores 2, 3, and 5) |
---|---|
| this is equivalent to |
| this is equivalent to |
If |
Definition of EPHASOR_THREADS
The EPHASOR_THREADS
variable may be defined as a user environment variable.
Users can define the variable in an RT-LAB’s project configuration, as in the following figure.
EPHASOR_THREADS
in RT-LAB.When using MATLAB directly, set EPHASOR_THREADS
as a system environment variable prior to launching MATLAB. This can be done in System Properties, as in the figure below.
Notes on Linux Targets and EPHASOR_THREADS
Care must be taken to avoid conflicts in core assignment. For example, if in the model there is a driver that uses core 4, this core should not be used in the value of
EPHASOR_THREADS
.
Otherwise, unknown behavior could occur.The core IDs are 0 indexed.
Cores 0 and 1 are reserved for RT-LAB. Only cores indexed 2 and greater are recommended for use with the
EPHASOR_THREADS
variable.Please refer to, Migration Notes, to see changes regarding
EPHASOR_THREADS
in different versions.
OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323
Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter