How to fix an error in Parallel Processing?
이전 댓글 표시
Dear All,
When I tried to use parfor to run my code, I always got the following error message (I defined the variable "red" at different places but still got this error message):
"An UndefinedFunction error was thrown on the workers for 'red'. This might be because the file containing 'red' is not accessible on the workers. Use addAttachedFiles(pool, files) to specify the required files to be attached. For more information see the documentation for 'parallel.Pool/addAttachedFiles'.
Caused by:
Undefined function or variable 'red'."
It is weird for me because I tried to define "red" at different place but still cannot fix this problem. Thanks a lot for your great help in advance.
Best regards,
Benson
댓글 수: 7
Walter Roberson
2019년 8월 31일
parfor might be thinking that red is a function instead of a variable. Thta can especially occur if you "poofed" red into existance by defining it in a script, or you used load() without an output argument to define red
Benson Gou
2019년 9월 3일
Walter Roberson
2019년 9월 3일
I suspect we will need to see your code.
Benson Gou
2019년 9월 4일
Walter Roberson
2019년 9월 4일
S0 and Ind_MixM0 are not assigned to in this code. That implies that S0(red) and Ind_MixM0(red, 1) can be precalculated and assigned to variables, and then red would not be needed inside the loop.
Benson Gou
2019년 9월 4일
Walter Roberson
2019년 9월 4일
If you cannot post your actual code here, then I think you will need to open a support case. (Which might be needed anyhow, as the solution might not be obvious to the outside volunteers.)
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Parametric Modeling에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!