Why do I receive "Error due to multiple causes" error when running a Simulink model with PARFOR (Parallel Job) in Parallel Computing Toolbox 5.0 (R2010b)?

48 visualizaciones (últimos 30 días)
I am trying to run a Simulink model inside of PARFOR (Parallel Job) to speed up a parameter sweep on the model. The model works fine in a sequential script (FOR loop), but when I execute it inside of PARFOR (Parallel Job) I receive the following error:
Error due to multiple causes
How can I debug this issue?

Respuestas (1)

Sanchali Purandare
Sanchali Purandare el 16 de En. de 2011
The error message is caused by one of three following causes:
- The Simulink model is unable to locate variables which it needs to run correctly inside of PARFOR.
To debug this issue place the SIM command calling the Simulink model inside of a TRY CATCH block as demonstrated below, and attempt to execute the model again. By placing the SIM command inside of the TRY CATCH block you will be able to identify all the variables that the model expects in the global workspace, and which are not present on the workers when the model is called.
parfor i = 1:N
try
sim('my_model');
catch exception
error_var{i} = lasterror
stack_var{i} = dbstack
exception_var{i} = getReport(exception,'extended')
end
end
The contents of error_var, stack_var, exception_var will be useful in determining the missing variables.
Please be aware that Simulink requires are input variables to be present in the 'base' workspace. To ensure that the missing variables are placed inside of the worker 'base' workspace use the ASSIGNIN command:
assignin('base','var_name',var_name);
Also the model always returns output variables either to the global workspace or as the output of the SIM command. If you don't specify the output variable for the SIM command and the model outputs variables which you need to return back to the calling program or to the client, or the model is called from within a function, you will need to use the EVALIN function to copy these variables to the local function workspace as follows:
a = evalin('base','var_name');
- The Simulink model is run in accelerated mode and tries to compile itself across multiple instances at the same time causing file corruption.
For information on how to resolve model compilation issues please review the following section of documentation by typing the following in the MATLAB Command Window:
web([docroot,'/toolbox/simulink/ug/brsk2gr.html#brsk7ls'])
You may access the same information on the following webpage:
- You can also debug the Simulink model by placing it inside of an SPMD statement, or submitting it as a parallel job. When you submit the simulation as the parallel job, the errors will be included in the Parallel Task Error and ErrorMessage properties.
More information about ErrorMessage property of the Task object is available by typing the following in the MATLAB Command Window:
web([docroot,'/toolbox/distcomp/errormessage.html'])
You may access the same information on the following webpage:
Note that when debugging a model using parallel jobs, there might be File and Path Dependencies that might have to me satisfied before the model starts executing correctly. More information about Path and File Dependencies is available by typing the following in the MATLAB Command Window:
web([Dorothy,'/toolbox/disco/pathdependencies.html'])
web([Dorothy,'/toolbox/disco/filedependencies.html'])
You may access the same information on the following debagged:

Categorías

Más información sobre Discrete Events and Mode Charts en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by