[Scilab-users] {EXT} need a more efficient and faster code: suggestions welcome
stephane.mottelet at utc.fr
stephane.mottelet at utc.fr
Wed Jan 31 21:47:19 CET 2018
Hello,
Don't even think about using parallel_run under OSX. It used to work
(with some tweaking) with scilab-5.5.1 under Mavericks, but since
5.5.2 version, it has become completely unstable.
S.
Heinz <heinznabielek at me.com> a écrit :
> My latest tictoc is 366: would that be 6.1 minutes?
> I am away from my 2 iMacs at home and running Scilab on a lowly
> Intel Pentium CPU N3540 @ 2.16GHz Win10 laptop. Your "2.498" for
> 40,000 points are phenomenal regarding the fact that the running
> time increases with the square of the number of points.
>
> The later iMac has a Quad-Core-i7 at 3.2 GHz: can I run your code
> version there under the older Scilab? Not that I understand how
> parallel processing works...
> Heinz
>
> -----Original Message-----
> From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of
> Stéphane Mottelet
> Sent: 31 January 2018 16:12
> To: users at lists.scilab.org
> Subject: Re: [Scilab-users] {EXT} need a more efficient and faster
> code: suggestions welcome
>
> Dear Heinz,
>
> Here is what can be done in Scilab-5.5.2 to accelerate your
> computations on a multi-core architecture under Linux :
>
> function out=distances(X)
> function out=distance(k)
> this=X(k,:);XX=X;XX(k,:)=[];
> DIFF=XX-ONE*this;
> out=sqrt(min((DIFF.*DIFF)*[1;1;1]));
> endfunction
> n=size(X,1);
> ONE=ones(n-1,1);
> out=parallel_run(1:n,distance);
> endfunction
>
> n=40000;
> r=23;
> radius = r*grand(n,1,'def').^(1/3);
> phi = 2*%pi*grand(n,1, 'def');
> costheta = 1 - 2*grand(n,1, 'def');
> radsintheta = radius.*sin(acos(costheta)); X =
> [radsintheta.*cos(phi),radsintheta.*sin(phi), radius.*costheta];
>
> On a modest server (two 10-core/20-threads Intel(R) Xeon(R) CPU E5-2660
> v2 @ 2.20GHz = 40 threads),
>
> -->tic;distances(X);toc
> ans =
>
> 13.063
>
> On a smarter server (sixteen 6-core/6-threads Intel(R) Xeon(R) CPU
> X7542 @ 2.67GHz = 96 threads)
>
> -->tic;d=distances(X);toc
> ans =
>
> 2.498
>
> I hope that parallel_run will be available again in the next version
> of scilab.
>
> S.
>
> Le 31/01/2018 à 10:53, Stéphane Mottelet a écrit :
>> Replacing
>>
>> MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];
>>
>> by
>>
>> MinDist=[MinDist sqrt(min(sum(DIFF.*DIFF,2)))];
>>
>> will be at least twice faster. Crunching elapsed time could be done by
>> using parallel_run (with 5.5.2 version) if you have a multi-core
>> processor.
>>
>> S.
>>
>> Le 31/01/2018 à 09:36, Dang Ngoc Chan, Christophe a écrit :
>>> Hello,
>>>
>>> The following suggestions will probably not have a drastic influence
>>> (I don't see how it could be more vectorised) but his a little thing
>>> I see:
>>>
>>>> De : users [mailto:users-bounces at lists.scilab.org] De la part de
>>>> Heinz Nabielek Envoyé : mercredi 31 janvier 2018 00:13
>>>>
>>>> MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];
>>>
>>> Maybe you could concatenate the squares of the distance and then
>>> compute the square root of the whole vector in the end:
>>>
>>> sqMinDist=[sqMinDist min(sum(DIFF.^2,2))];
>>>
>>> …
>>>
>>> end
>>>
>>> …
>>>
>>> MinDist = sqrt(sqMinDist)
>>>
>>> Hope this helps,
>>>
>>> Regards
>>>
>>> --
>>> Christophe Dang Ngoc Chan
>>> Mechanical calculation engineer
>>> This e-mail may contain confidential and/or privileged information.
>>> If you are not the intended recipient (or have received this e-mail
>>> in error), please notify the sender immediately and destroy this
>>> e-mail. Any unauthorized copying, disclosure or distribution of the
>>> material in this e-mail is strictly forbidden.
>>> _______________________________________________
>>> users mailing list
>>> users at lists.scilab.org
>>> http://lists.scilab.org/mailman/listinfo/users
>
> --
> Stéphane Mottelet
> Ingénieur de recherche
> EA 4297 Transformations Intégrées de la Matière Renouvelable
> Département Génie des Procédés Industriels Sorbonne Universités -
> Université de Technologie de Compiègne CS 60319, 60203 Compiègne
> cedex Tel : +33(0)344234688 http://www.utc.fr/~mottelet
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
> _______________________________________________
> users mailing list
> users at lists.scilab.orghttp://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180131/5bfeafb3/attachment.htm>
More information about the users
mailing list