Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
* DU <--> Linux FP exceptions with DU binaries
@ 1999-01-19  5:00 Norbert Paschedag
  1999-01-19  5:00 ` Andreas Krall
  1999-01-19  5:00 ` Greg Lindahl
  0 siblings, 2 replies; 6+ messages in thread
From: Norbert Paschedag @ 1999-01-19  5:00 UTC (permalink / raw)


Hi, 

I have a question for the more experienced Fortran users : 

We're trying to run DU binaries (Dec F90) on our Linux machines. Under both
Digital UNIX and Linux we experience floating point exceptions which 
appear due to FP underflows etc.
Under Digital UNIX we can prevent these exceptions by using flags like '-fpe1'
for compilation and the binaries will run happily.
Under Linux, however, the exact same binaries still die with 'floating point
exceptions'.
Could anyone please explain

 -  How exactly FP exceptions are handled by those operating systems
    ( I understand that this is something the kernel does ).

 -  How to install exceptions handlers that work under both Linux and DU.
    Would one need to change the Linux kernel for this ?

Thanks !

Regards,
  Norbert Paschedag







^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: DU <--> Linux FP exceptions with DU binaries
  1999-01-19  5:00 DU <--> Linux FP exceptions with DU binaries Norbert Paschedag
  1999-01-19  5:00 ` Andreas Krall
@ 1999-01-19  5:00 ` Greg Lindahl
  1999-01-19  5:00   ` Norbert Paschedag
  1 sibling, 1 reply; 6+ messages in thread
From: Greg Lindahl @ 1999-01-19  5:00 UTC (permalink / raw)


noe@physik.unizh.ch (Norbert Paschedag) writes:

> Under Digital UNIX we can prevent these exceptions by using flags like '-fpe1'
> for compilation and the binaries will run happily.
> Under Linux, however, the exact same binaries still die with 'floating point
> exceptions'.
> Could anyone please explain

1) Did you static link the binary?

2) What kernel?

If you didn't static link the binary, then the math library could be
guilty. If you have a very old kernel, it may not be handling things
properly.

-- g



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: DU <--> Linux FP exceptions with DU binaries
  1999-01-19  5:00 ` Greg Lindahl
@ 1999-01-19  5:00   ` Norbert Paschedag
  0 siblings, 0 replies; 6+ messages in thread
From: Norbert Paschedag @ 1999-01-19  5:00 UTC (permalink / raw)


In article <7829jk$33p@news3.newsguy.com>,
Greg Lindahl <lindahl@pbm.com> wrote:
>noe@physik.unizh.ch (Norbert Paschedag) writes:
>
>> Under Digital UNIX we can prevent these exceptions by using flags like '-fpe1'
>> for compilation and the binaries will run happily.
>> Under Linux, however, the exact same binaries still die with 'floating point
>> exceptions'.
>> Could anyone please explain
>
>1) Did you static link the binary?

Yes, sure. 

>2) What kernel?

Anything between 2.035 and 2.1.131.

From what I see I don't think that the math library handles these exceptions,
it only inserts code that checks FP ops and "generates" the traps.
Correct me if I'm wrong here.

There's a flag for CONFIG_MATHEMU in the kernel configuration. In my case
it's set to "y". Does anyone know what *exactly* this does ? 

Norbert




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: DU <--> Linux FP exceptions with DU binaries
  1999-01-19  5:00 DU <--> Linux FP exceptions with DU binaries Norbert Paschedag
@ 1999-01-19  5:00 ` Andreas Krall
  1999-01-20  5:00   ` Michal Jaegermann
  1999-01-20  5:00   ` Norbert Paschedag
  1999-01-19  5:00 ` Greg Lindahl
  1 sibling, 2 replies; 6+ messages in thread
From: Andreas Krall @ 1999-01-19  5:00 UTC (permalink / raw)


In article <781meq$12mi@rzurs10.unizh.ch>,
	noe@physik.unizh.ch (Norbert Paschedag) writes:
> Hi, 
> 
> I have a question for the more experienced Fortran users : 
> 
> We're trying to run DU binaries (Dec F90) on our Linux machines. Under both
> Digital UNIX and Linux we experience floating point exceptions which 
> appear due to FP underflows etc.

In my C-source code I use under Linux and Digital Unix I use the
following:



#ifdef __osf__

void init_exceptions(void)
{

#else /* Linux */

/* Linux on Digital Alpha needs an initialisation of the ieee floating point
	control for IEEE compliant arithmetic (option -mieee of GCC). Under
	Digital Unix this is done automatically.
*/

#include <asm/fpu.h>

extern unsigned long ieee_get_fp_control();
extern void ieee_set_fp_control(unsigned long fp_control);

void init_exceptions(void)
{
/* initialize floating point control */

ieee_set_fp_control(ieee_get_fp_control()
                    & ~IEEE_TRAP_ENABLE_INV
                    & ~IEEE_TRAP_ENABLE_DZE
/*                  & ~IEEE_TRAP_ENABLE_UNF   we dont want underflow */
                    & ~IEEE_TRAP_ENABLE_OVF);
#endif
}

Try a similar initialisation using the FORTRAN equivalent.

Andi

-- 
andi@complang.tuwien.ac.at               Andreas Krall
http://www.complang.tuwien.ac.at/andi/   Inst. f. Computersprachen, TU Wien
tel: (+431) 58801/18511                  Argentinierstr. 8/4/1851
fax: (+431) 58801/18598                  A-1040 Wien     AUSTRIA     EUROPE



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: DU <--> Linux FP exceptions with DU binaries
  1999-01-19  5:00 ` Andreas Krall
  1999-01-20  5:00   ` Michal Jaegermann
@ 1999-01-20  5:00   ` Norbert Paschedag
  1 sibling, 0 replies; 6+ messages in thread
From: Norbert Paschedag @ 1999-01-20  5:00 UTC (permalink / raw)


In article <782mmd$jci$1@news.tuwien.ac.at>,
Andreas Krall <andi@complang.tuwien.ac.at> wrote:

>In my C-source code I use under Linux and Digital Unix I use the
>following:
>
>
>#ifdef __osf__
>
>void init_exceptions(void)
>{
>
>#else /* Linux */
>
>/* Linux on Digital Alpha needs an initialisation of the ieee floating point
>	control for IEEE compliant arithmetic (option -mieee of GCC). Under
>	Digital Unix this is done automatically.
>*/

O.k, you do this if you *compile* under both Linux and DU, but I'm taking
the *binary* and try to run it under both OSes.
Or do you mean that I should include these calls, then compile under DU and
then run the binary under Linux ?

Norbert





































^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: DU <--> Linux FP exceptions with DU binaries
  1999-01-19  5:00 ` Andreas Krall
@ 1999-01-20  5:00   ` Michal Jaegermann
  1999-01-20  5:00   ` Norbert Paschedag
  1 sibling, 0 replies; 6+ messages in thread
From: Michal Jaegermann @ 1999-01-20  5:00 UTC (permalink / raw)


Andreas Krall (andi@complang.tuwien.ac.at) wrote:

[ code skipped ]
: Try a similar initialisation using the FORTRAN equivalent.

You really do not need to.  There is no problem in linking
together Fortran and C compiled object files.  Just check how
symbols are generated by your compilers.

  --mj




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-01-20  5:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-01-19  5:00 DU <--> Linux FP exceptions with DU binaries Norbert Paschedag
1999-01-19  5:00 ` Andreas Krall
1999-01-20  5:00   ` Michal Jaegermann
1999-01-20  5:00   ` Norbert Paschedag
1999-01-19  5:00 ` Greg Lindahl
1999-01-19  5:00   ` Norbert Paschedag

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