Why is 'TransferB​aseWorkspa​ceVariable​s' not recommended for parsim and batchsim?

35 views (last 30 days)
I notice a warning in the MATLAB editor that says that the 'TransferBaseWorkspaceVariables' option is not recommended for parsim and batchsim. Why is that and what is an alternative approach I can use?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 13 Feb 2024
Edited: MathWorks Support Team on 13 Feb 2024
'TransferBaseWorkspaceVariables' is an effective way to get simple simulations running in parallel quickly, when at a small scale. However, as you scale up your number of simulations and workers, it is recommended to not use 'TransferBaseWorkspaceVariables'. The reason being that 'TransferBaseWorkspaceVariables' does not try to filter which Base Workspace variables are related to simulation and which are not. This design favors flexibility for users, however, a risk is that it can be easy to accidentally send large variables to workers that aren't needed for simulation. A common example is big data from a previous run of parsim/batchsim that is lingering in the Base Workspace. These large, unneeded variables will be copied to each worker. This multiplying effect can quickly exhaust computer resources and reduce performance. 
Moving to a different data management strategy can resolve this issue, by more explicitly defining which data in required for simulation and which is not. Consider using a Simulink Data Dictionary or the Model Workspace instead of the Base Workspace. This avoids the need for the "TransferBaseWorkspaceVariables" option. If using Base Workspace variables is required, consider some of the approaches outlined in the blog post below:

More Answers (0)

Categories

Find more on Run Multiple Simulations in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!