Hi Greg,

 You are absolutely right I made a mistake adding the wrong numbers.
The results for my previous test 3 is really  32 sec NOT 55 sec
like I wrote before. Sys time is nearly zero for this
test which is what I was expecting.
 For test 2 I get roughly twice the time of test 1.

 In any case, many thanks for the explanation,

 Xavier

On 3/2/07, Vanuxem Grégory <[EMAIL PROTECTED]> wrote:
Le vendredi 02 mars 2007 à 09:01 +0000, Xavier Calbet a écrit :
>   Hello,
>
>   I am getting confused now with inplace. The detailed code and times
> are shown below.
> I am running three tests trying to implement inplace operations
> to make the code faster. The summary is:
>
> Test #     command                                  time
>  1:      $Re=$Re+1000.;                          58 sec
>  2:      $Re.=$Re+1000.;                       109 sec
>  3:      $Re->inplace;$Re+1000.;            55 sec

#1: a new piddle of ~30Mb is created, threading is used (threading along
dimension 0 and 1 of $Re). Affectation of the new result of each
addition to the elements of this new piddle.

#2: same thing _+_ affectation of the _new_ 2000x2000 piddle (after
calculation) to $Re, each element at a time.
(I find your timing surprising)

#3: threading as in #1 and #2 but no new piddle, results of additions
affected to elements of $Re "inplace".
(in C : Re[x,y] = Re[x,y]*1000, approximatively, since piddle are
represented by a one dimensional array in a more complex structure).


with 2000x2000 piddle of double (from your code below)
----------------------------------
---- #1
time perl pdl.pl

real    0m48.948s
user    0m25.947s
sys     0m22.981s

---- #3
time perl pdl_i.pl

real    0m23.460s
user    0m23.032s
sys     0m0.350s
----------------------------------

23 secondes against 48.

Apparently you made a mistake, your timings above do not reflect the
ones below.

Greg


>
>   I believe test 3 is doing things really inplace, but its time is almost the
> same as test 1, which is the "easy" way. Does this mean
> that test 1 is really done inplace? Or maybe test 3 is not done inplace?
>
>   I thought the .= operator performed operations inplace, and I would have
> thought test 2 was also doing things inplace like test 3. Obviously it is
> not. In fact it is taking twice the time to run probably meaning it is
> doing the calculations twice. What am I missing here?
>
>   Many thanks again,
>
>   Xavier
>
>
> *******************************************
> Test 1
> -----------------------------------------
> $npts=2000;
> $niter=1000;
> $Re=zeroes(double,$npts,$npts)->xlinvals(-1.5,0.5);
>
> for($j=0;$j<$niter;$j++){
>     $Re=$Re+1000.;
> }
> ------------------------------------------------
>  time output:
>
> real    1m0.727s
> user    0m22.794s
> sys     0m36.667s
>
> ******************************************************
> Test 2:
> ---------------------------------------------------
> $npts=2000;
> $niter=1000;
> $Re=zeroes(double,$npts,$npts)->xlinvals(-1.5,0.5);
>
> for($j=0;$j<$niter;$j++){
>     $Re.=$Re+1000.;
> }
> ------------------------------------------------------
> time output:
>
> real    1m53.829s
> user    1m11.915s
> sys     0m37.040s
>
> *******************************************************
> Test 3
> -------------------------------------------------------
> $npts=2000;
> $niter=1000;
> $Re=zeroes(double,$npts,$npts)->xlinvals(-1.5,0.5);
>
> for($j=0;$j<$niter;$j++){
>     $Re->inplace;
>     $Re+1000.;
> }
> --------------------------------------------------------
> time output:
>
> real    0m33.181s
> user    0m32.446s
> sys     0m0.190s






___________________________________________________________________________
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son 
interface révolutionnaire.
http://fr.mail.yahoo.com



_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to