Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Michal Jaegermann <michal@ellpspace.math.ualberta.ca>
Subject: Re: compiler efficency
Date: Tue, 28 Jan 1997 17:10:28 -0700 (MST)	[thread overview]
Message-ID: <199701290010.RAA09121@ellpspace.math.ualberta.ca> (raw)
In-Reply-To: <9701282002.AA15294@moene.indiv.nluug.nl>

Toon Moene wrote:
> 
> Claus Denk wrote:
> 
> >  Here you go: ( I was just posting the loop, as this is
> >  where almost all the time is spent)
> 
> [ ... Deleted ... ]
> 
> To implement Richard Henderson's suggestion (which sounds  
> reasonable to me), change the program as follows:
> 
>         PROGRAM EULER
>         DOUBLE PRECISION GAM, FAC
>         GAM = 1.0d0
>         FAC = 1.0d0
>         NMAX=100000000
>         DO I=2,NMAX
>           FAC=FAC+1.0d0
>           GAM=GAM+1.0d0/FAC
>         ENDDO
>         GAM = GAM - DLOG(dble(NMAX))
>         WRITE(*,*) GAM
>         WRITE(*,*) 'Exact: 0,57721566490153286060'
>         END

I tried this loop on the following machine (275 MHz Cabriolet):

cpu model               : EV4
cpu variation           : 0
cpu revision            : 0
cpu serial number       : Linux_is_Great!
system type             : Cabriolet
system variation        : 0
system revision         : 0
system serial number    : MILO-0000
cycle frequency [Hz]    : 274951883
timer frequency [Hz]    : 1024.00
page size [bytes]       : 8192
phys. address bits      : 34
max. addr. space #      : 63
BogoMIPS                : 271.58
kernel unaligned acc    : 0 (pc=0,va=0)
user unaligned acc      : 0 (pc=0,va=0)
cpu                     : Alpha

A compiler is gcc version 2.7.2, as distributed with RH 4.0, and
programs were compiled with 'fort77 -O6' (but a peek into a generated
assembler code does not reveal any differences with -O3).

Times were like this:

For an original version

20.94user 0.00system 0:20.95elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (84major+25minor)pagefaults 0swaps

For rewrite by Toon Moene

18.00user 0.00system 0:18.00elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (84major+25minor)pagefaults 0swaps

And this one

15.78user 0.00system 0:15.80elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (84major+25minor)pagefaults 0swaps

for the following variant:

      PROGRAM EULER
      DOUBLE PRECISION GAM, I, NMAX
      GAM = 1.0d0
      NMAX=100000000.
      DO I=NMAX,2.,-1
         GAM=GAM+1.0d0/I
      ENDDO
      GAM = GAM - DLOG(dble(NMAX))
      WRITE(*,*) GAM
      WRITE(*,*) 'Exact: 0,57721566490153286060'
      END

Yes, I realize that using a floating point loop control is, in general,
a Very Bad Idea (TM).  But in this particular case we can get away
with it. :-)

Unfortunately I cannot compare with results of Fortran compiler from DU. :-(

  Michal

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

       reply	other threads:[~1997-01-29  0:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <9701282002.AA15294@moene.indiv.nluug.nl>
1997-01-29  0:10 ` Michal Jaegermann [this message]
1997-01-28 23:23 compiler efficency Huw Davies
  -- strict thread matches above, loose matches on Subject: below --
1997-01-28 20:02 Toon Moene
1997-01-28 11:22 Claus Denk
1997-01-27 22:41 Craig Burley
1997-01-27 22:15 Przemek Klosowski
1997-01-27 21:48 Toon Moene
1997-01-27 20:51 Robert Williams
1997-01-27 20:37 Claus Denk
1997-01-27 20:35 ` Brett McCormick
1997-01-27 20:37 ` Lev D Gelb
1997-01-27 21:15 ` Jim Nance
1997-01-27 22:13 ` Scott Locklin
1997-01-27 22:41 ` Michal Jaegermann
1997-01-27 23:35 ` Richard Henderson
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox