¿Puedo saber qué 'worker' realiza cada ejecución del lazo parfor?

1 view (last 30 days)
Cuando se realiza un lazo parfor, quiero saber si se puede conocer qué 'worker' realiza cada iteración

Answers (1)

Shivani
Shivani on 14 May 2024
Please note that I will be answering the question in English as my knowledge of Spanish is limited.
To offer a more accurate solution, it would be helpful to have additional context regarding the specific reasons for wanting to identify which worker is executing each iteration. As far as I understand, MATLAB does not provide a direct way to determine the exact worker executing a given task within a ‘parfor loop.
It's important to note that the implementation of parfor automatically distributes the loop's iterations among the workers. You can utilize the parforOptions function to effectively control the distribution of the load to the worker nodes.
Please refer to the MATLAB documentation link for more details on how to use this function to control the partitioning of iterations among the workers: https://www.mathworks.com/help/releases/R2019b/parallel-computing/parforoptions.html?s_tid=doc_ta
Hope this resolves your query!
  1 Comment
Policarpo Abascal
Policarpo Abascal on 14 May 2024
Thank you for the provided response. They have replied that with the 'getCurrentTask' command, I can achieve the goal of my question. Thank you anyway.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!