parforでモデルを並列処理するときに、モデルのパラメータが初期化されない方法はありますか?
11 次查看(过去 30 天)
显示 更早的评论
parforを使ってモデルを並列処理するときに、モデルのパラメータが設定されていないというエラーが出ます。
並列プールを作成したときに、並列プール用のワークスペースが新規で作成されると思います。
新規で作成されたワークスペース上には変数がないため、モデルのパラメータを変数名にしているとエラーが出ると考えているのですが、この認識で合っていますか?
また、この問題を解決するために、モデルのパラメータ(新規ワークスペース上の変数)を初期化されない方法はありますか?本来のワークスペース上にある変数をそのまま使いたいのですが、無理でしょうか?
1 个评论
Walter Roberson
2016-3-16
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?
采纳的回答
mizuki
2016-10-2
编辑:mizuki
2016-10-10
新規で作成されたワークスペース上には変数がないため、モデルのパラメータを変数名にしていると
エラーが出ると考えているのですが、この認識で合っていますか?
はい,理解されているとおりです.
また、この問題を解決するために、モデルのパラメータ(新規ワークスペース上の変数)を初期化されない
方法はありますか?本来のワークスペース上にある変数をそのまま使いたいのですが、無理でしょうか?
可能です.local 環境のワークスペースから parallel 環境の MATLAB workers に変数を飛ばすことで MATLAB workers 上で元の local 環境の変数を使うことができます.
simoptions = simset('SrcWorkspace', 'Current');
sim('*.mdl', [0 10], simoptions) % ここで [0 10] はシミュレーション時間を設定しています.
とすることで現在のワークスペースの変数を各 worker に飛ばすことができます.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Least Squares 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!