MATLAB Answers

Build Simulink Real-Time Applications in Parallel

5 views (last 30 days)
James
James on 17 Feb 2021
Commented: James on 23 Feb 2021
I have a large number of simulink real-time applications that I am trying to build to run on a Speedgoat system. I would like to decrease the build time by running the builds in parallel. It takes 30 minutes to build one application and there are 600+ applications so you can see that building them serially is not a good solution. The models are not dependent on eachother and they are not referenced so the standard built in functionality for parallel model reference bulids with slbuild will not work. The models use data from the base workspace (parameters, configuration reference, bus objects, etc.). I have tried to create a parfor loop detailed below where I save the workspace to a mat file and then load it on each worker before I run slbuild, but I receive the following error.
Error using parallelBuild (line 8)
Unable to find configuration: 'Model_CnfgRef' referenced by 'TC225'.
This configuration exists in the base workspace which I am loading on to each worker. Any thoughts on what I am doing wrong?
Code:
parfor i=1:length(buildCandidates)
l = load('workspace.mat');
evalin('base',['slbuild(TC',num2str(buildCandidates(i)),')']);
end
Also tried this:
parfor i=1:length(bulidCandidates)
l = load('workspace.mat');
slbuild(['TC',num2str(buildCandidates(i))]);
end
  2 Comments
James
James on 17 Feb 2021
Thanks for the suggestion. I could reach out to them, but I feel this is really an issue on the MathWorks side because it is building the Simulink Real-Time application. The Speedgoat group generally focuses on the hardware part of the setup.

Sign in to comment.

Answers (1)

Raymond Norris
Raymond Norris on 17 Feb 2021
I'm not a Simulink expert, so I'm assuming that loading the workspace (which is the same for all?) will introduce, for example, Model_CnfgRef? If so, try this.
...
parfor i=1:length(bulidCandidates)
build_model(bulidCandidates,i)
end
...
function build_model(bulidCandidates,i)
l = load('workspace.mat');
slbuild(['TC',num2str(bulidCandidates(i))]);
end
  7 Comments
James
James on 23 Feb 2021
Thanks for the help Raymond. I'll reach out to support unless someone else can jump in.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by