Call library with parfor

2 vues (au cours des 30 derniers jours)
arnaud ensberg
arnaud ensberg le 28 Jan 2016
Commenté : Bernie St le 24 Août 2017
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 commentaires
Edric Ellis
Edric Ellis le 29 Jan 2016
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 le 24 Août 2017
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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Parallel Computing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by