Call library with parfor

2 visualizaciones (últimos 30 días)
arnaud ensberg
arnaud ensberg el 28 de En. de 2016
Comentada: Bernie St el 24 de Ag. de 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 comentarios
Edric Ellis
Edric Ellis el 29 de En. de 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 el 24 de Ag. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Parallel Computing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by