Parallelly use calling function
조회 수: 6 (최근 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!