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

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

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 Startup and Shutdown dans Centre d'aide et File Exchange

Produits

Version

R2021b

Question posée :

le 26 Oct 2022

Commenté :

le 31 Oct 2022

Community Treasure Hunt

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

Start Hunting!

Translated by