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
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 Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!