Multicore Support
The evaluation of model equations for calculations of derivatives for continuos-time integration can be parallelized for using multicore processing.
This feature is activated by setting the option Advanced.ParallelizeCode=true;
.
The number of cores is automatically figured out.
- Hyperthreading is included in the number, i.e. a dualcore processor is seen as 4 cores, and a quadcore as 8 cores.
- The calculated number of cores is seen in the command log.
If a certain number of cores are to be used (including hyperthreading), the option Advanced.NumberOfCores
can be set to any (positive) number of cores. This value overrides the automatically calculated value. An example of using this option is when you want to create code for a computer with a higher number of cores than the computer you work on. To use the automatically calculated number of cores, set this option to 0. (This is also the default value of the option.)
- You must use a compiler that supports OpenMP, that is, you must use any of:
- Visual Studio Professional Edition version 2010 or later
- Visual Studio Express Edition version 2012 or later
- MinGW GCC version 4.9.2 or later
- Intel Parallel Studio XE 2016 or later
- Multicore execution is currently only supported for the integrators DASSL, LSODAR, Euler, and Rkfix, when neither using DLL nor embedded server (DDE).
- When using external functions in parallel code, it is assumed that the functions are not thread-safe, see next section.
- For source code generation the generated C-code contains standard OpenMP-pragmas that are supported by many compilers (see their documentation).
The equations are analyzed at translation to find out which equations that can be executed in parallel. The result is a sequence of layers, where the layers have sections that can be executed in parallel. This result is presented in the command log. See Applying Multicore Simulation for an example, including information about the log messages.