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

1 回表示 (過去 30 日間)
Policarpo Abascal
Policarpo Abascal 2024 年 5 月 2 日
コメント済み: Policarpo Abascal 2024 年 5 月 14 日
Cuando se realiza un lazo parfor, quiero saber si se puede conocer qué 'worker' realiza cada iteración

回答 (1 件)

Shivani
Shivani 2024 年 5 月 14 日
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 件のコメント
Policarpo Abascal
Policarpo Abascal 2024 年 5 月 14 日
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.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!