Mentions légales du service

Skip to content
Snippets Groups Projects
Commit e783c3b0 authored by hhakim's avatar hhakim
Browse files

Fix two bugs in hadamard speedup demo: waitbar using if no jvm + too heavy calculations.

Limit the dimensions to 2^12 is enough to see the speedup scaling.
The Linux VM was killing MATLAB because of the CPU consumption.
parent 66651f53
Branches
Tags
No related merge requests found
...@@ -278,7 +278,9 @@ classdef hadamard ...@@ -278,7 +278,9 @@ classdef hadamard
threshold=10^(-10); threshold=10^(-10);
h = waitbar(0,'speed up hadamard : Generation of the data ...'); if usejava('jvm')
h = waitbar(0,'speed up hadamard : Generation of the data ...');
end
Hadamard_matrices=cell(1,nb_dim); Hadamard_matrices=cell(1,nb_dim);
Hadamard_facts=cell(1,nb_dim); Hadamard_facts=cell(1,nb_dim);
...@@ -287,7 +289,9 @@ classdef hadamard ...@@ -287,7 +289,9 @@ classdef hadamard
for k=1:nb_dim for k=1:nb_dim
waitbar(k/nb_dim); if usejava('jvm')
waitbar(k/nb_dim);
end
M=Ms(k); M=Ms(k);
n=ns(k); n=ns(k);
% generation of the hadamard factorisation % generation of the hadamard factorisation
...@@ -295,7 +299,9 @@ classdef hadamard ...@@ -295,7 +299,9 @@ classdef hadamard
Hadamard_matrices{k}=H; Hadamard_matrices{k}=H;
Hadamard_facts{k}=facts; Hadamard_facts{k}=facts;
end end
close(h); if usejava('jvm')
close(h);
end
...@@ -307,9 +313,13 @@ classdef hadamard ...@@ -307,9 +313,13 @@ classdef hadamard
%RCGs=ns./(Ms*2); %RCGs=ns./(Ms*2);
RCGs=zeros(1,nb_dim); RCGs=zeros(1,nb_dim);
h = waitbar(0,'2-norm hadamard : multiplication time comparison ...'); if usejava('jvm')
h = waitbar(0,'2-norm hadamard : multiplication time comparison ...');
end
for i=1:nb_mult for i=1:nb_mult
waitbar(i/nb_mult); if usejava('jvm')
waitbar(i/nb_mult);
end
for k=1:nb_dim for k=1:nb_dim
n=ns(k); n=ns(k);
hadamard_dense=Hadamard_matrices{k}; hadamard_dense=Hadamard_matrices{k};
...@@ -335,7 +345,9 @@ classdef hadamard ...@@ -335,7 +345,9 @@ classdef hadamard
end end
end end
close(h); if usejava('jvm')
close(h);
end
mean_dense_t = mean(dense_times); mean_dense_t = mean(dense_times);
mean_faust_t = mean(faust_times); mean_faust_t = mean(faust_times);
...@@ -438,13 +450,15 @@ classdef hadamard ...@@ -438,13 +450,15 @@ classdef hadamard
import matfaust.Faust import matfaust.Faust
nb_mult=500; nb_mult=500;
Ms=6:14; Ms=6:12;
ns=2.^Ms; ns=2.^Ms;
nb_dim=length(Ms); nb_dim=length(Ms);
threshold=10^(-10); threshold=10^(-10);
h = waitbar(0,'speed up hadamard : Generation of the data ...'); if usejava('jvm')
h = waitbar(0,'speed up hadamard : Generation of the data ...');
end
Hadamard_matrices=cell(1,nb_dim); Hadamard_matrices=cell(1,nb_dim);
Hadamard_facts=cell(1,nb_dim); Hadamard_facts=cell(1,nb_dim);
...@@ -453,7 +467,9 @@ classdef hadamard ...@@ -453,7 +467,9 @@ classdef hadamard
for k=1:nb_dim for k=1:nb_dim
waitbar(k/nb_dim); if usejava('jvm')
waitbar(k/nb_dim);
end
M=Ms(k); M=Ms(k);
n=ns(k); n=ns(k);
% generation of the hadamard factorisation % generation of the hadamard factorisation
...@@ -461,7 +477,9 @@ classdef hadamard ...@@ -461,7 +477,9 @@ classdef hadamard
Hadamard_matrices{k}=H; Hadamard_matrices{k}=H;
Hadamard_facts{k}=facts; Hadamard_facts{k}=facts;
end end
close(h); if usejava('jvm')
close(h);
end
...@@ -473,9 +491,13 @@ classdef hadamard ...@@ -473,9 +491,13 @@ classdef hadamard
faust_mtimes_trans_times=zeros(nb_mult,nb_dim); faust_mtimes_trans_times=zeros(nb_mult,nb_dim);
h = waitbar(0,'speed up hadamard : multiplication time comparison ...'); if usejava('jvm')
h = waitbar(0,'speed up hadamard : multiplication time comparison ...');
end
for i=1:nb_mult for i=1:nb_mult
waitbar(i/nb_mult); if usejava('jvm')
waitbar(i/nb_mult);
end
for k=1:nb_dim for k=1:nb_dim
n=ns(k); n=ns(k);
hadamard_dense=Hadamard_matrices{k}; hadamard_dense=Hadamard_matrices{k};
...@@ -530,7 +552,9 @@ classdef hadamard ...@@ -530,7 +552,9 @@ classdef hadamard
faust_mtimes_trans_times(i,k)=t5; faust_mtimes_trans_times(i,k)=t5;
end end
end end
close(h); if usejava('jvm')
close(h);
end
mean_dense_t = mean(dense_times); mean_dense_t = mean(dense_times);
mean_faust_t = mean(faust_times); mean_faust_t = mean(faust_times);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment