Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b29b7a56 authored by Nicolas Bellot's avatar Nicolas Bellot Committed by hhakim
Browse files

demo

parent c2d3b0fd
Branches
Tags
No related merge requests found
......@@ -114,40 +114,44 @@ ymin=min([min(mean_tdense(:)),min(mean_tfaust(:))]);
ymax=max([max(mean_tdense(:)),max(mean_tfaust(:))]);
fighandle=figure;
for nfact=1:nNB_FACTS
subplot(1,nNB_FACTS,nfact);
for k=1:nRCGS
semilogy(log2(DIMS),mean_tfaust(:,k,nfact),'LineWidth',thickness_curve);
legend_curve{k}=['Faust RCG ' num2str(RCGS(k))];
hold on;
legendy={'Time (A*x)','Time (A''*x)'};
for h=1:2
for nfact=1:nNB_FACTS
subplot(2,nNB_FACTS,(h-1)*nNB_FACTS+nfact);
for k=1:nRCGS
semilogy(log2(DIMS),mean_tfaust(:,k,nfact,h),'LineWidth',thickness_curve);
legend_curve{k}=['Faust RCG ' num2str(RCGS(k))];
hold on;
end
%LA boucle fait remettre les compteurs a zero, que ce soit des
%numero de courbes ou des couleurs, c'est pourquoi il faut la
%mettre en premier et
%forcer la couleur du dense (voire ci dessous).
semilogy(log2(DIMS),squeeze(mean_tdense(:,h)),'-+','Color',[0 0.8 0.8],'LineWidth',thickness_curve);
legend_curve{nRCGS+1}=['Dense '];
% legend the figure,title, font ...
grid on;
axis([log2(DIMS(1)) log2(DIMS(end)) ymin ymax]);
title (['nb factor : ' ,int2str(NB_FACTS(nfact))] );
if (nfact == 1)
legend(legend_curve{:},'Location', 'NorthWest');
xlabel('log2(Dimension)');
ylabel(legendy{h});
end
end
%LA boucle fait remettre les compteurs a zero, que ce soit des
%numero de courbes ou des couleurs, c'est pourquoi il faut la
%mettre en premier et
%forcer la couleur du dense (voire ci dessous).
semilogy(log2(DIMS),squeeze(mean_tdense),'-+','Color',[0 0.8 0.8],'LineWidth',thickness_curve);
legend_curve{nRCGS+1}=['Dense '];
% legend the figure,title, font ...
grid on;
axis([log2(DIMS(1)) log2(DIMS(end)) ymin ymax]);
title (['nb factor : ' ,int2str(NB_FACTS(nfact))] );
if (nfact == 1)
legend(legend_curve{:},'Location', 'NorthWest');
xlabel('log2(Dimension)');
ylabel('Time');
end
end
fighandle.Name =['Faust-' matrix_or_vector ' multiplication (constraint : ' constraint ')'];
figure_name = [figure_dir filesep 'RuntimeComp-' matrix_or_vector '_multiplication_constraint_' constraint];
print(figure_name, format_fig);
......@@ -109,8 +109,8 @@ end
%% time comparison
t_faust=zeros(Nb_mult+1,NDims,NRCGs,Nnb_facts);
t_dense=zeros(Nb_mult+1,NDims);
t_faust=zeros(Nb_mult+1,NDims,NRCGs,Nnb_facts,2);
t_dense=zeros(Nb_mult+1,NDims,2);
h = waitbar(0,'runtime comparison (faust vs dense matrix) for various configuration ...');
for i=1:Nb_mult+1
......@@ -119,6 +119,13 @@ for i=1:Nb_mult+1
for j=1:NDims
dim=Dims(j);
if strcmp(matrix_or_vector,'matrix')
dim2 = dim; % multiplication by a square matrix
elseif strcmp(matrix_or_vector,'vector')
dim2 = 1; % multiplication by a column-vector
else
error('matrix_or_vector string must be equal to matrix or vector');
end
for k=1:NRCGs
......@@ -128,50 +135,53 @@ for i=1:Nb_mult+1
nfact=nb_facts(l);
fact=gen_artificial_faust(dim,RCG,nfact,constraint);
faust_transform=matlab_faust(fact);
if strcmp(matrix_or_vector,'matrix')
x=rand(dim);
y=zeros(dim);
yfaust=zeros(dim);
elseif strcmp(matrix_or_vector,'vector')
x=rand(dim,1);
y=zeros(dim,1);
yfaust=zeros(dim,1);
x=rand(dim,dim2);
y=zeros(dim,dim2);
yfaust=zeros(dim,dim2);
y_trans=zeros(dim,dim2);
yfaust_trans=zeros(dim,dim2);
else
error('matrix_or_vector string must be equal to matrix or vector');
end
taillefaust=size(faust_transform);
if((taillefaust(1) ~= dim)+(taillefaust(2) ~= dim))
error('invalid faust');
end
%% multiplication dense
if(k==1)&&(l==1)
A=list_dense{j};
tic;
y=A*x;
t=toc;
t_dense(i,j)=t;
tdense=toc;
t_dense(i,j,1)=tdense;
tic
y_trans=A'*x;
tdense_trans=toc;
t_dense(i,j,2)=tdense_trans;
end
%% multiplication par un faust
faust_transform=list_faust{j,k,l};
tic;
yfaust=faust_transform*x;
t=toc;
t_faust(i,j,k,l)=t;
tfaust=toc;
t_faust(i,j,k,l,1)=tfaust;
tic;
yfaust_trans=mtimes_trans(faust_transform,x,'T');
tfaust_trans=toc;
t_faust(i,j,k,l,2)=tfaust_trans;
end
end
end
end
close(h);
t_faust(1,:,:,:)=[];
t_dense(1,:)=[];
t_faust(1,:,:,:,:)=[];
t_dense(1,:,:)=[];
runPath=which(mfilename);
pathname = fileparts(runPath);
matfile = fullfile(pathname, 'runtime_comparison.mat');
save(matfile,'t_faust','t_dense','params');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment