Parallelly use calling function

7 visualizaciones (últimos 30 días)
Peter Raphael
Peter Raphael el 2 de Abr. de 2017
Comentada: Astarag Chattopadhyay el 5 de Abr. de 2017
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 comentario
Astarag Chattopadhyay
Astarag Chattopadhyay el 5 de Abr. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by