Difference between revisions of "Parallelize msmf corr coeff.m"

From edegan.com
Jump to navigation Jump to search
Line 21: Line 21:
 
     epsim12 = zeros(N1(m), N2(m), R);
 
     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]);
 
     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;
+
     epsim12(2:end, 2:end, :) = epsimR12;        
    epsim_cell{m} = reshape(epsim12, [N1(m)*N2(m) R]);    % Added by Wei           
 
 
     f(psa(m)+1 : psa(m+1), :) = f(psa(m)+1 : psa(m+1), :) - reshape(epsim12, [N1(m)*N2(m) R])                   
 
     f(psa(m)+1 : psa(m+1), :) = f(psa(m)+1 : psa(m+1), :) - reshape(epsim12, [N1(m)*N2(m) R])                   
 
  end
 
  end
 +
 +
For large R, monte_M (hence large M), and mktsize, computing epsimR12 is taking more than 50% time of msmf_corr_coeff.m. 
 +
[[FILE:epsimR12.png]]

Revision as of 11:01, 20 July 2018


McNair Project
Parallelize msmf corr coeff.m
Project logo 02.png
Project Information
Project Title Parallelize msmf corr coeff.m
Owner Wei Wu
Start Date 2018-07-09
Deadline
Keywords Matlab, parallel computing, CPU
Primary Billing
Notes
Has project status Active
Is dependent on Estimating Unobserved Complementarities between Entrepreneurs and Venture Capitalists Matlab Code
Copyright © 2016 edegan.com. All Rights Reserved.


This page documents all changes that Wei made to the Matlab code for Matching Entrepreneurs to VC. It also explains the decisions Wei made, and where further improvement might be achieved in the future.

Changes made to the code

To speed up the valuation of the objective function used by ga, Wei parallelized a couple of lines in msmf_corr_coeff.m.

  • Around line 80 of msmf_corr_coeff:

Original code:

for 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;          
   f(psa(m)+1 : psa(m+1), :) = f(psa(m)+1 : psa(m+1), :) - reshape(epsim12, [N1(m)*N2(m) R])                   
end

For large R, monte_M (hence large M), and mktsize, computing epsimR12 is taking more than 50% time of msmf_corr_coeff.m. EpsimR12.png