image thumbnail

Parallel Computing test (Ordinary Differential Equation)

by

 

21 Jan 2011 (Updated )

Describes how to use Parallel Computing Toolbox to speed up computing with multi core computer.

m9912

Contents

Parallel Computing example / Obliczenia równolegle

nc=2 % number of cores or processors, nc = 1,2,3,...
     % ilosc rdzeni lub procesorów    nc = 1,2,3...
matlabpool(nc)  % opening parallel session for nc cores
                % otwarcie sesji równoleglej dla nc rdzeni
NumberOfWorkers=matlabpool('size') %
tic        % timer start
nc =

     2

Starting matlabpool using the 'local' configuration ... connected to 2 labs.

NumberOfWorkers =

     2

Start of parallel for loop / Petla for dla obliczen równoleglych

parfor tt=10:20
[~,~]=ode23('ode1000',[0,tt],[1,-1]); % solving ode from ode1000.m
          % rozwiązywanie równania rózniczkowego z pliku ode1000.m
% [~,~] zrezygnowano z zapamietania wyników obliczen
end
toc
Elapsed time is 7.003954 seconds.

Closing parallel session / Zamyka sesje równolegla dla nc rdzeni

matlabpool close force
NumberOfWorkers=matlabpool('size')
Sending a stop signal to all the labs ... stopped.
Did not find any pre-existing parallel jobs created by matlabpool.


NumberOfWorkers =

     0

Contact us