Changes

Jump to navigation Jump to search
end
For large R, monte_M (hence large M), and mktsize, computing epsimR12 is taking more than 50% time of msmf_corr_coeff.m. Each call is taking no more than 2 seconds, but for a large M it will take a long time in total. To improve this, we use a parfor to paralellize this part. <br>
[[FILE:epsimR12.png]]
<br>
New code:
epsim_cell = cell(M,1);
parfor m = 1 : M
cholA = chol(exchsig(N1(m)-1, N2(m)-1, th));
epsim12 = zeros(N1(m), N2(m), R);
epsimR12 = reshape(mtimesx(repmat(cholA', [1 1 R]), reshape(epsimR(psa(m)+1 : psa(m)+(N1(m)-1)*(N2(m)-1), :, :), [(N1(m)-1)*(N2(m)-1) 1 R])), [N1(m)-1 N2(m)-1 R]);
epsim12(2:end, 2:end, :) = epsimR12;
epsim_cell{m} = reshape(epsim12, [N1(m)*N2(m) R]);
end
for m = 1 : M
f(psa(m)+1 : psa(m+1), :) = f(psa(m)+1 : psa(m+1), :) - epsim_cell{m};
end
 
Using parfor on a 12-cores machine gives a four time speed up for computing msmf_corr_coeff.m (apology for not having a profiling screenshot here). Note that to avoid data-racing, in each iteration m, we stored epsim12 into epsim_cell, and compute f using another for loop.

Navigation menu