Code covered by the BSD License  

Highlights from
Mandelbrot set with the parallel computing toolbox

image thumbnail

Mandelbrot set with the parallel computing toolbox

by

 

Example of using parallel computing to make the most of the mandelbrot set

taskfun.m
steps=1200;
maxiter=1200;
xmin=-2;
xmax=2;
ymin=-2;
ymax=2;
numTasks=4;
% Calculate dy from ymin and ymax and then split dy by the number of tasks

dx=xmax-xmin;
dy=ymax-ymin;
ddy=dy/numTasks;
ddx=dx/numTasks

configName = defaultParallelConfig();
sched = findResource('scheduler', 'Configuration', configName);
job = createJob(sched);
for i = 1:numTasks
    xmin+ddx*(i-1)
    xmin+ddx*i
   createTask(job, @mandel1,1, {steps/numTasks,maxiter,xmin,xmax,ymin+ddy*(i-1),ymin+ddy*(i),numTasks});
end
submit(job);
waitForState(job, 'finished');
y = getAllOutputArguments(job);
%cat(2, y{:})   % Concatenate all the cells in y into one column vector.
Z=cell2mat(y);
%celldisp(y)
destroy(job);
imagesc(Z)

Contact us