Parallelly use calling function
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Astarag Chattopadhyay
am 5 Apr. 2017
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.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!