필터 지우기
필터 지우기

problems with parfor and matlabpool: Error using parallel_function at 598

조회 수: 1 (최근 30일)
MRC
MRC 2013년 11월 4일
답변: Matt J 2013년 11월 4일
Hi, I'm trying to speed up my code using parfor instead of for but it doesn't work. It gives me the error: ??? Error using ==> parallel_function at 598 Error in ==> simuconf at 186 Matrix dimensions must agree. Do you have any suggestion? Thank you very much!
global n m B b r
m=5;
n=4;
B=7;
b=3;
r=10;
temp=zeros(B,201);
load coeffconfidsimple
cutoffcoeffs=size(coeffconfidsimple,1);
matlabpool open 2
tic
parfor w=1:B
mstr=num2str(w);
subsubdata=load(['subdata' mstr '.mat']);
subfreq=load(['freq' mstr '.mat']);
C= struct2cell(subsubdata);
D= struct2cell(subfreq);
subdata= cell2mat(C);
freq=cell2mat(D);
compare=zeros(cutoffcoeffs,1);
for x=1:cutoffcoeffs
[compare(x)]=simuconf(coeffconfidsimple(x,:)',subdata,freq); %simuconf is a function of three arguments; in addition it uses the global variables stated at the beginning
end
temp(w,:)=[w (compare*size(subdata,1)'];
end
toc

채택된 답변

Matt J
Matt J 2013년 11월 4일
Another thing to try is putting line 186 of simuconf inside a try...catch. If an error occurs, write all data used on line 186 to a .mat file and abort. Then, you can examine the sizes and contents of the matrices in the mat file to see what went wrong.

추가 답변 (1개)

Matt J
Matt J 2013년 11월 4일
The error is at line 186 in simuconf. Do this
>> dbstop if error
Then replace parfor with "for" and re-run.
  댓글 수: 2
MRC
MRC 2013년 11월 4일
It works with for. I think there should be something which is not compatible with parfor but I don't understand what.
Matt J
Matt J 2013년 11월 4일
편집: Matt J 2013년 11월 4일
The error is coming from simuconf. That's what needs to be examined, not just your outer file.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by