currentProject() function in Parallel Computing Toolbox
5 ビュー (過去 30 日間)
古いコメントを表示
I have a workflow that uses the MATLAB project functions to retrieve information from the MATLAB project. I use currentProject() to get the matlab.project.Project object.
I am trying to run this workflow using the Parallel Computing Toolbox, but seems that the MATLAB project is not available in the MATLAB workers.
Tested it using this code:
parpool(2);
spmd
currentProject();
end
Does the MATLAB project gets transferred into the MATLAB workers, or only the MATLAB path?
Any workaround about how can I pull the Project Reference information in a distributed environment?
Thanks in advance!
0 件のコメント
採用された回答
Sean de Wolski
2023 年 2 月 14 日
You can open the project on all workers before the loop with parfevalOnAll.
gcp
rf = currentProject().RootFolder
parfevalOnAll(@()openProject(rf), 0)
parfor ii = 1:4
disp(currentProject().RootFolder)
end
2 件のコメント
Simon
2024 年 8 月 7 日
I was having a similar issue with a test suite (and runInParallel) That solution works thank you @Sean de Wolski
In the future will this be changed so that the open projects are instantiated on the workers without user input? Or is this the intended behavior?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Programming Utilities についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!