Call library with parfor

조회 수: 1 (최근 30일)
arnaud ensberg
arnaud ensberg 2016년 1월 28일
댓글: Bernie St 2017년 8월 24일
I use javaplex it's a library, with for i can use it without any error:
for i=1:size(mat,1)
max_dimension = 3;
max_filtration_value = 1000;
num_divisions = 10000;
%options.max_filtration_value = max_filtration_value;
%options.max_dimension = max_dimension - 1;
% fprintf('on est à l indice %d\n', i);
maColonne = mat(i,:); %cela va mettre ta i_ème colonne dans la variable maColonne
matricepos = vec2mat(maColonne,3);
point_cloud=matricepos;
stream = api.Plex4.createVietorisRipsStream(point_cloud, max_dimension, max_filtration_value, um_divisions);
end
but when i use the same code with parfor, i have this error :
Error: MATLAB cannot determine whether "api" refers to a function or variable.
See Parallel for Loops in MATLAB, "Unambiguous Variable Names".
parfor i=1:size(mat,1)
max_dimension = 3;
max_filtration_value = 1000;
num_divisions = 10000;
%options.max_filtration_value = max_filtration_value;
%options.max_dimension = max_dimension - 1;
% fprintf('on est à l indice %d\n', i);
maColonne = mat(i,:); %cela va mettre ta i_ème colonne dans la variable maColonne
matricepos = vec2mat(maColonne,3);
point_cloud=matricepos;
stream = api.Plex4.createVietorisRipsStream(point_cloud, max_dimension, max_filtration_value, num_divisions);
end
the error comme from this line:
stream = api.Plex4.createVietorisRipsStream(point_cloud, max_dimension, max_filtration_value, num_divisions);
how can i call a function form library on parfor
please
  댓글 수: 3
Edric Ellis
Edric Ellis 2016년 1월 29일
Are you calling javaaddpath on the client? If so, you'll need to call javaaddpath on the workers. Something like this perhaps:
spmd
javaaddpath('path/to/javaplex');
end
Bernie St
Bernie St 2017년 8월 24일
Hi Arnaud, did you manage to solve this problem? I am trying to use javaplex in parfor loops and have the exact same error message. Unfortunately both adding the java path in the parfor loops as well as importing within the loop did not solve the problem for me.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by