parsim error: "Cannot load model on parallel workers - Caused by: A worker failed while executing a FevalOnAllFuture"
41 次查看(过去 30 天)
显示 更早的评论
HI,
I am receiving an error when using parsim for parallel simulations with Simulink.
I think it is somehow related to the number of simulations that I want to run in parallel, so that if length(batch) > number of workers of my parallel pool, then it crushes with the error below, but if length(batch) < number of workers of my parallel pool, then it runs correctly.
Here a snippet of my code:
model = 'Simulation_Model';
open(model);
model_block = '/Simulation Model';
model_mask = Simulink.Mask.get(strcat(model,model_block));
model_mask.Parameters(1,1).Value = '1';
Ts = 5; % Adjust timestep, used in the Simulink model
save_system(model,[],'OverwriteIfChangedOnDisk',true)
load('batch.mat')
for n = 1:length(batch)
Data = load(['Timeseries\bat_nr_', sprintf('%03d',batch(n).bat_nr),'_ts']);
in(n) = Simulink.SimulationInput(model);
in(n) = setVariable(in(n),'Data',Data);
in(n) = setBlockParameter(in(n),[model model_block],'val_init',num2str(Data.Data(1,2)));
end
try
delete(gcp('nocreate')) % Shut down the current pool if open
myCluster = parcluster('local'); % Open my pool
end
sim_output = parsim(in,'ShowProgress','on','TransferBaseWorkspaceVariables','on');
When running the code, I receive the following error:
[04-May-2023 11:25:21] Checking for availability of parallel pool...
Starting parallel pool (parpool) using the 'local' profile ...
Connected to the parallel pool (number of workers: 6).
[04-May-2023 11:25:42] Starting Simulink on parallel workers...
[04-May-2023 11:25:55] Configuring simulation cache folder on parallel workers...
[04-May-2023 11:25:55] Transferring base workspace variables used in the model to parallel workers...
[04-May-2023 11:32:22] Loading model on parallel workers...
[04-May-2023 11:34:14] Cleaning up parallel workers...
Error using RunMe_SimModel (line 184)
Cannot load model 'Simulation_Model' on parallel workers. If this is a demo model please ensure that it is installed on the parallel workers or copy the
model file to a location outside of matlabroot
Caused by:
A worker failed while executing a FevalOnAllFuture.
Thanks,
Juan
1 个评论
Edric Ellis
2023-5-4
The "A worker failed..." message probably means that a worker process crashed and terminated, but I can't think of a reason why it would vary in the way that you say it does... Your best bet is probably to contact MathWorks Support to try and work out what's going wrong there.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Run Multiple Simulations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!