[Scilab-users] [EXTERNAL] Re: issue with parallel_run

Carrico, Paul paul.carrico at esterline.com
Tue Jun 14 10:48:44 CEST 2016


Thanks Stephane for the help.

It works now

NB: I changed n to 1000 and num to 1E6 (i.e. close to my need) and the speed up is nearly 7 (=7 time faster) :)

Paul

EXPORT CONTROL :
Cet email ne contient pas de données techniques
This email does not contain technical data

De : users [mailto:users-bounces at lists.scilab.org] De la part de Stéphane Mottelet
Envoyé : mardi 14 juin 2016 10:18
À : Users mailing list for Scilab
Objet : [EXTERNAL] Re: [Scilab-users] issue with parallel_run

Hello,

1-parallel_run is designed to cope with input-output data organized in columns
2-you have to precise the size of the output of yout fct() function.

Here is your corrected script (with comments) :

mode(0);

clear;



function random_matrix=fct(n)

    M = grand(n,12,'unf',-1,1);

    M = gsort(M,"lr","d");

    random_matrix = M(1,:)'; // transpose the output

    clear M;

endfunction





num = 10;

n = 1000;



// classical calculation



Result = zeros(12,num); // swap the dimensions



tic()



for i = 1 : num

    Result(:,i) = fct(n);

end



disp(Result);



time1 = toc(); printf("time 1 = %g\n",time1);



// using parallel_run



Result2 = zeros(num,12);

vect_n = n*ones(1,num);

tic()

Result2 = parallel_run(vect_n, fct,[12,1]); // precise size of output

disp(Result2);

time2 = toc(); printf("time 2 = %g\n",time2);


S.


Le 14/06/2016 à 10:06, Carrico, Paul a écrit :
mode(0);
clear;

function random_matrix=fct(n)

    M = grand(n,12,'unf',-1,1);
    M = gsort(M,"lr","d");
    random_matrix = M(1,:);

    clear M;

endfunction

num = 10;
n = 1000;

// classical calculation
Result = zeros(num,12);

tic()
for i = 1 : num
    Result(i,:) = fct(n);
end
disp(Result);
time1 = toc(); printf("time 1 = %g\n",time1);

// using parallel_run
Result2 = zeros(num,12);
vect_n = n*ones(1,num);

tic()
Result2 = parallel_run(vect_n, fct);
disp(Result2);
time2 = toc(); rintf("time 2 = %g\n",time2);




--

Département de Génie Informatique

EA 4297 Transformations Intégrées de la Matière Renouvelable

Université de Technologie de Compiègne -  CS 60319

60203 Compiègne cedex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160614/f4e835b5/attachment.htm>


More information about the users mailing list