Thursday, December 23, 2010

Running Matlab codes on multicores

Running Matlab codes with multicores has never been this easy!

For your great, great, great work, my sincere thank you to you, Markus Buehren. Thank you.

http://www.mathworks.com/matlabcentral/fileexchange/13775


To run it, it's fairly simple.

Say you are looping a function called DoSomething(x, y, z) 20 times.
In your standard procedures, you would have:
for i =1:20,
%% derivation/computation of x,y,z
DoSomething(x,y,z);
end

Now you will need to rewrite your codes, for example:
paramCell = cell(20,3);
for i = 1:20
paramCell{1, i} = x;%% of course you could merge the 3 args together!!
paramCell{2, i} = y;%%
paramCell{3, i} = z;%%
end

startmulticoremaster(@DoSomething, paramCell, settings); %% for settings just copy settings from the demo!

good, nifty script!!!! Thanks once again!


No comments:

Post a Comment