Nested parfor loops ( a statement within a parfor loop calls a function which also contains a parfor loop)

Hi all
I need to use a parfor loop to speed up the code running. However, it reports errors when a statement within this parfor loop (marked in dFC.m, line 45) calls a function which also contains a parfor loop (marked in multilayerNetFunc.m, line 28). I can run them smoothly if I change either of them into 'for-loop'. I have been trying to find the solution by google and looking up the information in this community. But haven't found the right tips.
I really need these two parfor loops stay in position or it will be a week-long process for my computer.
Wish somebody could help me to figure out the solution!
Thanks!
ps: The two scripts have been attached to this post.

댓글 수: 7

Actually, I found that only when partitionTimes=4, can the parfor loop of multilayerNetFunc run given that no parfor-loop set in dFC.m. Otherwise, the running will report similar errors I thought that might be the loop nested within this parfor regardless of the parfor loop in dFC.m. I though it might be caused by the loop nested within the parfor-loop of multilayerNetFunc, so I replaced the loop with a function (defining the loop as a new function). However, the errors still occured. I am exhausted. Looking forward to somebody who can give me a hand!
Haven't found the solution yet. If anyone has ideas please don't hesitate to leave a message. Your advice may be helpful!
I think you would have to provide a runable version of your code (one which reproduces the issue, of course) in order for anyone to help. What you've currently posted can't be run, because it references folders and data local to you.
Ok~ Thank you very much! I'll see what I can do to upload the runable version. Sorry, I didn't realize this is necessary. The original code needs to call a couple of neuroimaging processing packages. I'll try to replace the input with modelling data and provide the code later. I really hope someone could help me to solve this problem! Thanks!
Hi
I have been struggling to make the parfor-loops in dFC.m & multilayerNetFunc.m feasible. But haven't found the solution yet. I have attached the runable version of my code with this post. However, this community doesn't allow to upload packages, I am not sure if without the complete package-(genlouvain:http://netwiki.amath.unc.edu/GenLouvain/GenLouvain) the major script dFC.m still can run smoothly. Nevertheless, I still wish somebody could help me to solve this problem! Thanks!

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

질문:

2020년 2월 19일

댓글:

2020년 2월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by