How to increase computational speed by using SPMD command in Parallel Computing tool box in MATLAB!!!!
Mostrar comentarios más antiguos
Hello,
I am learning parallel computing tool box in MATLAB. My CPU is Intel Core 2 Duo T 6400 2.00 Ghz and MATLAB R2009a. I executed two program one is sequential and another is parallel using SPMD command but i found that sequential program is taking lesser time i.e. 0.326433 seconds than parallel program i.e.3.985434 seconds. So please help me how to parallelize our sequential program using SPMD command.
Sequential Program is --
tic R = imread('cameraman.tif');
[a b] = size(R);
for i = 1:a
for j = 1:b
if R(i,j) > 150
R(i,j) = 0;
end
end
end
M = imread('cameraman.tif');
[a b] = size(M);
for i = 1:a
for j = 1:b
if M(i,j) < 150
M(i,j) = 255;
end
end
end
imshow (R)
figure imshow(M)
toc
Parallel Program using SPMD is---
matlabpool open local 2
tic
spmd (2)
if labindex==1
R = imread('cameraman.tif');
[a b] = size(R);
for i = 1:a
for j = 1:b
if R(i,j) > 150
R(i,j) = 0;
end
end
end
else
R = imread('cameraman.tif');
[a b] = size(R);
for i = 1:a
for j = 1:b
if R(i,j) < 150
R(i,j) = 255;
end
end
end
end
end
imshow (R{1})
figure
imshow (R{2})
toc
matlabpool close
So please help me..I am very confused..
Respuestas (0)
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!