<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title></title>
</head>
<body style="font-family:Arial;font-size:14px">
<p>Hello,<br>
<br>
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.<br>
<br>
S.<br>
<br>
Heinz <<a href="mailto:heinznabielek@me.com">heinznabielek@me.com</a>> a écrit :</p>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;" type="cite">
<p>My latest tictoc is 366: would that be 6.1 minutes?<br>
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.<br>
<br>
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...<br>
Heinz<br>
<br>
-----Original Message-----<br>
From: users [mailto:<a href="mailto:users-bounces@lists.scilab.org">users-bounces@lists.scilab.org</a>] On Behalf Of Stéphane Mottelet<br>
Sent: 31 January 2018 16:12<br>
To: <a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
Subject: Re: [Scilab-users] {EXT} need a more efficient and faster code: suggestions welcome<br>
<br>
Dear Heinz,<br>
<br>
Here is what can be done in Scilab-5.5.2 to accelerate your computations on a multi-core architecture under Linux :<br>
<br>
function out=distances(X)<br>
function out=distance(k)<br>
this=X(k,:);XX=X;XX(k,:)=[];<br>
DIFF=XX-ONE*this;<br>
out=sqrt(min((DIFF.*DIFF)*[1;1;1]));<br>
endfunction<br>
n=size(X,1);<br>
ONE=ones(n-1,1);<br>
out=parallel_run(1:n,distance);<br>
endfunction<br>
<br>
n=40000;<br>
r=23;<br>
radius = r*grand(n,1,'def').^(1/3);<br>
phi = 2*%pi*grand(n,1, 'def');<br>
costheta = 1 - 2*grand(n,1, 'def');<br>
radsintheta = radius.*sin(acos(costheta)); X = [radsintheta.*cos(phi),radsintheta.*sin(phi), radius.*costheta];<br>
<br>
On a modest server (two 10-core/20-threads Intel(R) Xeon(R) CPU E5-2660<br>
v2 @ 2.20GHz = 40 threads),<br>
<br>
-->tic;distances(X);toc<br>
ans =<br>
<br>
13.063<br>
<br>
On a smarter server (sixteen 6-core/6-threads Intel(R) Xeon(R) CPU X7542 @ 2.67GHz = 96 threads)<br>
<br>
-->tic;d=distances(X);toc<br>
ans =<br>
<br>
2.498<br>
<br>
I hope that parallel_run will be available again in the next version of scilab.<br>
<br>
S.<br>
<br>
Le 31/01/2018 à 10:53, Stéphane Mottelet a écrit :</p>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;" type="cite">
<p>Replacing<br>
<br>
MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];<br>
<br>
by<br>
<br>
MinDist=[MinDist sqrt(min(sum(DIFF.*DIFF,2)))];<br>
<br>
will be at least twice faster. Crunching elapsed time could be done by<br>
using parallel_run (with 5.5.2 version) if you have a multi-core<br>
processor.<br>
<br>
S.<br>
<br>
Le 31/01/2018 à 09:36, Dang Ngoc Chan, Christophe a écrit :</p>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;" type="cite">
<p>Hello,<br>
<br>
The following suggestions will probably not have a drastic influence<br>
(I don't see how it could be more vectorised) but his a little thing<br>
I see:<br></p>
<blockquote style="border-left:2px solid blue;margin-left:2px;padding-left:12px;" type="cite">
<p>De : users [mailto:<a href="mailto:users-bounces@lists.scilab.org">users-bounces@lists.scilab.org</a>] De la part de<br>
Heinz Nabielek Envoyé : mercredi 31 janvier 2018 00:13<br>
<br>
MinDist=[MinDist sqrt(min(sum(DIFF.^2,2)))];</p>
</blockquote>
Maybe you could concatenate the squares of the distance and then<br>
compute the square root of the whole vector in the end:<br>
<br>
sqMinDist=[sqMinDist min(sum(DIFF.^2,2))];<br>
<br>
…<br>
<br>
end<br>
<br>
…<br>
<br>
MinDist = sqrt(sqMinDist)<br>
<br>
Hope this helps,<br>
<br>
Regards<br>
<br>
--<br>
Christophe Dang Ngoc Chan<br>
Mechanical calculation engineer<br>
This e-mail may contain confidential and/or privileged information.<br>
If you are not the intended recipient (or have received this e-mail<br>
in error), please notify the sender immediately and destroy this<br>
e-mail. Any unauthorized copying, disclosure or distribution of the<br>
material in this e-mail is strictly forbidden.<br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
<a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a></blockquote>
</blockquote>
--<br>
Stéphane Mottelet<br>
Ingénieur de recherche<br>
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 <a href="http://www.utc.fr/~mottelet" target="_blank">http://www.utc.fr/~mottelet</a><br>
<br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.scilab.org">users@lists.scilab.org</a><br>
<a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a><br>
<br>
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.scilab">users@lists.scilab</a>.<a href="orghttp://lists.scilab.org/mailman/listinfo/users" target="_blank">orghttp://lists.scilab.org/mailman/listinfo/users</a></blockquote>
<p><br>
<br></p>
</body>
</html>