parforでモデル​を並列処理するときに​、モデルのパラメータ​が初期化されない方法​はありますか?

11 views (last 30 days)
yuki maeda
yuki maeda on 16 Mar 2016
Edited: mizuki on 10 Oct 2016
parforを使ってモデルを並列処理するときに、モデルのパラメータが設定されていないというエラーが出ます。
並列プールを作成したときに、並列プール用のワークスペースが新規で作成されると思います。
新規で作成されたワークスペース上には変数がないため、モデルのパラメータを変数名にしているとエラーが出ると考えているのですが、この認識で合っていますか?
また、この問題を解決するために、モデルのパラメータ(新規ワークスペース上の変数)を初期化されない方法はありますか?本来のワークスペース上にある変数をそのまま使いたいのですが、無理でしょうか?
  1 Comment
Walter Roberson
Walter Roberson on 16 Mar 2016
Approximate translation:
When parallel processing model using parfor, you get an error that the model parameters are not set.
When you create a parallel pool, I think the work space for parallel pool is created with the new.
Because there is no variable on the work space that has been created in the new, How can and have the parameters of the model to the variable name is an error believe that out, do you fit in this recognition?
Also, is there in order to solve this problem, a method of the model parameters (variable on the new work space) are not initialized? Although the variable that is on the original work space you want to use as it is, or would be impossible?

Sign in to comment.

Accepted Answer

mizuki
mizuki on 2 Oct 2016
Edited: mizuki on 10 Oct 2016
新規で作成されたワークスペース上には変数がないため、モデルのパラメータを変数名にしていると
エラーが出ると考えているのですが、この認識で合っていますか?
はい,理解されているとおりです.
また、この問題を解決するために、モデルのパラメータ(新規ワークスペース上の変数)を初期化されない
方法はありますか?本来のワークスペース上にある変数をそのまま使いたいのですが、無理でしょうか?
可能です.local 環境のワークスペースから parallel 環境の MATLAB workers に変数を飛ばすことで MATLAB workers 上で元の local 環境の変数を使うことができます.
simoptions = simset('SrcWorkspace', 'Current');
sim('*.mdl', [0 10], simoptions) % ここで [0 10] はシミュレーション時間を設定しています.
とすることで現在のワークスペースの変数を各 worker に飛ばすことができます.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!