Parallel building of Referenced Models ignores Path

5 次查看(过去 30 天)
Hi
I have a .prj file which sources the paths for my project. In the project, there's main model with several reference models inside it. Each one of the referenced models loads variables into its model workspace using Data source: Matlab File, and the file name is a relative path (has to remain relative) to a script which loads the variables. When I build my Top model using serial building of referenced models, it builds with no issues. If I set it to build the referenced models in parallel, I get an error that says it can't load the scripts for loading model workspaces. If I change the path to model workspaces to absolute paths, it works, which means that parallel workers are not mirroring the path from the client.
There's a similar problem here, although this one concerns parallel simulation rather than building
Am I correct in thinking this a bug or is there something I can do differently.

回答(1 个)

Sarthak
Sarthak 2024-4-17
Hello Mahdi,
I think when you build models in parallel, each worker in the parallel pool operates in its own separate workspace and does not inherently share the same current folder or path settings as the client (the main MATLAB session where you initiated the build). This is why relative paths work when building serially (because the single MATLAB session retains the path context) but fail when building in parallel (because the workers start with their default paths, which likely don't include the directories your project relies on).
Initializing workers for build might help you achieving this. Please refer to the following documentation for the same:
However if the issue persists, please create a technical support ticket below:
Cheers!

类别

Help CenterFile Exchange 中查找有关 Dependency Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by