Using third party software within parfor loop
조회 수: 4 (최근 30일)
이전 댓글 표시
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
채택된 답변
Walter Roberson
2018년 1월 18일
addAttachedFiles(poolobj, 'FDTD_exec_pillars_parfor.m');
You were missing the quotation marks.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!