Hi, I'm trying to use "parfor" in my MATLAB script.
It goes well without error, but It shows no significant speed boost compared to for loop.
And I got this warning message:
"the entire array ('A_Data' , 'A_ref') is a broadcast variable. This might result in unnecessary communication overhead."
How can I deal with this problem?
Note that:
A_Data: 1710203x5 double
A_ref: 5760x5 double
Please suggest the solutions.
load dataq.mat
k=length(A_ref);
theta=zeros(k,5);
b_ref=zeros(k,1);
poolobj = parpool(8);
parfor i=1:k
W = sqrt( ...
exp( ...
-( ...
( ( A_Data(:,2)-A_ref(i,2) ) / 0.6 ).^2+ ...
( ( A_Data(:,3)-A_ref(i,3) ) / 0.6 ).^2+ ...
( ( A_Data(:,4)-A_ref(i,4) ) / 0.6 ).^2+ ...
( ( A_Data(:,5)-A_ref(i,5) ) / 0.6 ).^2 ...
) /2 ...
) ...
);
theta(i,:)=regress(W.*b_Data,repmat(W,1,5).*A_Data);
b_ref(i,1)=A_ref(i,:)*theta(i,:)';
end
delete(poolobj);