Find execution time of parallel program
Show older comments
I have written parallel program for HYPR algorithm. Basically it reconstructs an image with slices with the help of radon and iradon functions.It takes more time to reconstruct an image (60s). I have written parallel program for it using to workers and the execution time is 39s.( I have found execution time using tic and toc). Now when i try with workers 3 and more there is no significant change in time. MY laptop is i2 core. How to find an execution time of parallel program?
my code is: clear all; % M=input('Enter the number of time frames:'); % N=input('Enter the number of projections:'); Theta_in=0; Theta_end=360; Composite=0; Z_1=0;Z=0;
Theta=0; Theta1=72; Theta2=168;
% divide angles from initial to end in M*N equal divisions % Theta=linspace(Theta_in,Theta_end,M*N);
% Read dicon images files = dir(fullfile(pwd,'*.dcm')); j=1; k=5; l=9; z=0; time1=0; matlabpool open local 3 PP = Composite(); PP1 = Composite(); PP2 = Composite();
spmd % Composite Image tic for i= 1:12 if labindex==1 && j<=4 img = dicomread(fullfile(pwd,files(j).name)); for z= 1:24 FP=radon(img,Theta); FBP=iradon(FP,Theta); f=fspecial('gaussian'); fil=imfilter(FBP,f);
% padding of image
padimg= padarray(fil,[50 50],0,'both');
% Rotating image
Rotate=imrotate(padimg,Theta,'crop');
Theta=Theta+1;
% Formation of composite image
PP= PP+ Rotate;
end;
j=j+1;
end;
if labindex==2 && k<=8
img = dicomread(fullfile(pwd,files(k).name));
for z=1:24
FP=radon(img,Theta1);
FBP=iradon(FP,Theta1);
f=fspecial('gaussian');
fil=imfilter(FBP,f);
% padding of image
padimg= padarray(fil,[50 50],0,'both');
% Rotating image
Rotate=imrotate(padimg,Theta1,'crop');
% Formation of composite image
PP1= PP1+ Rotate;
Theta1=Theta1+1;
end;
k=k+1;
end;
if labindex==3 && l<=12
img = dicomread(fullfile(pwd,files(l).name));
for z=1:24
FP=radon(img,Theta2);
FBP=iradon(FP,Theta2);
f=fspecial('gaussian');
fil=imfilter(FBP,f);
% padding of image
padimg= padarray(fil,[50 50],0,'both');
% Rotating image
Rotate=imrotate(padimg,Theta2,'crop');
% Formation of composite image
PP2= PP2+ Rotate;
Theta2=Theta2+1;
end;
l=l+1;
end;
% lab2=lab2+toc;
end;
toc
end;
%PP2=PP{1}+PP1{2}; %PP2=PP2/12; figure,imshow(PP{1},[]); title('labindex 1'); figure,imshow(PP1{2},[]); title('labindex 2'); figure,imshow(PP2{3},[]); title('labindex 3'); PP2=(PP{1}+PP1{2}+PP2{3}); figure,imshow(PP2,[]); title('Combined'); matlabpool close;
Answers (0)
Categories
Find more on Geometric Transformation and Image Registration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!