How are Extrinsic Functions Handled When Executing Parallel Simulations with parsim() ?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Suppose a Simulink simulation that contains a Matlab Function block that calls another function declared as extrinsic with @doc:coder.extrinsic.
If multiple simulations are executed in parallel with @doc:parsim, a) does each worker get its own instance of the Matlab engine in which the extrinsic function is executed? Or b) do all of the workers share a common Matlab engine and share the extrinsic function? Seems like the latter could be problematic if the extrinsic function contains persistent data.
As best I can tell, @doc:parfor operates in accordance with (a), but I couldn't find anything on point in the doc for @doc:parsim.
3 Kommentare
Antworten (1)
Supraja
am 1 Aug. 2025
Hello Paul,
Please find the information regarding parsim and extrinsic functions:
- parsim distributes simulations to workers in a parallel pool.
- Each worker is an independent MATLAB process with its own workspace and memory.
- The coder.extrinsic function is executed by the MATLAB engine.
- Therefore, since each worker is a separate MATLAB process, each worker uses its own instance of the MATLAB engine to execute the extrinsic function.
Siehe auch
Kategorien
Mehr zu String finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!