How can I get thread ID in parfor loop on a thread-based parallel pool from MATLAB online server?

7 vues (au cours des 30 derniers jours)
Hi,
I have a parfor loop rounning in a thread-based pool and I would like to get thread ID in the following manner:
parpool('Threads',8);
parfor i=1:100
A(,:,:,i)=rand(2,2)^i;
% I want to get thread ID and store them in a vector for later use.
end
I tried with the syntax t = getCurrentTask(); Id_core(e)=t.ID; however it does not work and the system returns the error "getCurrentTask is not supported for thread-based parallel processing".
I would really appreciate to hear from you about this as soon as possible.
Thank you beforehand.
  1 commentaire
Edric Ellis
Edric Ellis le 31 Oct 2022
There is currently no way to get a "thread ID" in this situation. Can you say more about why you need to know? There might be a different way of handling things.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by