* Re: sqrt 10x slower in 2.0.7-19 than 2.0.6-9 ???
@ 1998-10-01 17:10 Greg Lindahl
1998-10-02 6:34 ` Richard Henderson
0 siblings, 1 reply; 10+ messages in thread
From: Greg Lindahl @ 1998-10-01 17:10 UTC (permalink / raw)
To: axp-list
> I am encountering some very strange performance numbers with sqrt in
> the glibc math library on the alpha.
1. It's a feature, not a bug. The old sqrt didn't always give the
right answer, so they reverted to a working but slow algorithm.
2. It's been discussed here repeatedly.
3. The fast math library has an even faster sqrt than the old, buggy
one in glibc.
-- g
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sqrt 10x slower in 2.0.7-19 than 2.0.6-9 ???
1998-10-01 17:10 sqrt 10x slower in 2.0.7-19 than 2.0.6-9 ??? Greg Lindahl
@ 1998-10-02 6:34 ` Richard Henderson
1998-10-02 7:32 ` Jochen Kuepper
1998-10-02 16:44 ` Christopher C Chimelis
0 siblings, 2 replies; 10+ messages in thread
From: Richard Henderson @ 1998-10-02 6:34 UTC (permalink / raw)
To: axp-list
On Thu, Oct 01, 1998 at 01:10:51PM -0400, Greg Lindahl wrote:
> 1. It's a feature, not a bug. The old sqrt didn't always give the
> right answer, so they reverted to a working but slow algorithm.
Not that it matters to folks right away, but in the glibc 2.1 development
tree I've arranged for the fast sqrt to be used when the inputs are in
range, falling back to the slower algorithm otherwise.
r~
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sqrt 10x slower in 2.0.7-19 than 2.0.6-9 ???
1998-10-02 6:34 ` Richard Henderson
@ 1998-10-02 7:32 ` Jochen Kuepper
1998-10-02 7:41 ` Richard Henderson
1998-10-02 16:44 ` Christopher C Chimelis
1 sibling, 1 reply; 10+ messages in thread
From: Jochen Kuepper @ 1998-10-02 7:32 UTC (permalink / raw)
To: Richard Henderson; +Cc: Alpha-Linux mailing list
On Fri, 02 Oct 1998 Richard Henderson wrote:
>Not that it matters to folks right away, but in the glibc 2.1 development
>tree I've arranged for the fast sqrt to be used when the inputs are in
>range, falling back to the slower algorithm otherwise.
What's about using code from libfm or libffm for AXP ?
Are there licensing issues ?
Greetings,
Jochen
-----------------------------------------------------------------------
Jochen K"upper
Heinrich-Heine-Universit"at D"usseldorf jochen@uni-duesseldorf.de
Institut f"ur Physikalische Chemie I
Universit"atsstr. 1, Geb 26.43 Raum 02.29 phone ++49-211-8113681
40225 D"usseldorf fax ++49-211-8115195
Germany http://www-public.rz.uni-duesseldorf.de/~jochen
-----------------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sqrt 10x slower in 2.0.7-19 than 2.0.6-9 ???
1998-10-02 7:32 ` Jochen Kuepper
@ 1998-10-02 7:41 ` Richard Henderson
1998-10-02 15:11 ` Kazushige Goto
0 siblings, 1 reply; 10+ messages in thread
From: Richard Henderson @ 1998-10-02 7:41 UTC (permalink / raw)
To: Jochen Kuepper, Richard Henderson; +Cc: Alpha-Linux mailing list
On Fri, Oct 02, 1998 at 09:32:41AM +0200, Jochen Kuepper wrote:
> What's about using code from libfm or libffm for AXP ?
> Are there licensing issues ?
No, domain issues. Those routines are fast, but the domain
in which they are correct is quite restricted.
Unless someone feels like doing the work to have those codes
fall back on other algorithms, they will forever be relegated
to add-on libraries.
r~
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sqrt 10x slower in 2.0.7-19 than 2.0.6-9 ???
1998-10-02 6:34 ` Richard Henderson
1998-10-02 7:32 ` Jochen Kuepper
@ 1998-10-02 16:44 ` Christopher C Chimelis
1 sibling, 0 replies; 10+ messages in thread
From: Christopher C Chimelis @ 1998-10-02 16:44 UTC (permalink / raw)
To: Richard Henderson; +Cc: axp-list
On Thu, 1 Oct 1998, Richard Henderson wrote:
> Not that it matters to folks right away, but in the glibc 2.1 development
> tree I've arranged for the fast sqrt to be used when the inputs are in
> range, falling back to the slower algorithm otherwise.
I noticed this. Thanks a bunch for this. On the Debian side, since we're
nearing release, I've just been compiling math packages or anything using
sqrt with libffm since it made such a huge difference.
C
^ permalink raw reply [flat|nested] 10+ messages in thread
* sqrt 10x slower in 2.0.7-19 than 2.0.6-9 ???
@ 1998-10-01 16:46 John Salmon
1998-10-01 17:25 ` Jochen Kuepper
1998-10-08 10:16 ` Stefan Schroepfer
0 siblings, 2 replies; 10+ messages in thread
From: John Salmon @ 1998-10-01 16:46 UTC (permalink / raw)
To: axp-list
I am encountering some very strange performance numbers with sqrt in
the glibc math library on the alpha.
Executive summary: sqrt from the glibc-2.0.6-9.alpha.rpm appears to be
over 10 times faster than sqrt in glibc-2.0.7-19.alpha.rpm.
Details:
I have two machines on which I can run tests. Both are 533Mhz EV56
systems. The primary hardware difference is that one is an LX164 and
the other is an SX164. I don't think that's relevant to the problem,
but 'full disclosure' is always a good idea. /proc/cpuinfo is
attached at the end of this note.
Machine 1 (LX164) has RH5.1 and glibc-2.0.7-19 installed from the updates
rpm.
Machine 2 (SX164) has RH5.0 and glibc-2.0.6-9 installed from an rpm (source
unknown, possibly from updates, but it no longer exists at ftp.redhat.com).
A very simple code that times a loop of 1million calls to sqrt is attached.
I compiled it with -static on both platforms and then ran the resulting
executable on both platforms. On both platforms, the glib-2.0.6-9 code
runs nearly eleven times faster. For example:
[johns@paranal junk]$ sqrtloop.static.06
1000000 sqrts in 0.1952 sec, 5.12295e+06 per sec
[johns@paranal junk]$ sqrtloop.static.07
1000000 sqrts in 2.13549 sec, 468277 per sec
[johns@paranal junk]$
Compiling without -static gives consistent results. I..e., the machine
with the 2.0.6 dynamic library is faster by about a factor of 10,
regardless of where the compilation was performed).
So the question is:
Why is the 2.0.7 sqrt so much slower than the 2.0.6??
I thought I'd take a look at glibc-2.0.6-9.src.rpm to try to find out.
I can't find it anywhere! (HotBot, ftp.redhat.com). Does anybody have
an archived copy?
Thanks for your help,
John Salmon
Appendix 1: C source code to sqrtloop.c
[johns@paranal junk]$ cat sqrtloop.c
---------------------------
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#define NTIMES 1000000
int main(int argc, char **argv){
int i = NTIMES;
double x = 0.7;
clock_t tstart, tend;
double seconds;
tstart = clock();
while(--i){
x = sqrt(x) + 0.5;
}
tend = clock();
seconds = ((double)(tend-tstart))/CLOCKS_PER_SEC;
printf("%d sqrts in %g sec, %g per sec\n",
NTIMES, seconds, NTIMES/seconds);
return 0;
}
-----------------------------
Appendix 2: /proc/cpuinfo details
Machine 1 (glibc-2.0.7-19.rpm)
[johns@paranal junk]$ cat /proc/cpuinfo
cpu : Alpha
cpu model : EV56
cpu variation : 0
cpu revision : 0
cpu serial number : Linux_is_Great!
system type : EB164
system variation : LX164
system revision : 0
system serial number : MILO-0000
cycle frequency [Hz] : 0
timer frequency [Hz] : 1024.00
page size [bytes] : 8192
phys. address bits : 40
max. addr. space # : 127
BogoMIPS : 530.57
kernel unaligned acc : 0 (pc=0,va=0)
user unaligned acc : 134 (pc=155556b77a0,va=11ffff8c8)
platform string : N/A
Machine 2 (glibc-2.0.6-9.rpm):
[johns@avalon2 libm]$ cat /proc/cpuinfo
cpu : Alpha
cpu model : EV56
cpu variation : 0
cpu revision : 0
cpu serial number : Linux_is_Great!
system type : EB164
system variation : SX164
system revision : 0
system serial number : MILO-0000
cycle frequency [Hz] : 0
timer frequency [Hz] : 1024.00
page size [bytes] : 8192
phys. address bits : 40
max. addr. space # : 127
BogoMIPS : 528.48
kernel unaligned acc : 0 (pc=0,va=0)
user unaligned acc : 220 (pc=155556dc6b0,va=11ffffc40)
platform string : N/A
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: sqrt 10x slower in 2.0.7-19 than 2.0.6-9 ???
1998-10-01 16:46 John Salmon
@ 1998-10-01 17:25 ` Jochen Kuepper
1998-10-01 19:08 ` Christopher C Chimelis
1998-10-08 10:16 ` Stefan Schroepfer
1 sibling, 1 reply; 10+ messages in thread
From: Jochen Kuepper @ 1998-10-01 17:25 UTC (permalink / raw)
To: axp-list, John Salmon
As discussed here several times, older glibc math libs had bugs that were fixed
somewhere inbetween your two versions. Due to these bugfixes some routines
(like sqrt) got slower. You should use the newer glibc if you depend on your
results.
There are two well optimized libs that provide parts of the libm, namely libffm
and libfm, maintained by K. Goto and J. Wesner. Check the web for these if you
want some real speed improvements.
Greetings,
Jochen
-----------------------------------------------------------------------
Jochen K"upper
Heinrich-Heine-Universit"at D"usseldorf jochen@uni-duesseldorf.de
Institut f"ur Physikalische Chemie I
Universit"atsstr. 1, Geb 26.43 Raum 02.29 phone ++49-211-8113681
40225 D"usseldorf fax ++49-211-8115195
Germany http://www-public.rz.uni-duesseldorf.de/~jochen
-----------------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sqrt 10x slower in 2.0.7-19 than 2.0.6-9 ???
1998-10-01 17:25 ` Jochen Kuepper
@ 1998-10-01 19:08 ` Christopher C Chimelis
0 siblings, 0 replies; 10+ messages in thread
From: Christopher C Chimelis @ 1998-10-01 19:08 UTC (permalink / raw)
To: axp-list; +Cc: John Salmon
On Thu, 1 Oct 1998, Jochen Kuepper wrote:
> As discussed here several times, older glibc math libs had bugs that were fixed
> somewhere inbetween your two versions. Due to these bugfixes some routines
> (like sqrt) got slower. You should use the newer glibc if you depend on your
> results.
> There are two well optimized libs that provide parts of the libm, namely libffm
> and libfm, maintained by K. Goto and J. Wesner. Check the web for these if you
> want some real speed improvements.
Speaking of which, on my UDB (running Debian and the latest glibc 2.0.7
rev), I ran a comparison between using libffm and just libm. Here's what
I got:
libffm + libm:
1000000 sqrts in 1.68946 sec, 591907 per sec
libm only:
1000000 sqrts in 9.90054 sec, 101005 per sec
As you can see, this is a HUGE improvement in sqrt times. Also, keep in
mind that libffm was really written for the 21164's (UDBs have 21066's),
so if libffm can possibly get better for the 21066's, I could probably get
better numbers.
C
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: sqrt 10x slower in 2.0.7-19 than 2.0.6-9 ???
1998-10-01 16:46 John Salmon
1998-10-01 17:25 ` Jochen Kuepper
@ 1998-10-08 10:16 ` Stefan Schroepfer
1 sibling, 0 replies; 10+ messages in thread
From: Stefan Schroepfer @ 1998-10-08 10:16 UTC (permalink / raw)
To: axp-list
John Salmon wrote:
>
> I am encountering some very strange performance numbers with sqrt in
> the glibc math library on the alpha.
>
> Executive summary: sqrt from the glibc-2.0.6-9.alpha.rpm appears to be
> over 10 times faster than sqrt in glibc-2.0.7-19.alpha.rpm.
Replying latetly to this thread. All answers I read only
mentioned glibc/libffm issues, but IIRC the 21164PC CPU
on the SX board has a hardware sqrt instruction. Is this
utilized by a glibc 2 system?
> Details:
> I have two machines on which I can run tests. Both are 533Mhz EV56
> systems. The primary hardware difference is that one is an LX164 and
> the other is an SX164. I don't think that's relevant to the problem,
> but 'full disclosure' is always a good idea. /proc/cpuinfo is
> attached at the end of this note.
scr@iis.fhg.de
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~1998-10-08 10:22 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-10-01 17:10 sqrt 10x slower in 2.0.7-19 than 2.0.6-9 ??? Greg Lindahl
1998-10-02 6:34 ` Richard Henderson
1998-10-02 7:32 ` Jochen Kuepper
1998-10-02 7:41 ` Richard Henderson
1998-10-02 15:11 ` Kazushige Goto
1998-10-02 16:44 ` Christopher C Chimelis
-- strict thread matches above, loose matches on Subject: below --
1998-10-01 16:46 John Salmon
1998-10-01 17:25 ` Jochen Kuepper
1998-10-01 19:08 ` Christopher C Chimelis
1998-10-08 10:16 ` Stefan Schroepfer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox