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

조회 수: 7 (최근 30일)
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
Edric Ellis
Edric Ellis 2022년 10월 31일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by