How can I get thread ID in parfor loop on a thread-based parallel pool from MATLAB online server?
Show older comments
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 Comment
Edric Ellis
on 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.
Answers (0)
Categories
Find more on Parallel for-Loops (parfor) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!