Using third party software within parfor loop
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dags
el 18 de En. de 2018
Comentada: Dags
el 18 de En. de 2018
I wrote a set of nested for loops to conduct a parameter sweep in a third party software (Lumerical, it's an FDTD package) in Matlab. This code works perfectly well, but I can't seem to get the parallel version to work. My guess is that Matlab is having issues assigning workers in the parallel case, but I'm having issues resolving this. I've copied my code for the loop below and the line in the function I use to execute each Lumerical simulation. Does anyone have any suggestions for how to resolve this?
parfor ph = 1:PH
for p = 1:P
for bi = 1:BI
for pii = 1:PI
for r =1:R
poolobj = gcp;
addAttachedFiles(poolobj, FDTD_exec_pillars_parfor.m);
pitch = [PillarHeight(ph), Pitch(p), BackgroundIndex(bi),...
PillarIndex(pii), Radius(r)];
Transdata = FDTD_exec_pillars_parfor(pitch);
cellframe2(ph,p,bi,pii,r) = Transdata;
end
end
end
end
end
% Path used to execute simulation in FDTD package within function FDTD_exec_pillars_parfor
[x1,y1]=system('"C:\Program Files\Lumerical\FDTD\bin\fdtd-solutions.exe" -run NOMAD_script.lsf');
error message:
"Error: MATLAB cannot determine whether "FDTD_exec_pillars_parfor" refers to a
function or variable.
See Parallel for Loops in MATLAB, "Unambiguous Variable Names"."
This error message appeared after I added the two poolobj lines in attempt to resolve this error:
"An UndefinedFunction error was thrown on the workers for 'FDTD_exec_pillars_parfor'.
This might be because the file containing 'FDTD_exec_pillars_parfor' is not
accessible on the workers. Use addAttachedFiles(pool, files) to specify the required
files to be attached. See the documentation for 'parallel.Pool/addAttachedFiles' for
more details.
Caused by:
Undefined function 'FDTD_exec_pillars_parfor' for input arguments of type
'double'"
0 comentarios
Respuesta aceptada
Walter Roberson
el 18 de En. de 2018
addAttachedFiles(poolobj, 'FDTD_exec_pillars_parfor.m');
You were missing the quotation marks.
Más respuestas (0)
Ver también
Categorías
Más información sobre Parallel for-Loops (parfor) 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!