Parfor unnecessary communication overhead
Show older comments
Hi all,
I have the below parfor loop which is good when I am wanting to pass thru negative values to evaluate. I am getting the following error/warning from MATLAB which I wonder if there is a faster/optimal way to get to the same point improving the below structure.
Error: The Entire Array or Structure "yA_vals"/"yC_vals"/"yD_vals" is a broadcast variable. This might result in unnecessary communication overhead.
yA_vals = -5:5; n_yA = length(yA_vals);
yC_vals = 0:10; n_yC = length(yC_vals);
yD_vals = -10:0; n_yD = length(yD_vals);
parfor yAidx = 1:n_yA
yA = yA_vals(yAidx);
fprintf('>Job 1 %d of %d at %s...\n',yA,yA_vals(end),datestr(now));
for yCidx = 1:n_yC
yC = yC_vals(yCidx);
fprintf('>>Job 2 %d of %d...\n',yC,yC_vals(end));
for yDidx = 1:n_yD
yD = yD_vals(yDidx);
fprintf('>>>Job 3 %d of %d...\n',yD,yD_vals(end));
[~,~,Total(yAidx,yCidx,yDidx)] = Function(Input,yA,yC,yD);
end
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!