Matlab workers in Parloop are not using the path order

Hello, I'm using this code
parfor k=1:10
[..]=pca(..)
end
I have 2 definitions of pca (the matlab package and another package). I've set the search path to use the matlab package by default, but inside the parloop the other function is used instead. I didn't found a way to arrange this without removing the other package. Thanks

댓글 수: 4

Why don't you change your external package to have a different name? That's the most straight forward solution.
How did you modify your path?
I could do that, but it can be troubleosome. For instance, pca is an internal function in the package, so I have to change several lines, and the package is from a third party.
I modidify the path through the desktop app (not in code).
I would have thought if one of them was in a package that you would have to specify it with the package name prepended, which would remove the ambiguity anyway.
Xingwang Yong
Xingwang Yong 2026년 1월 29일
이동: Walter Roberson 2026년 1월 29일
I am using R2024b, still have the problem.

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

 채택된 답변

Edric Ellis
Edric Ellis 2017년 1월 26일

0 개 추천

This appears to be a problem with the automatic path mirroring that is used when setting up a parallel pool. Things work correctly if you modify the client MATLAB path only after creating the parallel pool.

댓글 수: 2

Thank you! Indeed a strage bug, becouse you can set path priorities in the IDE, so it should be mirrored in the same way.
But which path is matlab using then? I have a very similar situation:
2 Toolboxes, both have the same function name. In our code we dynamically change the path depending on which of the toolboxes is required. However, as soon as there is a parfor loop, we are in trouble, as the path seems to be ignoring anything we do before.
  • Changing the path before the pool is created -> No Effect
  • Changing the path after the pool is created -> No Effect.
The only thing I see is to change the path in the parfor loop, but this (at least in our case) would create an overhead that would make parfor pointless.
I'm really wondering, whether there is any way to manipulate the path of a cluster or how the cluster determines its path.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기

태그

질문:

2017년 1월 25일

이동:

2026년 1월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by