Call library with parfor

1 visualizzazione (ultimi 30 giorni)
arnaud ensberg
arnaud ensberg il 28 Gen 2016
Commentato: Bernie St il 24 Ago 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 Commenti
Edric Ellis
Edric Ellis il 29 Gen 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 il 24 Ago 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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Parallel for-Loops (parfor) in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by