Skip to content
Snippets Groups Projects
Commit e3917d78 authored by sundar's avatar sundar
Browse files

Allstats for ReduceImage

parent 3b4e710a
No related branches found
No related tags found
No related merge requests found
%% Getting ALL Stats for Reduce Image
tic
%% Log scale - 100 steps : from 1MB to 2.7 GB
% 1MB = 1024*1024 = 1048576 bytes
% log(1MB) = 13.8629
init_logsize = 13.8629;
% Final image size = 2.7GB
% log(2.7GB) = 21.7243
final_logsize = 21.7243;
% 100 steps between Initial and final image sizes
% stepsize = 21.7243 - 13.8629 = 7.8614/100 = 0.078614
stepsize = 0.078614;
% Keep incrementing log sizes by 0.078614
finalresult = struct('ImageSize',0,'ByteSize',0,'process',0,'Cuda_or_Matlab',0,'timer',0,'accuracy',0);
% img_slice = partition_img(img,init_bytesize);
% Neighborhood size (3x3x3 window)
NeighborhoodX = 3;
NeighborhoodY = 3;
NeighborhoodZ = 3;
method = 'min';
% [im, imagedata] = tiffReader();
% img1=im(:,:,:,1);
Image_bytesizes = [];
for i = init_logsize:stepsize:final_logsize
bytesize = exp(i);
img1_slice = partition_img(img1,bytesize);
results = Getstats_ReduceImage(img1_slice,NeighborhoodX,NeighborhoodY,NeighborhoodZ,method,bytesize);
finalresult = cat(2,finalresult,results);
Image_bytesizes = [Image_bytesizes bytesize];
end
CUDA_structs = arrayfun(@(x)strcmp(x.Cuda_or_Matlab,'CUDA'),finalresult);
CUDA_structs_indices = find(CUDA_structs);
CUDA_times = horzcat(finalresult(CUDA_structs_indices).timer);
Image_bytesizes = horzcat(finalresult(CUDA_structs_indices).ByteSize);
MATLAB_structs = arrayfun(@(x)strcmp(x.Cuda_or_Matlab,'MATLAB'),finalresult);
MATLAB_structs_indices = find(MATLAB_structs);
MATLAB_times = horzcat(finalresult(MATLAB_structs_indices).timer);
figure, hold on;
plot(Image_bytesizes,CUDA_times,'r*');
plot(Image_bytesizes,MATLAB_times,'g*');
legend('CUDA','MATLAB');
xlabel('Size of Image (bytes)')
ylabel('Time taken (sec)');
title('ReduceImage Race: CUDA vs MATLAB');
toc
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment