[Scilab-users] Advice from Scilab community (including parallelization)

Paul Carrico paul.carrico at free.fr
Sat Oct 26 11:08:04 CEST 2013


Dear All

 

I think the example hereafter is quite interesting since it shows the speed
quickly increase . but it remains too long for my application L

 

Thus an additional question : is the only way is to use parallelization
(I've 8 cores on my working station) ? what about Scilab today on that
specific issue ?

 

Regards

 

Paul

 

############################################################################
#############

mode(0);

clear all;

 

stacksize('max'); 

 

n = 5*5031;

As = rand(n,4);

Bs = rand(n,4);

A = [As ; Bs ; Bs ; As ; As ; As ; Bs]; [nl,nc]=size(A)

block_size = 1000;

rest = modulo(nl,block_size);

number_of_blocks = (nl - rest)/block_size;

 

printf("A splitted into blocks............\n");

 

k=0;

tic()

if (rest <> 0 ) then

    k = 1;

    s0 = "...

    splited" + string(number_of_blocks + k)+" = A($ - rest +1 : $,:) , ...

    ";

    execstr(s0);

end

 

for h = 1 : number_of_blocks

    s1 = "...

    splited" + string(h) + " = A(block_size * (" + string(h) + " - 1) + 1 :
" + string(h) + " * block_size , :), ... 

    ";

    execstr(s1);

end

 

split_time=toc()

 

printf("Search for duplicates............\n");

 

//tic()

for i = 1 : (number_of_blocks + k)

    printf("block ref %d/%d ...\n",i,(number_of_blocks+k));

    tic()

    for j = 1 : (number_of_blocks + k)

        s2 = "...

        if (j == i) then , ...

            [nb,loc] = members(splited" + string(i) + ",splited" + string(j)
+ ", ""rows"",""shuffle"",""last"") , ...

            splited" + string(j) + "(loc(find(nb >= 2)),:) = [] , ...

        else , ...

            [nb,loc] = members(splited" + string(i) + ",splited" + string(j)
+ ", ""rows"",""shuffle"") , ...

            splited" + string(j) + "(loc(find(nb >= 1)),:) = [] , ...

        end , ...

        ";

        execstr(s2);

    end

    time=toc();

    printf("..... time on this loop= %g\n",time)

end

//time = toc()

 

//tic()

A_final = [];

for i = 1 : (number_of_blocks + k)

    s3 = " ...

    A_final = [A_final ; splited" + string(i) + "], ...

    ";

    execstr(s3);

end

//time2 = toc()

 

[nl2,nc2] = size(A_final)

 

 

################################################

nc  =

 

    4.  

 nl  =

 

    176085.  

A splitted into blocks............

split_time  =

 

    0.032  

Search for duplicates............

block ref 1/177 ...

...... time on this loop= 36.535

block ref 2/177 ...

...... time on this loop= 35.833

block ref 3/177 ...

..

block ref 10/177 ...

...... time on this loop= 30.591

block ref 11/177 ...

...... time on this loop= 30.03

block ref 12/177 ...

...... time on this loop= 29.39

block ref 13/177 ...

...... time on this loop= 28.782

block ref 14/177 ...

...... time on this loop= 28.143

block ref 15/177 ...

..

...... time on this loop= 19.905

block ref 29/177 ...

...... time on this loop= 19.5

block ref 30/177 ...

...... time on this loop= 19.079

block ref 31/177 ...

...... time on this loop= 18.658

block ref 32/177 ...

...... time on this loop= 18.252

block ref 33/177 ...

...... time on this loop= 17.831

block ref 34/177 ...

...... time on this loop= 17.456

..

...... time on this loop= 12.511

block ref 47/177 ...

...... time on this loop= 12.075

block ref 48/177 ...

...... time on this loop= 11.669

..

...... time on this loop= 0.032

block ref 58/177 ...

..

...

block ref 177/177 ...

...... time on this loop= 0.032

nc2  =

 

    4.  

 nl2  =

 

    50310.  

 



---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20131026/bcfe5176/attachment.htm>


More information about the users mailing list