Issue with Simulink Model Simulation using CVSIM command inside Parfor ?

6 ビュー (過去 30 日間)
Shivaputra Narke
Shivaputra Narke 2019 年 2 月 27 日
コメント済み: Shivaputra Narke 2019 年 4 月 25 日
Hi,
I am trying to run multiple simulations with different data set on model 'ModelTest.slx' using parfor.
my code goes like this,
parfor
...
...
testObj = cvtest(model);
testObj.settings.decision = 1;
testObj.settings.condition =1;
tempData.data = cvsim(testObj);
...
..
end
I am getting below error after execution
Caused by:
Error using cvsim
Transparency violation error.
Below are the details of matlab version and model settings,
Matalb 2015b,
parpool with local profile.
Simulation Mode : Normal;
Solver :Fixed Step, discrete
Does anyone have any idea about this error. ?
Or Is there any other way we can extract the coverage information without using "CV" functions. ?

採用された回答

Edric Ellis
Edric Ellis 2019 年 2 月 28 日
Caveat: I know nothing about cvtest or cvsim. I suspect that cvsim is trying to inspect the calling workspace - this is not allowed inside parfor, and causes a "transparency violation". (This slightly cryptic term simply means that all accesses to variables must be "transparent" - i.e. obvious in the text of the program.)
Often, the simplest route is to pop the body of your parfor loop into a separate function, so you'd do:
parfor idx = ...
out(idx) = myCvSim(idx,model)
end
...
function out = myCvSim(idx,model)
testObj = cvtest(model);
...
out = cvsim(testObj);
end
  3 件のコメント
Pat Canny
Pat Canny 2019 年 3 月 18 日
Just as a note: beginning with R2018b, you can collect coverage when using parsim. This might simplify your workflow. In older releases, Edric's solution is the way to go.
Shivaputra Narke
Shivaputra Narke 2019 年 4 月 25 日
Thanks for the update I will try once I get 2018b. For now, I'm still using Matlab 2015b and 2017b.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeParallel for-Loops (parfor) についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by