Mentions légales du service

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

demo test

parent 802b4159
No related branches found
No related tags found
No related merge requests found
......@@ -229,6 +229,7 @@ if (BUILD_MATLAB_MEX_FILES)
set(FAUST_DEMO_BSL_OUTPUT_BIN_DIR ${FAUST_DEMO_BSL_BIN_DIR}/output/ CACHE INTERNAL "")
set(FAUST_DEMO_HADAMARD_OUTPUT_BIN_DIR ${FAUST_DEMO_HADAMARD_BIN_DIR}/output/ CACHE INTERNAL "")
set(FAUST_DEMO_TIMECOMP_BIN_DIR ${FAUST_DEMO_BIN_DIR}/Runtime_comparison CACHE INTERNAL "")
set(FAUST_DEMO_FIG_BIN_DIR ${FAUST_DEMO_BIN_DIR}/Figures CACHE INTERNAL "")
#### INSTALL DIRECTORY ####
......@@ -241,6 +242,7 @@ if (BUILD_MATLAB_MEX_FILES)
set(FAUST_DEMO_BSL_OUTPUT_INSTALL_DIR ${FAUST_DEMO_BSL_INSTALL_DIR}/output CACHE INTERNAL "")
set(FAUST_DEMO_HADAMARD_OUTPUT_INSTALL_DIR ${FAUST_DEMO_HADAMARD_INSTALL_DIR}/output/ CACHE INTERNAL "")
set(FAUST_DEMO_TIMECOMP_INSTALL_DIR ${FAUST_DEMO_INSTALL_DIR}/Runtime_comparison CACHE INTERNAL "")
set(FAUST_DEMO_FIG_INSTALL_DIR ${FAUST_DEMO_INSTALL_DIR}/Figures CACHE INTERNAL "")
endif(BUILD_MATLAB_MEX_FILES)
......@@ -284,6 +286,8 @@ if (BUILD_MATLAB_MEX_FILES)
install(DIRECTORY ${FAUST_DEMO_BSL_OUTPUT_BIN_DIR} DESTINATION ${FAUST_DEMO_BSL_OUTPUT_INSTALL_DIR})
file(MAKE_DIRECTORY ${FAUST_DEMO_HADAMARD_OUTPUT_BIN_DIR})
install(DIRECTORY ${FAUST_DEMO_HADAMARD_OUTPUT_BIN_DIR} DESTINATION ${FAUST_DEMO_HADAMARD_OUTPUT_INSTALL_DIR})
file(MAKE_DIRECTORY ${FAUST_DEMO_FIG_BIN_DIR})
install(DIRECTORY ${FAUST_DEMO_FIG_BIN_DIR} DESTINATION ${FAUST_DEMO_INSTALL_DIR})
endif (BUILD_MATLAB_MEX_FILES)
# CANNOT CREATE EMPTY DIRECTORY IN INSTALL_DIR !!!!! MODIFY !!!!!
......
......@@ -45,10 +45,15 @@
runPath=which(mfilename);
pathname = fileparts(runPath);
matfile = fullfile(pathname, 'output/results_BSL_user.mat');
matfile = fullfile(pathname, ['output' filesep 'results_BSL_user.mat']);
if (not(exist(matfile)))
error('run BSL.m before Fig_BSL.m');
end
%% figure configuration
figure_dir = [pathname filesep '..' filesep 'Figures'];
format_fig='-dpng';
load(matfile);
Ntraining=params.Ntraining;
......@@ -103,8 +108,12 @@ for i=1:nb_approx_MEG
end
title('Fig 9 : C++ wrapper faust');
f.Name =['Brain Source Localization : convergence with ' solver_choice 'solver (C++ wrapper)']
title(['BSL - convergence (C++ wrapper faust) ' solver_choice ' solver']);
f.Name =['Brain Source Localization : convergence with ' solver_choice '_solver (C++ wrapper)'];
figure_name=[figure_dir filesep 'BSL-convergence_Cpp_' solver_choice '_solver'];
print(figure_name, format_fig);
%% MATLAB convergence analysis
......@@ -149,9 +158,10 @@ for i=1:nb_approx_MEG
end
title('Fig 9 : matlab faust');
f.Name =['Brain Source Localization : convergence with ' solver_choice 'solver (matlab)']
title(['BSL - convergence (matlab faust) ' solver_choice ' solver ']);
f.Name =['Brain Source Localization : convergence with ' solver_choice ' solver (matlab)'];
figure_name=[figure_dir filesep 'BSL-convergence_matlab_' solver_choice '_solver'];
print(figure_name, format_fig);
%% time comparison
......@@ -193,9 +203,10 @@ for i=1:nb_approx_MEG
text(xTicks(2*i), minY - verticalOffset, ['$\widehat{\mathbf{M}}_{' int2str(RCG_approxS_MEG(i)) '}^{Cpp}$' ],'HorizontalAlignment','center','interpreter', 'latex');
text(xTicks(2*i+1), minY - verticalOffset, ['$\widehat{\mathbf{M}}_{' int2str(RCG_approxS_MEG(i)) '}^{Matlab}$' ],'HorizontalAlignment','center','interpreter', 'latex');
end
title('solver time comparison');
f.Name =['Brain Source Localization : time comparison with ' solver_choice 'solver']
title(['BSL - time comparison (FAUST vs dense matrix) ' solver_choice ' solver']);
f.Name =['Brain Source Localization : time comparison with ' solver_choice 'solver'];
figure_name=[figure_dir filesep 'BSL-time_comparison_' solver_choice '_solver'];
print(figure_name, format_fig);
......@@ -230,5 +241,9 @@ for i=1:nb_approx_MEG
end
legend('theoretical RCG','speed up C++ wrapper faust','speed up MATLAB faust','neutral speed up');
title('speed up');
title(['BSL - speed up using FAUST ' solver_choice ' solver']);
f.Name =['Brain Source Localization : speed-up Faust with ' solver_choice 'solver'];
figure_name = [figure_dir filesep 'BSL-speed_up_' solver_choice ' solver'];
print(figure_name, format_fig);
......@@ -47,6 +47,10 @@ M = log2(n);
%% Generating the data
[params.data,~] = hadamard_mat(M);
%% Setting of the parameters
params.nfacts = M;
params.cons = cell(2,M-1);
......@@ -105,9 +109,14 @@ disp(['multiplication speed-up using faust : ' num2str(speed_up) ]);
%% Plotting the results
% figure configuration
runPath=which(mfilename);
pathname = fileparts(runPath);
figure_dir = [pathname filesep '..' filesep 'Figures'];
format_fig='-dpng';
figure;
fighandle=figure;
hold on;
subplot(1,params.nfacts+1,1);
imagesc(Xhat); axis square
......@@ -119,8 +128,12 @@ for kk = 1:params.nfacts
set(gca,'xtick',[],'ytick',[])
end
fighandle.Name =['Hadamard-factorisation_image'];
figure_name = [figure_dir filesep 'Hadamard-factorisation_image'];
print(figure_name, format_fig);
figure;
fighandle=figure;
hold on;
subplot(1,params.nfacts+1,1);
imagesc(Xhat); axis square
......@@ -132,6 +145,9 @@ for kk = 1:params.nfacts
spy(facts{kk}); axis square
set(gca,'xtick',[],'ytick',[])
end
fighandle.Name =['Hadamard-factorisation_nnz_coeff'];
figure_name = [figure_dir filesep 'Hadamard-factorisation_nnz_coeff'];
print(figure_name, format_fig);
......@@ -50,6 +50,11 @@ faust_times=zeros(nb_mult,nb_dim);
h = waitbar(0,'speed up hadamard : Generation of the data ...');
Hadamard_matrices=cell(1,nb_dim);
Hadamard_facts=cell(1,nb_dim);
for k=1:nb_dim
waitbar(k/nb_dim);
M=Ms(k);
......@@ -141,8 +146,11 @@ f.Name =['Hadamard Faust-vector multiplication'];
%% save the figure
runPath=which(mfilename);
pathname = fileparts(runPath);
fig_filename = [pathname filesep 'output' filesep 'speed_up_hadamard.png'];
print(fig_filename,'-dpng','-r300');
figure_dir = [pathname filesep '..' filesep 'Figures'];
format_fig='-dpng';
figure_name=[figure_dir filesep 'Hadamard-speed_up'];
print(figure_name, format_fig);
......
%% Description Fig_runtime_comparison.m
% Runtime comparison
%
% This script displays the result of the runtime comparison between
% faust multiplication and dense matrix multiplication for various
% configuration of faust (dimension of the faust, number of factors,
% This script displays the result of the runtime comparison between
% faust multiplication and dense matrix multiplication for various
% configuration of faust (dimension of the faust, number of factors,
% Relative Complexity Gain (RCG), fix type of sparsity (sp, spcol,splin))
%
%
%
% For more information on the FAuST Project, please visit the website of
%
% For more information on the FAuST Project, please visit the website of
% the project : <http://faust.gforge.inria.fr>
%
%% License:
......@@ -16,36 +16,36 @@
% INRIA Rennes, FRANCE
% http://www.inria.fr/
%
% The FAuST Toolbox is distributed under the terms of the GNU Affero
% The FAuST Toolbox is distributed under the terms of the GNU Affero
% General Public License.
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU Affero General Public License as published
% it under the terms of the GNU Affero General Public License as published
% by the Free Software Foundation.
%
% This program is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% This program is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% See the GNU Affero General Public License for more details.
%
% You should have received a copy of the GNU Affero General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%
%% Contacts:
%% Contacts:
% Nicolas Bellot : nicolas.bellot@inria.fr
% Leman Adrien : adrien.leman@inria.fr
% Luc Le Magoarou: luc.le-magoarou@inria.fr
% Remi Gribonval : remi.gribonval@inria.fr
%
%% References:
% [1] Le Magoarou L. and Gribonval R., "Flexible multi-layer sparse
% approximations of matrices and applications", Journal of Selected
% [1] Le Magoarou L. and Gribonval R., "Flexible multi-layer sparse
% approximations of matrices and applications", Journal of Selected
% Topics in Signal Processing, 2016.
% <https://hal.archives-ouvertes.fr/hal-01167948v1>
%
% [2] A. Gramfort, M. Luessi, E. Larson, D. Engemann, D. Strohmeier,
% [2] A. Gramfort, M. Luessi, E. Larson, D. Engemann, D. Strohmeier,
% C. Brodbeck, L. Parkkonen, M. Hamalainen, MNE software for processing
% MEG and EEG data <http://www.ncbi.nlm.nih.gov/pubmed/24161808>,
% NeuroImage, Volume 86, 1 February 2014, Pages 446-460, ISSN 1053-8119,
% MEG and EEG data <http://www.ncbi.nlm.nih.gov/pubmed/24161808>,
% NeuroImage, Volume 86, 1 February 2014, Pages 446-460, ISSN 1053-8119,
% [DOI] <http://dx.doi.org/10.1016/j.neuroimage.2013.10.027>
......@@ -71,7 +71,9 @@ if (not(exist(matfile)))
end
load(matfile);
% figure configuration
figure_dir = [pathname filesep '..' filesep 'Figures'];
format_fig='-dpng';
......@@ -115,24 +117,24 @@ fighandle=figure;
for nfact=1:nNB_FACTS
subplot(1,nNB_FACTS,nfact);
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))];
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),'-+','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]);
......@@ -143,11 +145,9 @@ subplot(1,nNB_FACTS,nfact);
xlabel('log2(Dimension)');
ylabel('Time');
end
fighandle.Name =['Faust-' matrix_or_vector ' multiplication (constraint : ' constraint ')'];
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);
......@@ -59,7 +59,7 @@ params.constraint = 'sp';
%params.constraint = 'sp_row';
params.matrix_or_vector='vector';
%matrix_or_vector='matrix';
params.Nb_mult=200;
params.Nb_mult=500;
[RCGs,Dims,nb_facts,constraint,Nb_mult,matrix_or_vector]=deal(params.RCGs,params.Dims,params.nb_facts,params.constraint,params.Nb_mult,params.matrix_or_vector);
......
......@@ -122,13 +122,10 @@ endif(BUILD_READ_XML_FILE)
if(BUILD_MATLAB_MEX_FILES)
#add_test(NAME FAUST_HIER_MEX COMMAND matlab -nojvm -nodisplay -r ${FAUST_BIN_TEST_BIN_DIR}/hier_fact.m;exit)
# on ajoute les path bin et tools qui sont utilisés pour le script matlab.
# add_test(NAME FAUST_HIER_MEX COMMAND matlab -nojvm -r "try;addpath('${FAUST_BIN_TEST_BIN_DIR}','${FAUST_BIN_TEST_TOOLS_DIR}');hier_fact(9400,10); catch ME ; disp('ERROR IN TEST hier_fact.m Please chek the output to visualize the error. '); end ; exit" )
add_test(NAME FAUST_HIER_MEX COMMAND matlab -nojvm -r "try;testpass=0;addpath('${FAUST_BIN_TEST_BIN_DIR}','${FAUST_BIN_TEST_TOOLS_DIR}');set_path;hier_fact_test('config_compared_hierarchical_fact',9402,1); catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)" )
#add_test(NAME FAUST_MEG_MEX COMMAND matlab -nojvm -r "try;testpass=0;addpath('${FAUST_BIN_TEST_BIN_DIR}','${FAUST_BIN_TEST_TOOLS_DIR}');MEG_fact(22450,100); catch ME ; disp('ERROR IN TEST MEG_fact.m Please chek the output to visualize the error. '); end; exit" )
add_test(NAME FAUST_MEG_MEX COMMAND matlab -nojvm -r "try;testpass=0;addpath('${FAUST_BIN_TEST_BIN_DIR}','${FAUST_BIN_TEST_TOOLS_DIR}');set_path;hier_fact_test('config_MEG',22450,100);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)")
add_test(NAME FAUST_HADAMARD_MEX COMMAND matlab -nojvm -r "try;testpass=0;addpath('${FAUST_BIN_TEST_BIN_DIR}','${FAUST_BIN_TEST_TOOLS_DIR}');set_path;hier_fact_test('config_HADAMARD',5941,1);catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)")
add_test(NAME DEMO_MATLAB COMMAND matlab -nodesktop -r "try;testpass=0;addpath('${FAUST_MATLAB_INSTALL_DIR}');setup_FAUST;run_all_demo;catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)")
......@@ -137,10 +134,11 @@ if(BUILD_MATLAB_MEX_FILES)
#CTEST_FULL_OUTPUT
set_tests_properties(FAUST_HIER_MEX FAUST_HADAMARD_MEX PROPERTIES TIMEOUT 30)
set_tests_properties(DEMO_MATLAB PROPERTIES TIMEOUT 300)
set_tests_properties(FAUST_MEG_MEX PROPERTIES TIMEOUT ${TIMEOUT_MEG})
endif()
#matlab -nojvm -r "addpath('/home/aleman/WORK/FAUST/faust/trunk/devcpp/Build-AL/wrapper/run_test/bin/','/home/aleman/WORK/FAUST/faust/trunk/devcpp/Build-AL/wrapper/run_test/tools/');hier_fact;exit"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment