Changes

Jump to navigation Jump to search
no edit summary
{{Project|Has project output=|Has sponsor=McNair ProjectsCenter
|Has title=Parallelize msmf corr coeff.m
|Has owner=Wei Wu,
==Around line 120 of msmf_corr_coeff solving LP problems==
For a large R, e.g. R = 200, solve solving 200 linear programming problems in parallel should be beneficial, especially when the each LP itself is easy to solve (takes less than 0.1 seconds each). Initially we managed to use gurobi inside a parfor:
% Gurobi inisde parfor. For large R (>100). By Wei.
model.rhs = [full(constrB); full(constrM)];
end
However using Gurobi actually did not help with the code performance. This is possibly due to the cost to create models for each Gurobi object. Gurobi is indeed the best commercial solver in the market, but it should be used for solving large LPs (hundreds of thousands of constraints), where as our Lp has only a few thousand constraints. We reversed back to using Matlab's native linprog: % Parallelly solve Solve LPs in parallel with Matlab's native linprog
parfor r = 1 : R
options = optimset('Display', 'off');
[asgr(:, r), ~, eflag(r)] = linprog(f(:, r), [B;-B], [constrB; constrM], [], [], zeros(L, 1), ones(L,1),options);
end
 
=Possible Further Improvements=
At this point I believe I have done everything I could for code performance. However if you look at the profiler, you will find that the function moments also takes a good percentage of time. I tried to parallelise moments with parfor, but it did not give any improvements.

Navigation menu