Parallelly use calling function
9 ビュー (過去 30 日間)
古いコメントを表示
I want to use parfor but it doesn't work. Now I found the reason is that I call a function in the loop. In that function, I compared two arrays (the two arrays are generated at the beginning of the loop). However, MATLAB doesn't parallelly compute the calling function. Instead, it starts to compare arrays in different loops. So my question is that how could I use the calling function parallelly, just like I run the programming on different computers?
Thanks
1 件のコメント
Astarag Chattopadhyay
2017 年 4 月 5 日
This is an expected behavior I guess. An iteration happens on a single worker, out of the “n” workers available. In this iteration if we have 2 function calls then these functions will be executed serially on that worker and simultaneously another worker will handle another iteration. Thus in your case two workers are executing two separate iterations sequentially and arrays from different iterations are getting compared.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!