* Re: egcs g77 and DgncppB
@ 1998-11-17 17:25 Greg Lindahl
1998-11-17 18:19 ` Wes Bauske
0 siblings, 1 reply; 11+ messages in thread
From: Greg Lindahl @ 1998-11-17 17:25 UTC (permalink / raw)
To: axp-list
> > This looks like libI77 was not itself compiled with -mieee. Don't the
> > egcs build scripts default to building libI77 with -mieee?
> >
>
> Would make sense to have the libraries built both ways.
> That way people who don't want to fix the bugs in their
> code can pay the penalty for using -mieee and those willing
> to get their code working correctly get the best performance
> available by using a non -mieee version of the library.
You're assuming that -mieee makes a big difference in library
run-time. I suspect it doesn't, since it doesn't have that many
floating point ops in it, and when it does, it does expensive things
anyway, like converting to ascii and back.
I also don't see why you think that only bugs generate NaN's. But
that's a different issue.
-- g
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: egcs g77 and DgncppB
1998-11-17 17:25 egcs g77 and DgncppB Greg Lindahl
@ 1998-11-17 18:19 ` Wes Bauske
0 siblings, 0 replies; 11+ messages in thread
From: Wes Bauske @ 1998-11-17 18:19 UTC (permalink / raw)
To: axp-list
Greg Lindahl wrote:
>
> > > This looks like libI77 was not itself compiled with -mieee. Don't the
> > > egcs build scripts default to building libI77 with -mieee?
> > >
> >
> > Would make sense to have the libraries built both ways.
> > That way people who don't want to fix the bugs in their
> > code can pay the penalty for using -mieee and those willing
> > to get their code working correctly get the best performance
> > available by using a non -mieee version of the library.
>
> You're assuming that -mieee makes a big difference in library
> run-time. I suspect it doesn't, since it doesn't have that many
> floating point ops in it, and when it does, it does expensive things
> anyway, like converting to ascii and back.
>
As I said, those that want it should have their own
version. Those that don't should not get it in their
code path.
> I also don't see why you think that only bugs generate NaN's. But
> that's a different issue.
>
Ask yourself how many customers would pay you to
produce a NaN for them....
The key is to create algorithms that do not
create NaN's in the range of values you expect
to have data in.
I get paid to get a good result, not nonsense.
Research and academic code may consider it valid
but I've never had a customer who would accept such
output.
Wes
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: egcs g77 and DgncppB
@ 1998-11-17 22:00 Greg Lindahl
1998-11-17 22:38 ` Wes Bauske
0 siblings, 1 reply; 11+ messages in thread
From: Greg Lindahl @ 1998-11-17 22:00 UTC (permalink / raw)
To: axp-list
> That statement in itself
> indicates there must be FP calculations in the library,
> which in turn means -mieee is not "free".
Sorry, I thought you were reading the thread. The original bug report
included a gdb session which makes it clear that the library was doing
an fp operation (d < 0.0). I then speculated on the relative number of fp
operations in the library, and predicted that no one would lose if we
made -mieee the default for the library.
> Be that as it may, the solution for DgncppB
I was posting about a different issue: all codes that use -mieee need
a library which can print NaN's. If you want to talk about debugging
that one code, that's great -- what we need for that is an exact
prescription of how to get precise exceptions and core dumps in the
face of NaN and Infinity generation. But be aware that there is more
than one issue being talked about.
-- g
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: egcs g77 and DgncppB
1998-11-17 22:00 Greg Lindahl
@ 1998-11-17 22:38 ` Wes Bauske
0 siblings, 0 replies; 11+ messages in thread
From: Wes Bauske @ 1998-11-17 22:38 UTC (permalink / raw)
To: axp-list
Greg Lindahl wrote:
>
> > That statement in itself
> > indicates there must be FP calculations in the library,
> > which in turn means -mieee is not "free".
>
> Sorry, I thought you were reading the thread. The original bug report
> included a gdb session which makes it clear that the library was doing
> an fp operation (d < 0.0). I then speculated on the relative number of fp
> operations in the library, and predicted that no one would lose if we
> made -mieee the default for the library.
>
If you have time, try determine roughly how much
FP work is done in the libraries. Based on that
estimate, it may make sense to make -mieee a default
but since it's not that way now, it always helps
to quantify as much as possible, what the change would
do, particularly if it can potentially impact performance.
g77 gets lots of heat due to performance issues so it
seems prudent to not make changes that make performance
worse without a strong argument. The question is
"how much worse?".
> > Be that as it may, the solution for DgncppB
>
> I was posting about a different issue: all codes that use -mieee need
> a library which can print NaN's. If you want to talk about debugging
> that one code, that's great -- what we need for that is an exact
> prescription of how to get precise exceptions and core dumps in the
> face of NaN and Infinity generation. But be aware that there is more
> than one issue being talked about.
>
Well, I was basing the discussion on the subject line.
NaN handling is a reasonable goal. It just goes
against high performance on Alphas, and, as such, should
not be in the main path of the code unless one explicitly
selects that option, for a particular application.
--
Regards,
Wes
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: egcs g77 and DgncppB
@ 1998-11-17 20:27 Greg Lindahl
1998-11-17 21:50 ` Wes Bauske
0 siblings, 1 reply; 11+ messages in thread
From: Greg Lindahl @ 1998-11-17 20:27 UTC (permalink / raw)
To: axp-list
> > You're assuming that -mieee makes a big difference in library
> > run-time. I suspect it doesn't, since it doesn't have that many
> > floating point ops in it, and when it does, it does expensive things
> > anyway, like converting to ascii and back.
> >
>
> As I said, those that want it should have their own
> version. Those that don't should not get it in their
> code path.
So let me get this straight: you think that even if there is no
difference in CPU time consumed, someone should still spend human
effort to make this "feature" available, when nobody needs it?
> Ask yourself how many customers would pay you to
> produce a NaN for them....
Many legitimate algorithms use IEEE in interesting ways to produce
fast answers -- there are NaN's along the way, but the final answer is
right. Just because you don't use such algorithms doesn't mean other
people shouldn't use them.
-- g
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: egcs g77 and DgncppB
1998-11-17 20:27 Greg Lindahl
@ 1998-11-17 21:50 ` Wes Bauske
1998-11-18 18:15 ` Hirsim{ki Mika
0 siblings, 1 reply; 11+ messages in thread
From: Wes Bauske @ 1998-11-17 21:50 UTC (permalink / raw)
To: axp-list
Greg Lindahl wrote:
>
> > > You're assuming that -mieee makes a big difference in library
> > > run-time. I suspect it doesn't, since it doesn't have that many
> > > floating point ops in it, and when it does, it does expensive things
> > > anyway, like converting to ascii and back.
> > >
> >
> > As I said, those that want it should have their own
> > version. Those that don't should not get it in their
> > code path.
>
> So let me get this straight: you think that even if there is no
> difference in CPU time consumed, someone should still spend human
> effort to make this "feature" available, when nobody needs it?
>
Since the libraries are apparently NOT compiled with
-mieee, which is how this thread started, it seems
the addition of -mieee is creating the extra labor.
In fact, I believe this is the first piece of SW
that someone complained was having FPE's in the G77
libraries on this list. That statement in itself
indicates there must be FP calculations in the library,
which in turn means -mieee is not "free".
Be that as it may, the solution for DgncppB is to either
determine how the code generated data that causes the FPE
in LIBI77 or, since it's a problem specific to that code,
rebuild egcs with the -mieee flag active for the library
and see if that helps. Note using -mieee does not guarantee
FPE's go away.
> > Ask yourself how many customers would pay you to
> > produce a NaN for them....
>
> Many legitimate algorithms use IEEE in interesting ways to produce
> fast answers -- there are NaN's along the way, but the final answer is
> right. Just because you don't use such algorithms doesn't mean other
> people shouldn't use them.
>
Interesting statement. If you have time, please give
a brief description of how one example would do this,
preferably off line since I'm not sure anyone else
cares about this discussion.
--
Regards,
Wes
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: egcs g77 and DgncppB
1998-11-17 21:50 ` Wes Bauske
@ 1998-11-18 18:15 ` Hirsim{ki Mika
1998-11-18 20:25 ` Wes Bauske
0 siblings, 1 reply; 11+ messages in thread
From: Hirsim{ki Mika @ 1998-11-18 18:15 UTC (permalink / raw)
To: axp-list; +Cc: axp-list
> in LIBI77 or, since it's a problem specific to that code,
> rebuild egcs with the -mieee flag active for the library
> and see if that helps. Note using -mieee does not guarantee
> FPE's go away.
I re-compiled the libI77 with -mieee and with -mieee-with-
inexact, but neither fixed the problem.
I've traced the problem to following part of Dgncpp code:
real*8 sgrad,pi4
...
sgrad=0.16*abs(dcp(i)/pi4)/(dc(i)/pi4)**1.33
write(28,'(5(e12.6,1x))') r(i),dc(i),sgrad,ves(i),vxc(i)
...
The problem is that the variable sgrad goes infinite (as
the denominator becomes zero, which is what it should do
in any case) and write chokes on it. This, of course,
is easily fixed by manually adding code that checks the
denominator before calculating sgrad, but to my mind the
compiler/runtime-libs should be able to handle a NaN. I
don't mind if it prints out NaNs, because that's basically
what the physics predicts. What I do mind is getting SIGFPEs
and a stopped execution just because write can't handle NaNs.
However at least Martin Fuchs (not Matthias as I previously
wrote) and the other people at fhi-berlin.mpg.de, some of whom
I received mail from regarding my previous post, might find
it interesting to know that their more complex program fhi96md
(an ab initio code) compiled and ran almost unmodified on
Alpha Linux. Just had to add -mieee to the compiler options.
A very nice surprise. :)
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: egcs g77 and DgncppB
1998-11-18 18:15 ` Hirsim{ki Mika
@ 1998-11-18 20:25 ` Wes Bauske
0 siblings, 0 replies; 11+ messages in thread
From: Wes Bauske @ 1998-11-18 20:25 UTC (permalink / raw)
To: axp-list
Hirsim{ki Mika wrote:
>
> > in LIBI77 or, since it's a problem specific to that code,
> > rebuild egcs with the -mieee flag active for the library
> > and see if that helps. Note using -mieee does not guarantee
> > FPE's go away.
>
> I re-compiled the libI77 with -mieee and with -mieee-with-
> inexact, but neither fixed the problem.
>
> I've traced the problem to following part of Dgncpp code:
>
> real*8 sgrad,pi4
> ...
> sgrad=0.16*abs(dcp(i)/pi4)/(dc(i)/pi4)**1.33
> write(28,'(5(e12.6,1x))') r(i),dc(i),sgrad,ves(i),vxc(i)
> ...
>
> The problem is that the variable sgrad goes infinite (as
> the denominator becomes zero, which is what it should do
> in any case) and write chokes on it. This, of course,
> is easily fixed by manually adding code that checks the
> denominator before calculating sgrad, but to my mind the
> compiler/runtime-libs should be able to handle a NaN. I
> don't mind if it prints out NaNs, because that's basically
> what the physics predicts. What I do mind is getting SIGFPEs
> and a stopped execution just because write can't handle NaNs.
>
Depends on whether you want to get it working or
try fix your programming environment. Obviously
it would be nice if Alpha's supported NaN in
HW in which case this wouldn't happen. There
apparently was a tradeoff between being fully
IEEE FP compliant and being faster and being
faster won. The "-mieee" flag causes the compiler
to put traps around instructions that can get
FPE's that are SW correctable. The traps slow things
down. Of course, having an IF() statement also
slows things down but at least you control where
you slow down because hopefully you know where
the code can get into trouble.
If it were my application, I'd check for division by
zero and let it go at that. Particularly if I did
not have complete control of what is in the dc()
array, meaning it is filled with input data or
derived from input data.
Wes
^ permalink raw reply [flat|nested] 11+ messages in thread
* egcs g77 and DgncppB
@ 1998-11-15 9:55 Hirsim{ki Mika
1998-11-16 17:22 ` Greg Lindahl
0 siblings, 1 reply; 11+ messages in thread
From: Hirsim{ki Mika @ 1998-11-15 9:55 UTC (permalink / raw)
To: axp-list
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1583 bytes --]
Hi!
I am trying to compile Matthias Fuchs' pseudopotential generation
program (DgncppB, written in fortran, available at fhi-berlin.mpg.de)
with egcs-1.1. If anyone here has been able to compile it on Alpha
Linux, I would appreciate if you could help me.
The problem is that I keep running into runtime arithmetic exceptions
(SIGFPE). Using -mieee got rid of a number of these in the actual
program, but for some reason I haven't been able to fix a problem that
seems to be occuring in the egcs' libI77-sources.
Here's an excerpt from my gdb session...
--<cut here>--
(gdb) run
Starting program: /home/mhi/DgncppB/src/gncpp.x
Program received signal SIGFPE, Arithmetic exception.
0x12003e350 in wrt_E (p=0x120166818, w=12, d=5, e=2, len=8) at wref.c:46
46 if (dd < 0.) {
(gdb) whatis dd
type = double
(gdb) print dd
$1 = -NaN(0x4344a80000000)
--<cut here>--
If I continue the program execution with "signal 0", I get another
exception a bit later, but after that the program exists normally.
It also seems to have produced all the output files properly. What
is going on? Does this look like a bug in egcs' Fortran front? Its
version is:
GNU F77 version egcs-2.91.57 19980901 (egcs-1.1 release) (alphaev5-unknown-linux-gnu) compiled by GNU C version egcs-2.91.57 19980901
(egcs-1.1 release).
GNU Fortran Front End version 0.5.24-19980804
__G77_LIBF77_VERSION__: 0.5.23
@(#)LIBF77 VERSION 19970919
__G77_LIBI77_VERSION__: 0.5.23
@(#) LIBI77 VERSION pjw,dmg-mods 19980617
__G77_LIBU77_VERSION__: 0.5.23
@(#) LIBU77 VERSION 19980709
--
Mika Hirsimäki
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: egcs g77 and DgncppB
1998-11-15 9:55 Hirsim{ki Mika
@ 1998-11-16 17:22 ` Greg Lindahl
1998-11-16 23:07 ` Wes Bauske
0 siblings, 1 reply; 11+ messages in thread
From: Greg Lindahl @ 1998-11-16 17:22 UTC (permalink / raw)
To: axp-list
> The problem is that I keep running into runtime arithmetic exceptions
> (SIGFPE). Using -mieee got rid of a number of these in the actual
> program, but for some reason I haven't been able to fix a problem that
> seems to be occuring in the egcs' libI77-sources.
This looks like libI77 was not itself compiled with -mieee. Don't the
egcs build scripts default to building libI77 with -mieee?
-- g
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: egcs g77 and DgncppB
1998-11-16 17:22 ` Greg Lindahl
@ 1998-11-16 23:07 ` Wes Bauske
0 siblings, 0 replies; 11+ messages in thread
From: Wes Bauske @ 1998-11-16 23:07 UTC (permalink / raw)
To: axp-list
Greg Lindahl wrote:
>
> > The problem is that I keep running into runtime arithmetic exceptions
> > (SIGFPE). Using -mieee got rid of a number of these in the actual
> > program, but for some reason I haven't been able to fix a problem that
> > seems to be occuring in the egcs' libI77-sources.
>
> This looks like libI77 was not itself compiled with -mieee. Don't the
> egcs build scripts default to building libI77 with -mieee?
>
Would make sense to have the libraries built both ways.
That way people who don't want to fix the bugs in their
code can pay the penalty for using -mieee and those willing
to get their code working correctly get the best performance
available by using a non -mieee version of the library.
Wes
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~1998-11-18 20:18 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-11-17 17:25 egcs g77 and DgncppB Greg Lindahl
1998-11-17 18:19 ` Wes Bauske
-- strict thread matches above, loose matches on Subject: below --
1998-11-17 22:00 Greg Lindahl
1998-11-17 22:38 ` Wes Bauske
1998-11-17 20:27 Greg Lindahl
1998-11-17 21:50 ` Wes Bauske
1998-11-18 18:15 ` Hirsim{ki Mika
1998-11-18 20:25 ` Wes Bauske
1998-11-15 9:55 Hirsim{ki Mika
1998-11-16 17:22 ` Greg Lindahl
1998-11-16 23:07 ` Wes Bauske
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox